Changes in / [3:1]


Ignore:
Location:
/src
Files:
3 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • /src/main/webapp/domainsrepo/7issues/7issues.json

    r3 r1  
    33        "issuesValues": {
    44                "i1": {
    5                         "range": [0, 9, 1]
     5                        "range": ["0", "9", "1"]
    66                },
    77                "i2": {
    8                         "range": [0, 9, 1]
     8                        "range": ["0", "9", "1"]
    99                },
    1010                "i3": {
    11                         "range": [0, 9, 1]
     11                        "range": ["0", "9", "1"]
    1212                },
    1313                "i4": {
    14                         "range": [0, 9, 1]
     14                        "range": ["0", "9", "1"]
    1515                },
    1616                "i5": {
    17                         "range": [0, 9, 1]
     17                        "range": ["0", "9", "1"]
    1818                },
    1919                "i6": {
    20                         "range": [0, 9, 1]
     20                        "range": ["0", "9", "1"]
    2121                },
    2222                "i7": {
    23                         "range": [0, 9, 1]
     23                        "range": ["0", "9", "1"]
    2424                }
    2525        }
  • /src/main/webapp/domainsrepo/7issues/7issues1.json

    r3 r1  
    99                                        "highValue": 9,
    1010                                        "highUtility": 0.99
     11
    1112                                }
    1213                        },
     
    1718                                        "highValue": 9,
    1819                                        "highUtility": 0.97
     20
    1921                                }
    2022                        },
     
    2527                                        "highValue": 9,
    2628                                        "highUtility": 0.96
     29
    2730                                }
    2831                        },
     
    3336                                        "highValue": 9,
    3437                                        "highUtility": 0.94
     38
    3539                                }
    3640                        },
     
    4145                                        "highValue": 9,
    4246                                        "highUtility": 0.93
     47
    4348                                }
    4449                        },
     
    4954                                        "highValue": 9,
    5055                                        "highUtility": 0.92
     56
    5157                                }
    5258                        },
     
    5763                                        "highValue": 9,
    5864                                        "highUtility": 0.91
     65
    5966                                }
    6067                        }
     
    7380                        "issuesValues": {
    7481                                "i1": {
    75                                         "range": [
    76                                                 0,
    77                                                 9,
    78                                                 1
    79                                         ]
     82                                        "range": ["0", "9", "1"]
    8083                                },
    8184                                "i2": {
    82                                         "range": [
    83                                                 0,
    84                                                 9,
    85                                                 1
    86                                         ]
     85                                        "range": ["0", "9", "1"]
    8786                                },
    8887                                "i3": {
    89                                         "range": [
    90                                                 0,
    91                                                 9,
    92                                                 1
    93                                         ]
     88                                        "range": ["0", "9", "1"]
    9489                                },
    9590                                "i4": {
    96                                         "range": [
    97                                                 0,
    98                                                 9,
    99                                                 1
    100                                         ]
     91                                        "range": ["0", "9", "1"]
    10192                                },
    10293                                "i5": {
    103                                         "range": [
    104                                                 0,
    105                                                 9,
    106                                                 1
    107                                         ]
     94                                        "range": ["0", "9", "1"]
    10895                                },
    10996                                "i6": {
    110                                         "range": [
    111                                                 0,
    112                                                 9,
    113                                                 1
    114                                         ]
     97                                        "range": ["0", "9", "1"]
    11598                                },
    11699                                "i7": {
    117                                         "range": [
    118                                                 0,
    119                                                 9,
    120                                                 1
    121                                         ]
     100                                        "range": ["0", "9", "1"]
    122101                                }
    123102                        }
  • /src/main/webapp/domainsrepo/7issues/7issues2.json

    r3 r1  
    99                                        "highValue": 9,
    1010                                        "highUtility": 0.11
     11
    1112                                }
    1213                        },
     
    1718                                        "highValue": 9,
    1819                                        "highUtility": 0.21
     20
    1921                                }
    2022                        },
     
    2527                                        "highValue": 9,
    2628                                        "highUtility": 0.13
     29
    2730                                }
    2831                        },
     
    3336                                        "highValue": 9,
    3437                                        "highUtility": 0.14
     38
    3539                                }
    3640                        },
     
    4145                                        "highValue": 9,
    4246                                        "highUtility": 0.15
     47
    4348                                }
    4449                        },
     
    4954                                        "highValue": 9,
    5055                                        "highUtility": 0.16
     56
    5157                                }
    5258                        },
     
    5763                                        "highValue": 9,
    5864                                        "highUtility": 0.17
     65
    5966                                }
    6067                        }
     
    7380                        "issuesValues": {
    7481                                "i1": {
    75                                         "range": [
    76                                                 0,
    77                                                 9,
    78                                                 1
    79                                         ]
     82                                        "range": ["0", "9", "1"]
    8083                                },
    8184                                "i2": {
    82                                         "range": [
    83                                                 0,
    84                                                 9,
    85                                                 1
    86                                         ]
     85                                        "range": ["0", "9", "1"]
    8786                                },
    8887                                "i3": {
    89                                         "range": [
    90                                                 0,
    91                                                 9,
    92                                                 1
    93                                         ]
     88                                        "range": ["0", "9", "1"]
    9489                                },
    9590                                "i4": {
    96                                         "range": [
    97                                                 0,
    98                                                 9,
    99                                                 1
    100                                         ]
     91                                        "range": ["0", "9", "1"]
    10192                                },
    10293                                "i5": {
    103                                         "range": [
    104                                                 0,
    105                                                 9,
    106                                                 1
    107                                         ]
     94                                        "range": ["0", "9", "1"]
    10895                                },
    10996                                "i6": {
    110                                         "range": [
    111                                                 0,
    112                                                 9,
    113                                                 1
    114                                         ]
     97                                        "range": ["0", "9", "1"]
    11598                                },
    11699                                "i7": {
    117                                         "range": [
    118                                                 0,
    119                                                 9,
    120                                                 1
    121                                         ]
     100                                        "range": ["0", "9", "1"]
    122101                                }
    123102                        }
  • /src/main/webapp/index.jsp

    r3 r1  
    1515                these may contain files with errors, and thus are not available for
    1616                use.
    17                 <p>
    18                         For creating a profile or adding it to the server please check the <a
    19                                 href="https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebProfilesServer">wiki</a>.
    20                
     17
     18                <h2>
     19                        Adding domains and profiles
     20                        </h1>
     21                        You can add and remove domains and profiles by dragging your .json
     22                        files into and out of the repo directory.
     23
     24                        <h2>
     25                                Access
     26                                </h1>
     27                                Your agent has JSON based access to the repo through websockets. Two
     28                                examples are provided, one based on javax.websocket and one on
     29                                neovisionaries websocket
     30
     31
     32                                <h3>Example with javax websocket</h3>
     33                                The example code is available
     34                                <a
     35                                        href="https://tracinsy.ewi.tudelft.nl/trac/Genius2ProfilesServer/browser/src/test/java/geniusweb/examples/DownloadProfileExample.java">here</a>
     36and also is part of the JavaClientTest junit test in this project (run with <code>mvn test</code>)
     37                                To compile that example you need the javax websocket
     38                                dependency in your pom:
     39                                <code>
     40                                        <pre>                                   
     41&lt;dependency>
     42        &lt;groupId>javax.websocket&lt;/groupId>
     43        &lt;artifactId>javax.websocket-api&lt;/artifactId>
     44        &lt;version>1.1&lt;/version>
     45&lt;/dependency>
     46
     47                               
     48                                </code>
     49                                </pre>
     50
     51
     52                                <h3>Example with neovisionaries websocket</h3>
     53                                The example code is available
     54                                <a
     55                                        href="https://tracinsy.ewi.tudelft.nl/trac/Genius2ProfilesServer/browser/src/test/java/geniusweb/examples/DownloadProfileExample.java">here</a>
     56and also is part of the JavaClientTest junit test in this project (run with <code>mvn test</code>)
     57                                To compile that example you need the neovisionaries websocket
     58                                dependency in your pom:
     59                                <code>
     60                                        <pre>                                   
     61&lt;dependency>
     62        &lt;groupId>com.neovisionaries&lt;/groupId>
     63        &lt;artifactId>nv-websocket-client&lt;/artifactId>
     64        &lt;version>2.6&lt;/version>
     65&lt;/dependency>
     66
     67                               
     68                                </code>
     69                                </pre>
    2170</body>
    2271</html>
  • /src/test/java/geniusweb/clienttest/JavaClientTest.java

    r3 r1  
    55
    66import java.io.IOException;
    7 import java.util.HashMap;
    87import java.util.LinkedList;
    98import java.util.List;
    10 import java.util.Map;
    119
    1210import org.junit.AfterClass;
     
    1513import org.python.util.PythonInterpreter;
    1614
    17 import com.fasterxml.jackson.core.type.TypeReference;
    18 import com.fasterxml.jackson.databind.ObjectMapper;
    1915import com.neovisionaries.ws.client.WebSocket;
    2016import com.neovisionaries.ws.client.WebSocketAdapter;
     
    6056        @Test
    6157        public void clientSmokeTest() throws IOException {
    62                 WebSocketFactory factory = new WebSocketFactory().setConnectionTimeout(5000);
    63                 WebSocket ws = factory.createSocket("ws://localhost:8080/profilesserver/websocket/liststream");
     58                WebSocketFactory factory = new WebSocketFactory()
     59                                .setConnectionTimeout(5000);
     60                WebSocket ws = factory.createSocket(
     61                                "ws://localhost:8080/profilesserver/websocket/liststream");
    6462        }
    6563
    6664        @Test
    67         public void testGetList() throws IOException, InterruptedException, WebSocketException {
     65        public void testGetList()
     66                        throws IOException, InterruptedException, WebSocketException {
    6867                final List<String> received = new LinkedList<>();
    6968                Thread.sleep(5000);
    70                 WebSocketFactory factory = new WebSocketFactory().setConnectionTimeout(20000);
    71                 WebSocket ws = factory.createSocket("ws://localhost:8080/profilesserver/websocket/liststream");
     69                WebSocketFactory factory = new WebSocketFactory()
     70                                .setConnectionTimeout(20000);
     71                WebSocket ws = factory.createSocket(
     72                                "ws://localhost:8080/profilesserver/websocket/liststream");
    7273
    7374                ws.addListener(new WebSocketAdapter() {
    7475                        @Override
    75                         public void onTextMessage(WebSocket websocket, String message) throws Exception {
     76                        public void onTextMessage(WebSocket websocket, String message)
     77                                        throws Exception {
    7678                                System.out.println("received message: " + message);
    7779                                received.add(message);
     
    8284
    8385                Thread.sleep(2000);
    84 
    85                 assertEquals(1, received.size()); // 1 answer received
    86 
    87                 ObjectMapper mapper = new ObjectMapper();
    88                 TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {
    89                 };
    90                 Map<String, Object> map = mapper.readValue(received.get(0), typeRef);
    91 
    92                 List<String> domains= new LinkedList<>();
    93                 for (String key: map.keySet()) {
    94                         domains.add(key.substring(key.indexOf("get")));
    95                         }
    96                 assertTrue(domains.contains("get/jobs"));
    97                 assertTrue(domains.contains("get/7issues"));
     86                assertEquals(1, received.size());
     87                assertTrue(received.get(0).matches(JSON));
     88                System.out.println(JSON);
    9889        }
    9990
    10091        @Test
    101         public void testExample() throws WebSocketException, InterruptedException, IOException {
     92        public void testExample()
     93                        throws WebSocketException, InterruptedException, IOException {
    10294                DownloadProfileExample test = new DownloadProfileExample();
    10395                test.run();
     
    10698
    10799        @Test
    108         public void testExample2() throws WebSocketException, InterruptedException, IOException {
     100        public void testExample2()
     101                        throws WebSocketException, InterruptedException, IOException {
    109102                DownloadProfileExample2 test = new DownloadProfileExample2();
    110103                assertEquals(JOBS1PROFILE, test.getReceived());
     
    119112
    120113                // Create factory and coerce Jython calculator object
    121                 JythonObjectFactory factory = new JythonObjectFactory(WebSocketAdapter.class, "PythonDownloadProfile",
     114                JythonObjectFactory factory = new JythonObjectFactory(
     115                                WebSocketAdapter.class, "PythonDownloadProfile",
    122116                                "PythonDownloadProfile");
    123117                factory.createObject();
  • /src/test/java/geniusweb/profilesserver/AutoUpdatingProfilesFactoryTest.java

    r3 r1  
    119119        @Test
    120120        public void getDomainsTest() {
    121                 assertTrue(factory.getDomains().size() > 2);
    122                 assertTrue(factory.getDomains().contains(JOBS));
    123                 assertTrue(factory.getDomains().contains(JOBS));
    124                 assertTrue(factory.getDomains().contains("7issues"));
     121                assertEquals(2, factory.getDomains().size());
     122                assertEquals(JOBS, factory.getDomains().get(0));
     123                assertEquals("7issues", factory.getDomains().get(1));
    125124
    126125        }
     
    145144                Thread.sleep(HIGHRATE);
    146145
    147                 assertEquals(4, changes.size());
     146                assertEquals(3, changes.size());
    148147                assertTrue(changes.get(0) instanceof ProfileChangeEvent);
    149148                assertTrue(changes.get(1) instanceof ProfileChangeEvent);
    150                 assertTrue(changes.get(2) instanceof ProfileChangeEvent);
    151                 assertTrue(changes.get(3) instanceof DomainChangeEvent);
     149                assertTrue(changes.get(2) instanceof DomainChangeEvent);
    152150                assertEquals(1, warnings.size()); // jobs domain file missing
    153151                assertNull(factory.getDomain(JOBS));
     
    163161                Thread.sleep(HIGHRATE);
    164162
    165                 assertEquals(4, changes.size());
     163                assertEquals(3, changes.size());
    166164                assertTrue(changes.get(0) instanceof ProfileChangeEvent);
    167165                assertTrue(changes.get(1) instanceof ProfileChangeEvent);
    168                 assertTrue(changes.get(2) instanceof ProfileChangeEvent);
    169                 assertTrue(changes.get(3) instanceof DomainChangeEvent);
     166                assertTrue(changes.get(2) instanceof DomainChangeEvent);
    170167                assertEquals(1, warnings.size()); // wrong domain file, wrong profile
    171168                assertNull(factory.getDomain(JOBS));
     
    234231                assertNull(factory.getProfile(JOB1));
    235232
    236                 assertEquals(4, changes.size());
     233                assertEquals(3, changes.size());
    237234                assertTrue(changes.get(0) instanceof ProfileChangeEvent);
    238235                assertTrue(changes.get(1) instanceof ProfileChangeEvent);
    239                 assertTrue(changes.get(2) instanceof ProfileChangeEvent);
    240                 assertTrue(changes.get(3) instanceof DomainChangeEvent);
     236                assertTrue(changes.get(2) instanceof DomainChangeEvent);
    241237                assertEquals(0, warnings.size());
    242238        }
Note: See TracChangeset for help on using the changeset viewer.