Example #1
0
  @Before
  public void setUp() throws URISyntaxException {
    KuzzleOptions opts = new KuzzleOptions();
    opts.setConnect(Mode.MANUAL);
    KuzzleExtend extended = new KuzzleExtend("localhost", opts, null);
    extended.setSocket(mock(Socket.class));
    extended.setState(KuzzleStates.CONNECTED);
    kuzzle = spy(extended);
    when(kuzzle.getHeaders()).thenReturn(new JSONObject());

    collection = new KuzzleDataCollection(kuzzle, "test", "index");
    listener = mock(KuzzleResponseListener.class);
  }
Example #2
0
  @Before
  public void setUp() throws URISyntaxException {
    KuzzleOptions options = new KuzzleOptions();
    options.setConnect(Mode.MANUAL);
    options.setDefaultIndex("testIndex");

    s = mock(Socket.class);
    kuzzle = new KuzzleExtend("localhost", options, null);
    kuzzle.setSocket(s);

    listener =
        new KuzzleResponseListener<Object>() {
          @Override
          public void onSuccess(Object object) {}

          @Override
          public void onError(JSONObject error) {}
        };
  }
Example #3
0
 @Test(expected = IllegalArgumentException.class)
 public void testIllegalIndex() {
   kuzzle.setSuperDefaultIndex(null);
   kuzzle.dataCollectionFactory("collection", null);
 }
Example #4
0
 @Test
 public void testDataCollectionFactory() {
   assertEquals(kuzzle.dataCollectionFactory("test").getCollection(), "test");
   assertEquals(kuzzle.dataCollectionFactory("test2").getCollection(), "test2");
 }