public void testGetTaskVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException { Invokable<?, ?> method = method(TaskApi.class, "getTask", RESTLink.class); GeneratedHttpRequest request = processor.apply( Invocation.create( method, ImmutableList.<Object>of( new RESTLink( "task", "http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/" + "tasks/169f1877-5f17-4f62-9563-974001295c54")))); assertRequestLineEquals( request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1" + "/tasks/169f1877-5f17-4f62-9563-974001295c54 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + TaskDto.BASE_MEDIA_TYPE + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, NullOn303.class); checkFilters(request); }
@Override public HttpRequest signRemoveBlob(String container, String name) { checkNotNull(container, "container"); checkNotNull(name, "name"); return cleanRequest( processor.apply( Invocation.create(deleteMethod, ImmutableList.<Object>of(getPath(container, name))))); }
@Override public HttpRequest signPutBlob(String container, Blob blob) { checkNotNull(container, "container"); checkNotNull(blob, "blob"); return cleanRequest( processor.apply( Invocation.create( createMethod, ImmutableList.<Object>of(container, blobToObject.apply(blob))))); }
GeneratedHttpRequest requestForEndpointAndArgs(String endpoint, List<Object> args) { try { Invocation invocation = Invocation.create(method(String.class, "toString"), args); return GeneratedHttpRequest.builder() .method("POST") .endpoint(URI.create(endpoint)) .invocation(invocation) .build(); } catch (SecurityException e) { throw Throwables.propagate(e); } }
@Override public HttpRequest signGetBlob( String container, String name, org.jclouds.blobstore.options.GetOptions options) { checkNotNull(container, "container"); checkNotNull(name, "name"); return cleanRequest( processor.apply( Invocation.create( getMethod, ImmutableList.of( getPath(container, name), blob2ObjectGetOptions.apply(checkNotNull(options, "options")))))); }
public void testListTasksVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { Invokable<?, ?> method = method(TaskApi.class, "listTasks", SingleResourceTransportDto.class); GeneratedHttpRequest request = processor.apply( Invocation.create( method, ImmutableList.<Object>of(CloudResources.virtualMachinePut()))); assertRequestLineEquals( request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/tasks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + TasksDto.BASE_MEDIA_TYPE + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, null); checkFilters(request); }
InvocationSuccess getFloatingIPExtension(List<Object> args) throws SecurityException, NoSuchMethodException { return InvocationSuccess.create( Invocation.create(method(NovaApi.class, "getFloatingIPExtensionApi", String.class), args), "foo"); }