Changeset 9 for simplerunner/src


Ignore:
Timestamp:
11/28/19 14:40:48 (5 years ago)
Author:
bart
Message:

Release 1.1.0

Location:
simplerunner/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • simplerunner/src/main/java/geniusweb/simplerunner/BasicConnection.java

    r1 r9  
    44import java.net.URI;
    55
    6 import geniusweb.connection.Connection;
     6import geniusweb.connection.ConnectionEnd;
    77import geniusweb.references.Reference;
    88import tudelft.utilities.listener.DefaultListenable;
     
    1717 */
    1818public class BasicConnection<IN, OUT> extends DefaultListenable<IN>
    19                 implements Connection<IN, OUT> {
     19                implements ConnectionEnd<IN, OUT> {
    2020        private final Reference reference;
    2121        private final URI uri;
  • simplerunner/src/main/java/geniusweb/simplerunner/ClassPathConnectionFactory.java

    r1 r9  
    1313import geniusweb.party.Party;
    1414import geniusweb.party.inform.Inform;
    15 import geniusweb.protocol.partyconnection.ConnectionWithParty;
    16 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     15import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
     16import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    1717import geniusweb.references.Reference;
    1818import tudelft.utilities.repository.NoResourcesNowException;
     
    2525 *
    2626 */
    27 public class ClassPathConnectionFactory implements ConnectionWithPartyFactory {
     27public class ClassPathConnectionFactory implements ProtocolToPartyConnFactory {
    2828        private static final String SCHEME = "classpath";
    2929        private static int serialcounter = 1;
     
    3131
    3232        @Override
    33         public ConnectionWithParty connect(Reference reference) {
     33        public ProtocolToPartyConn connect(Reference reference) {
    3434                // set up the whole other party including the connection to it.
    3535                String classpath = getClassPath(reference.getURI());
     
    4242                                uri("classpath:" + reference.getURI().getSchemeSpecificPart()
    4343                                                + "." + (serialcounter++)));
    44                 party2protocol.init(action -> protocol2party.notifyChange(action));
    45                 protocol2party.init(info -> party2protocol.notifyChange(info));
     44                party2protocol.init(action -> protocol2party.notifyListeners(action));
     45                protocol2party.init(info -> party2protocol.notifyListeners(info));
    4646
    4747                party.connect(party2protocol);
     
    102102
    103103        @Override
    104         public List<ConnectionWithParty> connect(List<Reference> references)
     104        public List<ProtocolToPartyConn> connect(List<Reference> references)
    105105                        throws IOException, NoResourcesNowException {
    106                 List<ConnectionWithParty> connections = new LinkedList<>();
     106                List<ProtocolToPartyConn> connections = new LinkedList<>();
    107107                for (Reference partyref : references) {
    108108                        connections.add(connect(partyref));
     
    114114
    115115class BasicConnectionWithParty extends BasicConnection<Action, Inform>
    116                 implements ConnectionWithParty {
     116                implements ProtocolToPartyConn {
    117117
    118118        private PartyId id;
  • simplerunner/src/main/java/geniusweb/simplerunner/NegoRunner.java

    r1 r9  
    1313import geniusweb.protocol.NegoProtocol;
    1414import geniusweb.protocol.NegoSettings;
    15 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     15import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    1616import geniusweb.protocol.session.SessionSettings;
    1717import tudelft.utilities.logging.ReportToLogger;
     
    2727        private final NegoSettings settings;
    2828        private final NegoProtocol protocol;
    29         private final ConnectionWithPartyFactory connectionfactory;
     29        private final ProtocolToPartyConnFactory connectionfactory;
    3030        private final Reporter log;
    3131        private final static ObjectMapper jackson = new ObjectMapper();
    3232
    3333        public NegoRunner(NegoSettings settings,
    34                         ConnectionWithPartyFactory connectionfactory, Reporter logger) {
     34                        ProtocolToPartyConnFactory connectionfactory, Reporter logger) {
    3535                if (settings == null || connectionfactory == null) {
    3636                        throw new NullPointerException("Arguments must be not null");
  • simplerunner/src/test/java/geniusweb/simplerunner/ClassPathConnectionFactoryTest.java

    r1 r9  
    1010
    1111import geniusweb.actions.Action;
    12 import geniusweb.connection.Connection;
     12import geniusweb.connection.ConnectionEnd;
    1313import geniusweb.party.inform.Inform;
    1414import geniusweb.references.PartyRef;
     
    4242        @Test
    4343        public void testRandomParty() throws IOException, URISyntaxException {
    44                 Connection<Action, Inform> party = factory.connect(new PartyRef(
     44                ConnectionEnd<Action, Inform> party = factory.connect(new PartyRef(
    4545                                "classpath:geniusweb.exampleparties.randomparty.RandomParty"));
    4646                assertNotNull(party);
  • simplerunner/src/test/java/geniusweb/simplerunner/SessionRunnerTest.java

    r1 r9  
    1818import geniusweb.protocol.CurrentNegoState;
    1919import geniusweb.protocol.ProtocolException;
    20 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     20import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    2121import geniusweb.protocol.session.SessionProtocol;
    2222import geniusweb.protocol.session.SessionSettings;
     
    4747        public void smokeTest() {
    4848                new NegoRunner(mock(SessionSettings.class),
    49                                 mock(ConnectionWithPartyFactory.class), logger);
     49                                mock(ProtocolToPartyConnFactory.class), logger);
    5050        }
    5151
     
    5656                when(settings.getProtocol(logger)).thenReturn(protocol);
    5757                @SuppressWarnings("unchecked")
    58                 ConnectionWithPartyFactory factory = mock(
    59                                 ConnectionWithPartyFactory.class);
     58                ProtocolToPartyConnFactory factory = mock(
     59                                ProtocolToPartyConnFactory.class);
    6060
    6161                NegoRunner runner = spy(
     
    8080                Reporter logger = mock(Reporter.class);
    8181                @SuppressWarnings("unchecked")
    82                 ConnectionWithPartyFactory factory = mock(
    83                                 ConnectionWithPartyFactory.class);
     82                ProtocolToPartyConnFactory factory = mock(
     83                                ProtocolToPartyConnFactory.class);
    8484                NegoRunner runner = spy(
    8585                                new NegoRunner(settings, factory, logger));
     
    107107                when(protocol.getState()).thenReturn(state);
    108108                @SuppressWarnings("unchecked")
    109                 ConnectionWithPartyFactory factory = mock(
    110                                 ConnectionWithPartyFactory.class);
     109                ProtocolToPartyConnFactory factory = mock(
     110                                ProtocolToPartyConnFactory.class);
    111111                NegoRunner runner = spy(
    112112                                new NegoRunner(settings, factory, logger));
Note: See TracChangeset for help on using the changeset viewer.