Changeset 5 for src/test/java/geniusweb


Ignore:
Timestamp:
09/24/19 14:13:24 (5 years ago)
Author:
bart
Message:

Fixed performance issue with some computers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/test/java/geniusweb/clienttest/JavaClientTest.java

    r3 r5  
    6060        @Test
    6161        public void clientSmokeTest() throws IOException {
    62                 WebSocketFactory factory = new WebSocketFactory().setConnectionTimeout(5000);
    63                 WebSocket ws = factory.createSocket("ws://localhost:8080/profilesserver/websocket/liststream");
     62                WebSocketFactory factory = new WebSocketFactory()
     63                                .setConnectionTimeout(5000);
     64                WebSocket ws = factory.createSocket(
     65                                "ws://localhost:8080/profilesserver/websocket/liststream");
    6466        }
    6567
    6668        @Test
    67         public void testGetList() throws IOException, InterruptedException, WebSocketException {
     69        public void testGetList()
     70                        throws IOException, InterruptedException, WebSocketException {
    6871                final List<String> received = new LinkedList<>();
    6972                Thread.sleep(5000);
    70                 WebSocketFactory factory = new WebSocketFactory().setConnectionTimeout(20000);
    71                 WebSocket ws = factory.createSocket("ws://localhost:8080/profilesserver/websocket/liststream");
     73                WebSocketFactory factory = new WebSocketFactory()
     74                                .setConnectionTimeout(20000);
     75                WebSocket ws = factory.createSocket(
     76                                "ws://localhost:8080/profilesserver/websocket/liststream");
    7277
    7378                ws.addListener(new WebSocketAdapter() {
    7479                        @Override
    75                         public void onTextMessage(WebSocket websocket, String message) throws Exception {
     80                        public void onTextMessage(WebSocket websocket, String message)
     81                                        throws Exception {
    7682                                System.out.println("received message: " + message);
    7783                                received.add(message);
     
    8187                assertTrue(ws.isOpen());
    8288
    83                 Thread.sleep(2000);
     89                Thread.sleep(15000);
    8490
    8591                assertEquals(1, received.size()); // 1 answer received
     
    9096                Map<String, Object> map = mapper.readValue(received.get(0), typeRef);
    9197
    92                 List<String> domains= new LinkedList<>();
    93                 for (String key: map.keySet()) {
     98                List<String> domains = new LinkedList<>();
     99                for (String key : map.keySet()) {
    94100                        domains.add(key.substring(key.indexOf("get")));
    95                         }
     101                }
    96102                assertTrue(domains.contains("get/jobs"));
    97103                assertTrue(domains.contains("get/7issues"));
     
    99105
    100106        @Test
    101         public void testExample() throws WebSocketException, InterruptedException, IOException {
     107        public void testExample()
     108                        throws WebSocketException, InterruptedException, IOException {
    102109                DownloadProfileExample test = new DownloadProfileExample();
    103110                test.run();
     
    106113
    107114        @Test
    108         public void testExample2() throws WebSocketException, InterruptedException, IOException {
     115        public void testExample2()
     116                        throws WebSocketException, InterruptedException, IOException {
    109117                DownloadProfileExample2 test = new DownloadProfileExample2();
    110118                assertEquals(JOBS1PROFILE, test.getReceived());
     
    119127
    120128                // Create factory and coerce Jython calculator object
    121                 JythonObjectFactory factory = new JythonObjectFactory(WebSocketAdapter.class, "PythonDownloadProfile",
     129                JythonObjectFactory factory = new JythonObjectFactory(
     130                                WebSocketAdapter.class, "PythonDownloadProfile",
    122131                                "PythonDownloadProfile");
    123132                factory.createObject();
Note: See TracChangeset for help on using the changeset viewer.