Changeset 8 for src/test/java/geniusweb/partiesserver
- Timestamp:
- 11/28/19 14:41:10 (5 years ago)
- Location:
- src/test/java/geniusweb/partiesserver
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/test/java/geniusweb/partiesserver/AvailablePartiesUpdaterTest.java
r1 r8 31 31 32 32 public class AvailablePartiesUpdaterTest { 33 private static final String RANDOMPARTY = "target/jars/randomparty-1.1.0.jar"; 33 34 private static final int TESTRATE = 200; // check file changes every 200ms 34 35 @SuppressWarnings("unchecked") … … 146 147 public void randomPartyJarTest() throws IOException, InterruptedException { 147 148 init(); 148 Files.copy(Paths.get("target/jars/randomparty-1.0.0.jar"), 149 tmpdir.resolve(RNDPARTY)); 149 Files.copy(Paths.get(RANDOMPARTY), tmpdir.resolve(RNDPARTY)); 150 150 151 151 Thread.sleep(2 * TESTRATE); … … 157 157 public void removeJarTest() throws IOException, InterruptedException { 158 158 init(); 159 Files.copy(Paths.get( "target/jars/randomparty-1.0.0.jar"), RNDPARTY);159 Files.copy(Paths.get(RANDOMPARTY), RNDPARTY); 160 160 Thread.sleep(2 * TESTRATE); 161 161 assertEquals(1, repo.list().size()); … … 169 169 public void removeRootTest() throws IOException, InterruptedException { 170 170 init(); 171 Files.copy(Paths.get( "target/jars/randomparty-1.0.0.jar"), RNDPARTY);171 Files.copy(Paths.get(RANDOMPARTY), RNDPARTY); 172 172 Thread.sleep(2 * TESTRATE); 173 173 assertEquals(1, repo.list().size()); -
src/test/java/geniusweb/partiesserver/JavaClientTest.java
r7 r8 39 39 */ 40 40 public class JavaClientTest { 41 // private static final String JSON = "{\"jobs\":[\"jobs1\"]}"; 41 private static final String RANDOMPARTY = "http://localhost:8080/partiesserver/run/randomparty-1.1.0"; 42 // private static final String JSON = "{\"jobs\":[\"jobs1\"]}"; 42 43 // private static final String JOBS1PROFILE = "{\"LinearAdditiveUtilitySpace\":{\"issueUtilities\":{\"lease car\":{\"discreteutils\":{\"valueUtilities\":{\"no\":0,\"yes\":1}}},\"permanent contract\":{\"discreteutils\":{\"valueUtilities\":{\"no\":0,\"yes\":1}}},\"career development opportunities\":{\"discreteutils\":{\"valueUtilities\":{\"high\":1,\"low\":0,\"medium\":0.5}}},\"fte\":{\"discreteutils\":{\"valueUtilities\":{\"1.0\":0.75,\"0.6\":0.25,\"0.8\":0.5}}},\"salary\":{\"discreteutils\":{\"valueUtilities\":{\"4000\":1.0,\"2500\":0.25,\"3500\":0.75,\"2000\":0,\"3000\":0.3}}},\"work from home\":{\"discreteutils\":{\"valueUtilities\":{\"1\":0.5,\"2\":0.666666666666,\"0\":0.333333333}}}},\"issueWeights\":{\"lease car\":0.06,\"permanent contract\":0.16,\"career development opportunities\":0.04,\"fte\":0.32,\"salary\":0.24,\"work from home\":0.18},\"domain\":{\"name\":\"jobs\",\"issuesValues\":{\"lease car\":{\"values\":[\"yes\",\"no\"]},\"permanent contract\":{\"values\":[\"yes\",\"no\"]},\"career development opportunities\":{\"values\":[\"low\",\"medium\",\"high\"]},\"fte\":{\"values\":[\"0.6\",\"0.8\",\"1.0\"]},\"salary\":{\"values\":[\"2000\",\"2500\",\"3000\",\"3500\",\"4000\"]},\"work from home\":{\"values\":[\"0\",\"1\",\"2\"]}}},\"name\":\"jobs1\"}}"; 43 44 private EmbeddedTomcat tomcat = new EmbeddedTomcat(); … … 60 61 public void after() throws Throwable { 61 62 Thread.sleep(2000); 63 System.setSecurityManager(null); 62 64 tomcat.stop(); 63 65 } … … 157 159 */ 158 160 private String startParty() throws IOException, InterruptedException { 159 URL url = new URL( 160 "http://localhost:8080/partiesserver/run/randomparty-1.0.0"); 161 URL url = new URL(RANDOMPARTY); 161 162 HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 162 163 conn.setRequestMethod("GET"); -
src/test/java/geniusweb/partiesserver/repository/RunningPartyTest.java
r1 r8 16 16 import com.fasterxml.jackson.databind.ObjectMapper; 17 17 18 import geniusweb.actions.Action;19 18 import geniusweb.actions.PartyId; 20 import geniusweb.connection.DefaultConnection; 21 import geniusweb.partiesserver.repository.AvailableParty; 22 import geniusweb.partiesserver.repository.RunningParty; 19 import geniusweb.partiesserver.websocket.PartySocket; 23 20 import geniusweb.party.Capabilities; 24 21 import geniusweb.party.DefaultParty; … … 90 87 RunningParty rparty = new RunningParty(party1, id1, "name1", now, end, 91 88 null); 92 DefaultConnection<Inform, Action> connection = mock( 93 DefaultConnection.class); 89 PartySocket connection = mock(PartySocket.class); 94 90 rparty = rparty.withConnection(connection); 95 91 } … … 99 95 RunningParty rparty = new RunningParty(party1, id1, "name1", now, end, 100 96 null); 101 DefaultConnection<Inform, Action> connection = mock( 102 DefaultConnection.class); 97 PartySocket connection = mock(PartySocket.class); 103 98 rparty = rparty.withConnection(connection); 104 99 rparty = rparty.withConnection(connection); … … 112 107 RunningParty rparty = new RunningParty(party1, id1, "name1", now, end, 113 108 null); 114 DefaultConnection<Inform, Action> connection = mock( 115 DefaultConnection.class); 109 PartySocket connection = mock(PartySocket.class); 116 110 rparty = rparty.withConnection(connection); 117 111 … … 120 114 121 115 ArgumentCaptor<Inform> argument = ArgumentCaptor.forClass(Inform.class); 122 verify(connection, times(1)).notify Change(argument.capture());116 verify(connection, times(1)).notifyListeners(argument.capture()); 123 117 assertEquals(info, argument.getValue()); 124 118 } -
src/test/java/geniusweb/partiesserver/websocket/PartySocketTest.java
r1 r8 23 23 import geniusweb.actions.EndNegotiation; 24 24 import geniusweb.actions.PartyId; 25 import geniusweb.connection.Connection ;25 import geniusweb.connection.ConnectionEnd; 26 26 import geniusweb.partiesserver.repository.RunningPartiesRepo; 27 27 import geniusweb.partiesserver.repository.RunningParty; 28 import geniusweb.partiesserver.websocket.PartySocket;29 28 import geniusweb.party.Party; 30 29 import geniusweb.party.inform.Inform; … … 83 82 84 83 @SuppressWarnings("unchecked") 85 Connection <Inform, Action> connection = mock(Connection.class);84 ConnectionEnd<Inform, Action> connection = mock(ConnectionEnd.class); 86 85 /* 87 86 * we must call runningparty directly on this one because
Note:
See TracChangeset
for help on using the changeset viewer.