@Test public void create() throws EtcdException { server.expect(MockRestRequestMatchers.requestTo("http: .andExpect(MockRestRequestMatchers.method(HttpMethod.POST)) .andExpect(MockRestRequestMatchers.content().contentType(MediaType.APPLICATION_FORM_URLENCODED)) .andExpect(MockRestRequestMatchers.content().string("value=Hello+world")) .andRespond(MockRestResponseCreators.withSuccess(new ClassPathResource("EtcdClientTest_delete.json"), MediaType.APPLICATION_JSON)); EtcdResponse response = client.create("sample", "Hello world"); Assert.assertNotNull("response", response); server.verify(); }
public EtcdResponse create(final String key, final String value) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1); payload.set("value", value); return execute(builder, HttpMethod.POST, payload, EtcdResponse.class); }
EtcdClient implements InitializingBean, DisposableBean { public EtcdResponse create(final String key, final String value) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1); payload.set("value", value); return execute(builder, HttpMethod.POST, payload, EtcdResponse.class); } }
EtcdClient implements InitializingBean, DisposableBean { public EtcdResponse create(final String key, final String value) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1); payload.set("value", value); return execute(builder, HttpMethod.POST, payload, EtcdResponse.class); } EtcdClient();  EtcdClient(String location);  EtcdClient(String[] locations); }
EtcdClient implements InitializingBean, DisposableBean { public EtcdResponse create(final String key, final String value) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1); payload.set("value", value); return execute(builder, HttpMethod.POST, payload, EtcdResponse.class); } EtcdClient();  EtcdClient(String location);  EtcdClient(String[] locations); boolean isLocationUpdaterEnabled(); void setLocationUpdaterEnabled(boolean value); void setLocations(String[] value); String[] getLocations(); EtcdResponse get(String key); EtcdResponse get(String key, boolean recursive); EtcdResponse put(final String key, final String value); EtcdResponse put(String key, String value, int ttl); EtcdResponse delete(final String key); EtcdResponse create(final String key, final String value); EtcdResponse compareAndSwap(final String key, final String value, boolean prevExist); EtcdResponse compareAndSwap(final String key, final String value, int ttl, boolean prevExist); EtcdResponse compareAndSwap(String key, String value, int prevIndex); EtcdResponse compareAndSwap(String key, String value, int ttl, int prevIndex); EtcdResponse compareAndSwap(String key, String value, String prevValue); EtcdResponse compareAndSwap(String key, String value, int ttl, String prevValue); EtcdResponse compareAndDelete(final String key, int prevIndex); EtcdResponse compareAndDelete(final String key, String prevValue); EtcdResponse putDir(final String key); EtcdResponse putDir(String key, int ttl); EtcdResponse deleteDir(String key); EtcdResponse deleteDir(String key, boolean recursive); EtcdMemberResponse listMembers(); @Override void afterPropertiesSet(); @Override void destroy(); }
EtcdClient implements InitializingBean, DisposableBean { public EtcdResponse create(final String key, final String value) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1); payload.set("value", value); return execute(builder, HttpMethod.POST, payload, EtcdResponse.class); } EtcdClient();  EtcdClient(String location);  EtcdClient(String[] locations); boolean isLocationUpdaterEnabled(); void setLocationUpdaterEnabled(boolean value); void setLocations(String[] value); String[] getLocations(); EtcdResponse get(String key); EtcdResponse get(String key, boolean recursive); EtcdResponse put(final String key, final String value); EtcdResponse put(String key, String value, int ttl); EtcdResponse delete(final String key); EtcdResponse create(final String key, final String value); EtcdResponse compareAndSwap(final String key, final String value, boolean prevExist); EtcdResponse compareAndSwap(final String key, final String value, int ttl, boolean prevExist); EtcdResponse compareAndSwap(String key, String value, int prevIndex); EtcdResponse compareAndSwap(String key, String value, int ttl, int prevIndex); EtcdResponse compareAndSwap(String key, String value, String prevValue); EtcdResponse compareAndSwap(String key, String value, int ttl, String prevValue); EtcdResponse compareAndDelete(final String key, int prevIndex); EtcdResponse compareAndDelete(final String key, String prevValue); EtcdResponse putDir(final String key); EtcdResponse putDir(String key, int ttl); EtcdResponse deleteDir(String key); EtcdResponse deleteDir(String key, boolean recursive); EtcdMemberResponse listMembers(); @Override void afterPropertiesSet(); @Override void destroy();  }