@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; data.set(windowsApi.getPasswordDataForInstance(instance.getId())); if (data.get() == null) return false; return !Strings.isNullOrEmpty(data.get().getPasswordData()); } };
public void testFilterBundleTasksWhenResponseIs404() { HttpResponse filterResponse = HttpResponse.builder().statusCode(404).build(); EC2Api apiWhenNotExist = requestsSendResponses(describeRegionsRequest, describeRegionsResponse, filter, filterResponse); assertEquals(apiWhenNotExist.getWindowsApi().get().describeBundleTasksInRegionWithFilter("us-east-1", ImmutableMultimap.<String, String>builder() .put("instance-id", "i-12345678") .build()), ImmutableSet.of()); }
public void testFilterBundleTasksWhenResponseIs2xx() { HttpResponse filterResponse = HttpResponse.builder().statusCode(200) .payload(payloadFromResourceWithContentType("/describe_bundle_tasks.xml", "text/xml")).build(); EC2Api apiWhenExist = requestsSendResponses(describeRegionsRequest, describeRegionsResponse, filter, filterResponse); BundleTask task = getOnlyElement(apiWhenExist.getWindowsApi().get().describeBundleTasksInRegionWithFilter("us-east-1", ImmutableMultimap.<String, String>builder() .put("instance-id", "i-12345678") .build())); assertEquals(task.getBundleId(), "bun-c1a540a8"); }
@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; data.set(windowsApi.getPasswordDataForInstance(instance.getId())); if (data.get() == null) return false; return !Strings.isNullOrEmpty(data.get().getPasswordData()); } };
@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; data.set(windowsApi.getPasswordDataForInstance(instance.getId())); if (data.get() == null) return false; return !Strings.isNullOrEmpty(data.get().getPasswordData()); } };
@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; data.set(windowsApi.getPasswordDataForInstance(instance.getId())); if (data.get() == null) return false; return !Strings.isNullOrEmpty(data.get().getPasswordData()); } };
@Override public boolean apply(@Nullable String s) { if (Strings.isNullOrEmpty(s)) return false; data.set(windowsApi.getPasswordDataForInstance(instance.getId())); if (data.get() == null) return false; return !Strings.isNullOrEmpty(data.get().getPasswordData()); } };
public void testGetPasswordDataWhenResponseIs404() throws Exception { HttpResponse getResponse = HttpResponse.builder().statusCode(404).build(); EC2Api apiWhenDontExist = requestSendsResponse(get, getResponse); assertNull(apiWhenDontExist.getWindowsApi().get().getPasswordDataForInstance("i-2574e22a")); } }
public void testGetPasswordDataWhenResponseIs404() throws Exception { HttpResponse getResponse = HttpResponse.builder().statusCode(404).build(); EC2Api apiWhenDontExist = requestSendsResponse(get, getResponse); assertNull(apiWhenDontExist.getWindowsApi().get().getPasswordDataForInstance("i-2574e22a")); }
public void testGetPasswordDataWhenResponseIs2xx() throws Exception { HttpResponse getResponse = HttpResponse.builder().statusCode(200) .payload(payloadFromResourceWithContentType("/get_passworddata.xml", "text/xml")).build(); EC2Api apiWhenExist = requestSendsResponse(get, getResponse); assertEquals(apiWhenExist.getWindowsApi().get().getPasswordDataForInstance("i-2574e22a").toString(), new GetPasswordDataResponseTest().expected().toString()); }
public void testGetPasswordDataWhenResponseIs2xx() throws Exception { HttpResponse getResponse = HttpResponse.builder().statusCode(200) .payload(payloadFromResourceWithContentType("/get_passworddata.xml", "text/xml")).build(); EC2Api apiWhenExist = requestSendsResponse(get, getResponse); assertEquals(apiWhenExist.getWindowsApi().get().getPasswordDataForInstance("i-2574e22a").toString(), new GetPasswordDataResponseTest().expected().toString()); }