Package io.fabric8.etcd.api

Examples of io.fabric8.etcd.api.Response


                .setBody(Resources.toString(getClass()
                                .getClassLoader()
                                .getResource("delete-response-1.json"),
                        Charsets.UTF_8)));

        Response response = client.delete().prevValue("Hello etcd").forKey("message");
        assertNotNull(response);
        assertEquals("delete", response.getAction());
        assertNotNull(response.getNode());
        assertNull(response.getNode().getValue());
        assertNotNull(response.getPrevNode());
        assertEquals("Hello etcd", response.getPrevNode().getValue());

        RecordedRequest request = server.takeRequest();
        assertEquals("DELETE",request.getMethod());
        assertTrue(request.getPath().startsWith(Keys.makeKey("message")));
        assertTrue(request.getPath().contains("prevValue=Hello+etcd"));
View Full Code Here


        }
    }

    @Test
    public void testSetGetAndDelete() {
        Response response = client.setData().value("smoke").forKey("key");
        assertNotNull(response);
        assertEquals("smoke", response.getNode().getValue());

        response = client.getData().forKey("key");
        assertValue("smoke", response);

        response = client.delete().forKey("key");
View Full Code Here

        assertPrevValue("smoke", response);
    }

    @Test(expected = TimeoutException.class)
    public void testSetWatchWithTimeout() throws ExecutionException, InterruptedException, TimeoutException {
        Response response = client.setData().value("smoke").forKey("key");
        assertNotNull(response);
        assertEquals("smoke", response.getNode().getValue());

        response = client.getData().forKey("key");
        assertValue("smoke", response);

        Future<Response> responseFuture = client.getData().watch().forKey("key");
View Full Code Here

        responseFuture.get(3, TimeUnit.SECONDS);
    }

    @Test
    public void testSetWatchAndDelete() throws ExecutionException, InterruptedException {
        Response response = client.setData().value("smoke").forKey("key");
        assertNotNull(response);
        assertEquals("smoke", response.getNode().getValue());

        response = client.getData().forKey("key");
        assertValue("smoke", response);

        Future<Response> responseFuture = client.getData().watch().forKey("key");
View Full Code Here

        assertPrevValue("smoke updated", response);
    }

    @Test
    public void testCreateDirAndChildren() throws URISyntaxException {
        Response response = client.setData().dir().forKey("key");
        assertNotNull(response);

        response = client.setData().value("value1").forKey("key/child1");
        assertNotNull(response);
        assertEquals("value1", response.getNode().getValue());
        response = client.setData().value("value2").forKey("key/clild2");
        assertNotNull(response);
        assertEquals("value2", response.getNode().getValue());

        response = client.getData().recursive().forKey("key/");
        assertNotNull(response);
        assertNotNull(response.getNode().getNodes());
    }
View Full Code Here

        assertNotNull(response.getNode().getNodes());
    }

    @Test
    public void testSetGetAndDeleteWithPrevValues() throws URISyntaxException {
        Response response = client.setData().value("smoke").forKey("key");
        assertNotNull(response);
        assertEquals("smoke", response.getNode().getValue());

        response = client.getData().forKey("key");
        assertValue("smoke", response);

        //Set with prev value
View Full Code Here

    public abstract ResponseReader getResponseReader();

    @Test
    public void testReadSetResponse() throws Exception {
        Response response = getResponseReader().read(getClass().getClassLoader().getResourceAsStream("set-response-1.json"));
        assertNotNull(response);
        assertEquals("set", response.getAction());
        assertNotNull(response.getNode());
        assertEquals("/message", response.getNode().getKey());
        assertEquals("Hello world", response.getNode().getValue());
    }
View Full Code Here

        assertEquals("Hello world", response.getNode().getValue());
    }

    @Test
    public void testReadSetUpdateResponse() throws Exception {
        Response response = getResponseReader().read(getClass().getClassLoader().getResourceAsStream("compare-and-swap-response-2.json"));
        assertNotNull(response);
        assertEquals("compareAndSwap", response.getAction());
        assertNotNull(response.getNode());
        assertEquals("/message", response.getNode().getKey());
        assertEquals("Hello etcd", response.getNode().getValue());
        assertNotNull(response.getPrevNode());
        assertEquals("/message", response.getPrevNode().getKey());
        assertEquals("Hello world", response.getPrevNode().getValue());
    }
View Full Code Here

   * @see
   * org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
   */
  @Override
  public Image getImage(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return getLevelImage(le);
    }
    return super.getImage(element);
  }
View Full Code Here

   * @see
   * org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
   */
  @Override
  public String getText(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return le.getLevel();
    }
    return super.getText(element);
  }
View Full Code Here

TOP

Related Classes of io.fabric8.etcd.api.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.