@Override @SelectJson("extensions") @Consumes(MediaType.APPLICATION_JSON) public Set<Extension> expected() { return ImmutableSet.of( Extension.builder() .alias("RAX-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(), Extension.builder() .alias("RAX-CBS") .name("Cloud Block Storage") .namespace(URI.create("http://docs.rackspacecloud.com/servers/api/ext/cbs/v1.0")) .updated( new SimpleDateFormatDateService() .iso8601SecondsDateParse("2011-01-12T11:22:33-06:00")) .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()); }
public Builder fromLink(Link in) { return this.relation(in.getRelation()).type(in.getType().orNull()).href(in.getHref()); }
/* * The instance needs to be comparable for this test to work * */ @Override @Consumes(MediaType.APPLICATION_JSON) @SelectJson("instances") public Set<Instance> expected() { return ImmutableSet.of( Instance.builder() .id("098653ba-218b-47ce-936a-e0b749101f81") .name("xml_rack_instance") .size(2) .flavor( Flavor.builder() .id(1) .links( ImmutableList.of( Link.create( Relation.SELF, Uris.uriBuilder( "https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/1") .build()), Link.create( Relation.BOOKMARK, Uris.uriBuilder( "https://ord.databases.api.rackspacecloud.com/flavors/1") .build()))) .build()) .status(Instance.Status.ACTIVE) .links( ImmutableList.of( Link.create( Relation.SELF, Uris.uriBuilder( "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/098653ba-218b-47ce-936a-e0b749101f81") .build()), Link.create( Relation.BOOKMARK, Uris.uriBuilder( "https://ord.databases.api.rackspacecloud.com/instances/098653ba-218b-47ce-936a-e0b749101f81") .build()))) .build(), Instance.builder() .id("44b277eb-39be-4921-be31-3d61b43651d7") .name("json_rack_instance") .size(2) .flavor( Flavor.builder() .id(1) .links( ImmutableList.of( Link.create( Relation.SELF, Uris.uriBuilder( "https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/1") .build()), Link.create( Relation.BOOKMARK, Uris.uriBuilder( "https://ord.databases.api.rackspacecloud.com/flavors/1") .build()))) .build()) .status(Instance.Status.ACTIVE) .links( ImmutableList.of( Link.create( Relation.SELF, Uris.uriBuilder( "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/44b277eb-39be-4921-be31-3d61b43651d7") .build()), Link.create( Relation.BOOKMARK, Uris.uriBuilder( "https://ord.databases.api.rackspacecloud.com/instances/44b277eb-39be-4921-be31-3d61b43651d7") .build()))) .build()); }