@Override @SelectJson("server") @Consumes(MediaType.APPLICATION_JSON) public ServerCreated expected() { return ServerCreated .builder() .id("71752") .name("test-e92") .adminPass("ZWuHcmTMQ7eXoHeM") .links( Link.create(Relation.SELF, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752")), Link.create(Relation.BOOKMARK, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752"))).build(); }
@Override @SelectJson("server") @Consumes(MediaType.APPLICATION_JSON) public ServerCreated expected() { return ServerCreated .builder() .id("71752") .name("test-e92") .adminPass("ZWuHcmTMQ7eXoHeM") .links( Link.create(Relation.SELF, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/37936628937291/servers/71752")), Link.create(Relation.BOOKMARK, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752"))).build(); }
@SelectJson("server") @Consumes(MediaType.APPLICATION_JSON) public ServerCreated expectedWithDiskConfig(String diskConfig) { return ServerCreated .builder() .id("71752") .name("test-e92") .adminPass("ZWuHcmTMQ7eXoHeM") .diskConfig(diskConfig) .links( Link.create(Relation.SELF, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/37936628937291/servers/71752")), Link.create(Relation.BOOKMARK, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752"))).build(); }
@Override @SelectJson("servers") @Consumes(MediaType.APPLICATION_JSON) public Set<Resource> expected() { return ImmutableSet .of(Resource .builder() .id("52415800-8b69-11e0-9b19-734f6af67565") .name("sample-server") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f6af67565")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f6af67565"))) .build(), Resource .builder() .id("52415800-8b69-11e0-9b19-734f1f1350e5") .name("sample-server2") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f1f1350e5")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f1f1350e5"))) .build()); }
@Override @SelectJson("flavors") @Consumes(MediaType.APPLICATION_JSON) public Set<Resource> expected() { return ImmutableSet .of(Resource .builder() .id("52415800-8b69-11e0-9b19-734f1195ff37") .name("256 MB Server") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37"))) .build(), Resource .builder() .id("52415800-8b69-11e0-9b19-734f216543fd") .name("512 MB Server") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd"))) .build()); }
@Override @SelectJson("images") @Consumes(MediaType.APPLICATION_JSON) public Set<Resource> expected() { return ImmutableSet .of(Resource .builder() .id("52415800-8b69-11e0-9b19-734f6f006e54") .name("CentOS 5.2") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f6f006e54")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f6f006e54"))) .build(), Resource .builder() .id("52415800-8b69-11e0-9b19-734f5736d2a2") .name("My Server Backup") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2"))) .build()); }
@Override @SelectJson("flavor") @Consumes(MediaType.APPLICATION_JSON) public Flavor expected() { return Flavor .builder() .id("52415800-8b69-11e0-9b19-734f1195ff37") .name("256 MB Server") .links( ImmutableSet.of( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v2/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37")))) .ram(256).disk(10).vcpus(1).build(); }
@Override @SelectJson("flavors") @Consumes(MediaType.APPLICATION_JSON) public Set<Resource> expected() { return ImmutableSet .of(Resource .builder() .id("52415800-8b69-11e0-9b19-734f1195ff37") .name("256 MB Server") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v2/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37"))) .build(), Resource .builder() .id("52415800-8b69-11e0-9b19-734f216543fd") .name("512 MB Server") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v2/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f216543fd"))) .build()); }
@Override @SelectJson("images") @Consumes(MediaType.APPLICATION_JSON) public Set<Resource> expected() { return ImmutableSet .of(Resource .builder() .id("52415800-8b69-11e0-9b19-734f6f006e54") .name("CentOS 5.2") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v2/1234/images/52415800-8b69-11e0-9b19-734f6f006e54")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f6f006e54"))) .build(), Resource .builder() .id("52415800-8b69-11e0-9b19-734f5736d2a2") .name("My Server Backup") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v2/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2"))) .build()); }
@Override @SelectJson("flavor") @Consumes(MediaType.APPLICATION_JSON) public Flavor expected() { return Flavor .builder() .id("52415800-8b69-11e0-9b19-734f1195ff37") .name("256 MB Server") .links( ImmutableSet.of( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v1.1/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/flavors/52415800-8b69-11e0-9b19-734f1195ff37")))) .ram(256).disk(10).vcpus(1).build(); }
@Override @SelectJson("servers") @Consumes(MediaType.APPLICATION_JSON) public Set<Resource> expected() { return ImmutableSet .of(Resource .builder() .id("52415800-8b69-11e0-9b19-734f6af67565") .name("sample-server") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v2/1234/servers/52415800-8b69-11e0-9b19-734f6af67565")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f6af67565"))) .build(), Resource .builder() .id("52415800-8b69-11e0-9b19-734f1f1350e5") .name("sample-server2") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v2/1234/servers/52415800-8b69-11e0-9b19-734f1f1350e5")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f1f1350e5"))) .build()); }
@Override @SelectJson("extension") @Consumes(MediaType.APPLICATION_JSON) public Extension expected() { return Extension .builder() .alias("RS-PIE") .name("Public Image Extension") .namespace(URI.create("http://docs.rackspacecloud.com/servers/api/ext/pie/v1.0")) .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-01-22T13:25:27-06:00")) .description("Adds the capability to share an image with other users.") .links( ImmutableSet.of( Link.create(Relation.DESCRIBEDBY, "application/pdf", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie-20111111.pdf")), Link.create(Relation.DESCRIBEDBY, "application/vnd.sun.wadl+xml", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie.wadl")))).build(); }
@Override @SelectJson("extension") @Consumes(MediaType.APPLICATION_JSON) public Extension expected() { return Extension .builder() .alias("RS-PIE") .name("Public Image Extension") .namespace(URI.create("http://docs.rackspacecloud.com/servers/api/ext/pie/v1.0")) .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-01-22T13:25:27-06:00")) .description("Adds the capability to share an image with other users.") .links( ImmutableSet.of( Link.create(Relation.DESCRIBEDBY, "application/pdf", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie-20111111.pdf")), Link.create(Relation.DESCRIBEDBY, "application/vnd.sun.wadl+xml", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie.wadl")))).build(); }
.links( ImmutableSet.of( Link.create(Relation.DESCRIBEDBY, "application/pdf", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie-20111111.pdf")), Link.create(Relation.DESCRIBEDBY, "application/vnd.sun.wadl+xml", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie.wadl")))).build(), Extension .description("Allows mounting cloud block storage volumes.") .links( ImmutableSet.of(Link.create(Relation.DESCRIBEDBY, "application/pdf", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-cbs-20111201.pdf")), Link.create(Relation.DESCRIBEDBY, "application/vnd.sun.wadl+xml", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-cbs.wadl")))) .build());
.links( ImmutableSet.of( Link.create(Relation.DESCRIBEDBY, "application/pdf", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie-20111111.pdf")), Link.create(Relation.DESCRIBEDBY, "application/vnd.sun.wadl+xml", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-pie.wadl")))).build(), Extension .description("Allows mounting cloud block storage volumes.") .links( ImmutableSet.of(Link.create(Relation.DESCRIBEDBY, "application/pdf", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-cbs-20111201.pdf")), Link.create(Relation.DESCRIBEDBY, "application/vnd.sun.wadl+xml", URI.create("http://docs.rackspacecloud.com/servers/api/ext/cs-cbs.wadl")))) .build());
.name("null") .links( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v1.1/1234/servers/52415800-8b69-11e0-9b19-734f335aa7b3")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/servers/52415800-8b69-11e0-9b19-734f335aa7b3"))) .links( ImmutableSet.of( Link.create( Relation.SELF, URI.create("http://servers.api.openstack.org/v1.1/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2")), Link.create( Relation.BOOKMARK, URI.create("http://servers.api.openstack.org/1234/images/52415800-8b69-11e0-9b19-734f5736d2a2"))))
/** * Creates a dummy Flavor when you need a Flavor with just the flavorId. * * 1. name = small * 2. ram = 512 * 3. links = self, bookmark */ public static Flavor forId(int flavorId) { return Flavor.builder() .id(flavorId) .name("small") .ram(512) .links( ImmutableList.of( Link.create(Relation.SELF, Uris.uriBuilder("http://test1").build() ), Link.create(Relation.BOOKMARK, Uris.uriBuilder("http://test2").build() ) ) ).build(); } }
/** * Creates a dummy Instance when you need an Instance with just the instanceId. */ public static Instance forId(String instanceId) { return Instance.builder() .id(instanceId) .name("json") .status(Instance.Status.ACTIVE) .size(2) .flavor( FlavorTest.forId(1) ) .links( ImmutableList.of( Link.create(Relation.SELF, Uris.uriBuilder("http://test1").build() ), Link.create(Relation.BOOKMARK, Uris.uriBuilder("http://test2").build() ) ) ).build(); } }
.id("1241") .links( Link.create( Link.Relation.BOOKMARK, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/images/1241"))) .id("100") .links( Link.create( Link.Relation.BOOKMARK, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/flavors/100"))) .build()) .links( Link.create(Link.Relation.SELF, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/servers/71752")), Link.create(Link.Relation.BOOKMARK, URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/37936628937291/servers/71752"))).build();
.id("14") .links( Link.create( Relation.BOOKMARK, URI.create("https://nova-api.openstack.org:9774/37/images/14"))) .id("1") .links( Link.create( Relation.BOOKMARK, URI.create("https://nova-api.openstack.org:9774/37/flavors/1"))) .build()) .links( Link.create( Relation.SELF, URI.create("https://nova-api.openstack.org:9774/v1.1/37/servers/1459")), Link.create( Relation.BOOKMARK, URI.create("https://nova-api.openstack.org:9774/37/servers/1459")))