Changeset 9 for simplerunner
- Timestamp:
- 11/28/19 14:40:48 (5 years ago)
- Location:
- simplerunner
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
simplerunner/pom.xml
r6 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>simplerunner</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 31 31 <groupId>geniusweb</groupId> 32 32 <artifactId>protocol</artifactId> 33 <version>1. 0.0</version>33 <version>1.1.0</version> 34 34 </dependency> 35 35 <dependency> 36 36 <groupId>geniusweb</groupId> 37 37 <artifactId>party</artifactId> 38 <version>1. 0.0</version>38 <version>1.1.0</version> 39 39 </dependency> 40 40 <dependency> 41 41 <groupId>geniusweb.exampleparties</groupId> 42 42 <artifactId>randomparty</artifactId> 43 <version>1.0.0</version> 43 <version>1.1.0</version> 44 <scope>test</scope> 44 45 </dependency> 45 46 … … 98 99 </configuration> 99 100 </plugin> 100 101 <plugin> 102 <groupId>org.apache.maven.plugins</groupId> 103 <artifactId>maven-enforcer-plugin</artifactId> 104 <version>3.0.0-M2</version> 105 <executions> 106 <execution> 107 <id>enforce</id> 108 <configuration> 109 <rules> 110 <dependencyConvergence /> 111 </rules> 112 </configuration> 113 <goals> 114 <goal>enforce</goal> 115 </goals> 116 </execution> 117 </executions> 118 </plugin> 101 119 <plugin> 102 120 <groupId>org.apache.maven.plugins</groupId> -
simplerunner/src/main/java/geniusweb/simplerunner/BasicConnection.java
r1 r9 4 4 import java.net.URI; 5 5 6 import geniusweb.connection.Connection ;6 import geniusweb.connection.ConnectionEnd; 7 7 import geniusweb.references.Reference; 8 8 import tudelft.utilities.listener.DefaultListenable; … … 17 17 */ 18 18 public class BasicConnection<IN, OUT> extends DefaultListenable<IN> 19 implements Connection <IN, OUT> {19 implements ConnectionEnd<IN, OUT> { 20 20 private final Reference reference; 21 21 private final URI uri; -
simplerunner/src/main/java/geniusweb/simplerunner/ClassPathConnectionFactory.java
r1 r9 13 13 import geniusweb.party.Party; 14 14 import geniusweb.party.inform.Inform; 15 import geniusweb.protocol.partyconnection. ConnectionWithParty;16 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;15 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 16 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 17 17 import geniusweb.references.Reference; 18 18 import tudelft.utilities.repository.NoResourcesNowException; … … 25 25 * 26 26 */ 27 public class ClassPathConnectionFactory implements ConnectionWithPartyFactory {27 public class ClassPathConnectionFactory implements ProtocolToPartyConnFactory { 28 28 private static final String SCHEME = "classpath"; 29 29 private static int serialcounter = 1; … … 31 31 32 32 @Override 33 public ConnectionWithPartyconnect(Reference reference) {33 public ProtocolToPartyConn connect(Reference reference) { 34 34 // set up the whole other party including the connection to it. 35 35 String classpath = getClassPath(reference.getURI()); … … 42 42 uri("classpath:" + reference.getURI().getSchemeSpecificPart() 43 43 + "." + (serialcounter++))); 44 party2protocol.init(action -> protocol2party.notify Change(action));45 protocol2party.init(info -> party2protocol.notify Change(info));44 party2protocol.init(action -> protocol2party.notifyListeners(action)); 45 protocol2party.init(info -> party2protocol.notifyListeners(info)); 46 46 47 47 party.connect(party2protocol); … … 102 102 103 103 @Override 104 public List< ConnectionWithParty> connect(List<Reference> references)104 public List<ProtocolToPartyConn> connect(List<Reference> references) 105 105 throws IOException, NoResourcesNowException { 106 List< ConnectionWithParty> connections = new LinkedList<>();106 List<ProtocolToPartyConn> connections = new LinkedList<>(); 107 107 for (Reference partyref : references) { 108 108 connections.add(connect(partyref)); … … 114 114 115 115 class BasicConnectionWithParty extends BasicConnection<Action, Inform> 116 implements ConnectionWithParty{116 implements ProtocolToPartyConn { 117 117 118 118 private PartyId id; -
simplerunner/src/main/java/geniusweb/simplerunner/NegoRunner.java
r1 r9 13 13 import geniusweb.protocol.NegoProtocol; 14 14 import geniusweb.protocol.NegoSettings; 15 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;15 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 16 16 import geniusweb.protocol.session.SessionSettings; 17 17 import tudelft.utilities.logging.ReportToLogger; … … 27 27 private final NegoSettings settings; 28 28 private final NegoProtocol protocol; 29 private final ConnectionWithPartyFactory connectionfactory;29 private final ProtocolToPartyConnFactory connectionfactory; 30 30 private final Reporter log; 31 31 private final static ObjectMapper jackson = new ObjectMapper(); 32 32 33 33 public NegoRunner(NegoSettings settings, 34 ConnectionWithPartyFactory connectionfactory, Reporter logger) {34 ProtocolToPartyConnFactory connectionfactory, Reporter logger) { 35 35 if (settings == null || connectionfactory == null) { 36 36 throw new NullPointerException("Arguments must be not null"); -
simplerunner/src/test/java/geniusweb/simplerunner/ClassPathConnectionFactoryTest.java
r1 r9 10 10 11 11 import geniusweb.actions.Action; 12 import geniusweb.connection.Connection ;12 import geniusweb.connection.ConnectionEnd; 13 13 import geniusweb.party.inform.Inform; 14 14 import geniusweb.references.PartyRef; … … 42 42 @Test 43 43 public void testRandomParty() throws IOException, URISyntaxException { 44 Connection <Action, Inform> party = factory.connect(new PartyRef(44 ConnectionEnd<Action, Inform> party = factory.connect(new PartyRef( 45 45 "classpath:geniusweb.exampleparties.randomparty.RandomParty")); 46 46 assertNotNull(party); -
simplerunner/src/test/java/geniusweb/simplerunner/SessionRunnerTest.java
r1 r9 18 18 import geniusweb.protocol.CurrentNegoState; 19 19 import geniusweb.protocol.ProtocolException; 20 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;20 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 21 21 import geniusweb.protocol.session.SessionProtocol; 22 22 import geniusweb.protocol.session.SessionSettings; … … 47 47 public void smokeTest() { 48 48 new NegoRunner(mock(SessionSettings.class), 49 mock( ConnectionWithPartyFactory.class), logger);49 mock(ProtocolToPartyConnFactory.class), logger); 50 50 } 51 51 … … 56 56 when(settings.getProtocol(logger)).thenReturn(protocol); 57 57 @SuppressWarnings("unchecked") 58 ConnectionWithPartyFactory factory = mock(59 ConnectionWithPartyFactory.class);58 ProtocolToPartyConnFactory factory = mock( 59 ProtocolToPartyConnFactory.class); 60 60 61 61 NegoRunner runner = spy( … … 80 80 Reporter logger = mock(Reporter.class); 81 81 @SuppressWarnings("unchecked") 82 ConnectionWithPartyFactory factory = mock(83 ConnectionWithPartyFactory.class);82 ProtocolToPartyConnFactory factory = mock( 83 ProtocolToPartyConnFactory.class); 84 84 NegoRunner runner = spy( 85 85 new NegoRunner(settings, factory, logger)); … … 107 107 when(protocol.getState()).thenReturn(state); 108 108 @SuppressWarnings("unchecked") 109 ConnectionWithPartyFactory factory = mock(110 ConnectionWithPartyFactory.class);109 ProtocolToPartyConnFactory factory = mock( 110 ProtocolToPartyConnFactory.class); 111 111 NegoRunner runner = spy( 112 112 new NegoRunner(settings, factory, logger));
Note:
See TracChangeset
for help on using the changeset viewer.