Changeset 9 for protocol/src/test/java
- Timestamp:
- 11/28/19 14:40:48 (5 years ago)
- Location:
- protocol/src/test/java/geniusweb/protocol
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
protocol/src/test/java/geniusweb/protocol/session/ConnectionWithPartiesTest.java
r1 r9 14 14 15 15 import geniusweb.actions.PartyId; 16 import geniusweb.protocol.partyconnection. ConnectionWithParties;17 import geniusweb.protocol.partyconnection. ConnectionWithParty;16 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 17 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 18 18 import tudelft.utilities.junit.GeneralTests; 19 19 20 20 public class ConnectionWithPartiesTest 21 extends GeneralTests< ConnectionWithParties> {21 extends GeneralTests<ProtocolToPartyConnections> { 22 22 PartyId party1 = new PartyId("party1"); 23 23 PartyId party2 = new PartyId("party2"); 24 24 PartyId party3 = new PartyId("party3"); 25 25 26 private ConnectionWithParty con1 = mock(ConnectionWithParty.class);27 private ConnectionWithParty con2 = mock(ConnectionWithParty.class);28 private ConnectionWithParty con3 = mock(ConnectionWithParty.class);26 private ProtocolToPartyConn con1 = mock(ProtocolToPartyConn.class); 27 private ProtocolToPartyConn con2 = mock(ProtocolToPartyConn.class); 28 private ProtocolToPartyConn con3 = mock(ProtocolToPartyConn.class); 29 29 30 private ConnectionWithParties conns1 = new ConnectionWithParties(30 private ProtocolToPartyConnections conns1 = new ProtocolToPartyConnections( 31 31 Arrays.asList(con1, con2)); 32 private ConnectionWithParties conns1a = new ConnectionWithParties(32 private ProtocolToPartyConnections conns1a = new ProtocolToPartyConnections( 33 33 Arrays.asList(con1, con2)); 34 private ConnectionWithParties conns2 = new ConnectionWithParties(34 private ProtocolToPartyConnections conns2 = new ProtocolToPartyConnections( 35 35 Arrays.asList(con1, con3)); 36 private ConnectionWithParties conns3 = new ConnectionWithParties(36 private ProtocolToPartyConnections conns3 = new ProtocolToPartyConnections( 37 37 Arrays.asList(con2, con1)); 38 private ConnectionWithParties conns4 = new ConnectionWithParties(38 private ProtocolToPartyConnections conns4 = new ProtocolToPartyConnections( 39 39 Arrays.asList(con2, con1, con3)); 40 private ConnectionWithParties conns5 = new ConnectionWithParties(40 private ProtocolToPartyConnections conns5 = new ProtocolToPartyConnections( 41 41 Arrays.asList(con2, con1, con3, con1)); 42 42 … … 54 54 55 55 @Override 56 public List<List< ConnectionWithParties>> getGeneralTestData() {56 public List<List<ProtocolToPartyConnections>> getGeneralTestData() { 57 57 return Arrays.asList(Arrays.asList(conns1, conns1a), 58 58 Arrays.asList(conns2), Arrays.asList(conns3), … … 98 98 @Test 99 99 public void withPartyTest() { 100 ConnectionWithParties conns = conns3.with(con3);100 ProtocolToPartyConnections conns = conns3.with(con3); 101 101 assertEquals(2, conns3.size()); 102 102 assertEquals(3, conns.size()); -
protocol/src/test/java/geniusweb/protocol/session/DefaultSessionStateTest.java
r8 r9 27 27 import geniusweb.progress.ProgressTime; 28 28 import geniusweb.protocol.ProtocolException; 29 import geniusweb.protocol.partyconnection. ConnectionWithParties;29 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 30 30 import geniusweb.protocol.session.saop.SAOPSettings; 31 31 import geniusweb.references.Parameters; … … 48 48 PartyId party1 = new PartyId("party1"); 49 49 actions.add(new EndNegotiation(party1)); 50 ConnectionWithParties conns = new ConnectionWithParties(50 ProtocolToPartyConnections conns = new ProtocolToPartyConnections( 51 51 Collections.EMPTY_LIST); 52 52 DeadlineTime deadline = new DeadlineTime(1000); … … 126 126 127 127 public DefaultSessionState1(List<Action> actions, 128 ConnectionWithParties conns, Progress progr,128 ProtocolToPartyConnections conns, Progress progr, 129 129 SessionSettings settings, 130 130 Map<PartyId, PartyWithProfile> partyprofiles, ProtocolException e) { -
protocol/src/test/java/geniusweb/protocol/session/saop/SAOPStateTest.java
r4 r9 27 27 import geniusweb.progress.ProgressTime; 28 28 import geniusweb.protocol.ProtocolException; 29 import geniusweb.protocol.partyconnection. ConnectionWithParties;30 import geniusweb.protocol.partyconnection. ConnectionWithParty;29 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 30 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 31 31 import geniusweb.protocol.session.SessionSettings; 32 32 import tudelft.utilities.junit.GeneralTests; … … 42 42 private List<Action> actions2 = Arrays.asList(action); 43 43 44 private ConnectionWithParty party1conn = mock(ConnectionWithParty.class);45 private ConnectionWithParty party2conn = mock(ConnectionWithParty.class);46 private ConnectionWithParty party3conn = mock(ConnectionWithParty.class);47 48 private ConnectionWithParties connections = new ConnectionWithParties(44 private ProtocolToPartyConn party1conn = mock(ProtocolToPartyConn.class); 45 private ProtocolToPartyConn party2conn = mock(ProtocolToPartyConn.class); 46 private ProtocolToPartyConn party3conn = mock(ProtocolToPartyConn.class); 47 48 private ProtocolToPartyConnections connections = new ProtocolToPartyConnections( 49 49 Arrays.asList(party1conn, party2conn)); 50 private ConnectionWithParties connections2 = new ConnectionWithParties(50 private ProtocolToPartyConnections connections2 = new ProtocolToPartyConnections( 51 51 Arrays.asList(party1conn, party3conn)); 52 private ConnectionWithParties connections3 = new ConnectionWithParties(52 private ProtocolToPartyConnections connections3 = new ProtocolToPartyConnections( 53 53 Arrays.asList(party1conn, party2conn, party3conn)); 54 54 … … 114 114 @Test 115 115 public void constructWith0Connection() { 116 new SAOPState(actions, new ConnectionWithParties(Arrays.asList()),116 new SAOPState(actions, new ProtocolToPartyConnections(Arrays.asList()), 117 117 progresstime, settings, null, null); 118 118 } … … 132 132 @Test 133 133 public void testNextActor2() { 134 ConnectionWithParties conns = new ConnectionWithParties(134 ProtocolToPartyConnections conns = new ProtocolToPartyConnections( 135 135 Arrays.asList(party2conn, party3conn)); 136 136 SAOPState state = new SAOPState(actions, conns, progresstime, settings, -
protocol/src/test/java/geniusweb/protocol/session/saop/SAOPTest.java
r8 r9 39 39 import geniusweb.progress.Progress; 40 40 import geniusweb.protocol.ProtocolException; 41 import geniusweb.protocol.partyconnection. ConnectionWithParties;42 import geniusweb.protocol.partyconnection. ConnectionWithParty;43 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;41 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 42 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 43 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 44 44 import geniusweb.references.Parameters; 45 45 import geniusweb.references.PartyRef; … … 76 76 private final PartyWithProfile party2 = mock(PartyWithProfile.class); 77 77 private SAOP saop; 78 private ConnectionWithPartyFactory factory;78 private ProtocolToPartyConnFactory factory; 79 79 private List connections; 80 private ConnectionWithParty conn1 = mock(ConnectionWithParty.class),81 conn2 = mock( ConnectionWithParty.class);80 private ProtocolToPartyConn conn1 = mock(ProtocolToPartyConn.class), 81 conn2 = mock(ProtocolToPartyConn.class); 82 82 private Map<PartyId, PartyWithProfile> partyprofiles; 83 83 private Progress progress = mock(Progress.class); 84 84 private ProfileRef profile1; 85 85 private ProfileRef profile2; 86 private ConnectionWithParties connectionswithparties = mock(87 ConnectionWithParties.class);;86 private ProtocolToPartyConnections connectionswithparties = mock( 87 ProtocolToPartyConnections.class);; 88 88 @SuppressWarnings("unchecked") 89 89 private final Listener<ProtocolEvent> testlistener = mock(Listener.class); … … 116 116 when(settings.getDeadline()).thenReturn(deadlinetime); 117 117 118 factory = mock( ConnectionWithPartyFactory.class);118 factory = mock(ProtocolToPartyConnFactory.class); 119 119 connections = mock(List.class); 120 120 when(factory.connect(any(List.class))).thenReturn(connections); … … 159 159 when(state.getPartyProfiles()).thenReturn(partyprofiles); 160 160 when(state.getProgress()).thenReturn(progress); 161 when(state.with(any( ConnectionWithParty.class),161 when(state.with(any(ProtocolToPartyConn.class), 162 162 any(PartyWithProfile.class))).thenReturn(connectedstate); 163 163 when(state.getNextActor()).thenReturn(PARTY1ID); -
protocol/src/test/java/geniusweb/protocol/tournament/AllPermutationsProtocolTest.java
r1 r9 24 24 import geniusweb.protocol.NegoState; 25 25 import geniusweb.protocol.SessionResult; 26 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;26 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 27 27 import geniusweb.protocol.session.SessionProtocol; 28 28 import geniusweb.protocol.session.SessionSettings; … … 42 42 private final AllPermutationsProtocol app = new AllPermutationsProtocol( 43 43 state, log); 44 private final ConnectionWithPartyFactory factory = mock(45 ConnectionWithPartyFactory.class);44 private final ProtocolToPartyConnFactory factory = mock( 45 ProtocolToPartyConnFactory.class); 46 46 private final SessionSettings settings = mock(SessionSettings.class); 47 47 private final SessionState finalsessionstate = mock(SessionState.class); … … 140 140 141 141 @Override 142 public void start( ConnectionWithPartyFactory connectionfactory) {142 public void start(ProtocolToPartyConnFactory connectionfactory) { 143 143 144 144 }
Note:
See TracChangeset
for help on using the changeset viewer.