本文整理汇总了Java中com.vmware.xenon.common.UriUtils.buildFactoryUri方法的典型用法代码示例。如果您正苦于以下问题:Java UriUtils.buildFactoryUri方法的具体用法?Java UriUtils.buildFactoryUri怎么用?Java UriUtils.buildFactoryUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vmware.xenon.common.UriUtils
的用法示例。
在下文中一共展示了UriUtils.buildFactoryUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postCredentials
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static void postCredentials(VerificationHost host, Operation response, String privateKey, String privateKeyId) throws Throwable {
AuthCredentialsServiceState creds = new AuthCredentialsServiceState();
creds.privateKey = privateKey;
creds.privateKeyId = privateKeyId;
URI authFactory = UriUtils.buildFactoryUri(host, AuthCredentialsService.class);
host.testStart(1);
Operation startPost = Operation.createPost(authFactory)
.setBody(creds)
.setCompletion((o, e) -> {
if (e != null) {
host.failIteration(e);
return;
}
response.setBody(o.getBody(AuthCredentialsServiceState.class));
host.completeIteration();
});
host.send(startPost);
host.testWait();
}
示例2: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
IPAddressState ipAddressState = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
ipAddressState.tenantLinks = new ArrayList<>();
ipAddressState.tenantLinks.add(UriUtils.buildUriPath(
tenantUri.getPath(), "tenantA"));
IPAddressState startState = postServiceSynchronously(
IPAddressService.FACTORY_LINK,
ipAddressState, IPAddressState.class);
String kind = Utils.buildKind(IPAddressState.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
ipAddressState.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例3: startServicesSynchronously
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
private void startServicesSynchronously(ServiceHost serviceHost, Service... services) throws Throwable {
List<Operation> posts = new ArrayList<>();
for (Service s : services) {
URI u = null;
if (ReflectionUtils.hasField(s.getClass(), UriUtils.FIELD_NAME_SELF_LINK)) {
u = UriUtils.buildUri(serviceHost, s.getClass());
} else if (s instanceof FactoryService) {
u = UriUtils.buildFactoryUri(serviceHost,
((FactoryService) s).createServiceInstance().getClass());
} else {
throw new IllegalStateException("field SELF_LINK or FACTORY_LINK is required");
}
Operation startPost = Operation.createPost(u);
posts.add(startPost);
}
startServicesSynchronously(serviceHost, posts, Arrays.asList(services));
}
示例4: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
LoadBalancerState LoadBalancerState = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
LoadBalancerState.tenantLinks = new ArrayList<>();
LoadBalancerState.tenantLinks.add(UriUtils.buildUriPath(
tenantUri.getPath(), "tenantA"));
LoadBalancerState startState = postServiceSynchronously(
LoadBalancerService.FACTORY_LINK,
LoadBalancerState, LoadBalancerState.class);
String kind = Utils.buildKind(LoadBalancerState.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
LoadBalancerState.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例5: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
EndpointService.EndpointState endpointState = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
endpointState.tenantLinks = new ArrayList<>();
endpointState.tenantLinks.add(UriUtils.buildUriPath(
tenantUri.getPath(), "tenantA"));
EndpointService.EndpointState startState = postServiceSynchronously(
EndpointService.FACTORY_LINK,
endpointState, EndpointService.EndpointState.class);
String kind = Utils.buildKind(EndpointService.EndpointState.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
endpointState.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例6: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
SecurityGroupService.SecurityGroupState securityGroupState = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
securityGroupState.tenantLinks = new ArrayList<>();
securityGroupState.tenantLinks.add(UriUtils.buildUriPath(
tenantUri.getPath(), "tenantA"));
SecurityGroupService.SecurityGroupState startState = postServiceSynchronously(
SecurityGroupService.FACTORY_LINK,
securityGroupState, SecurityGroupService.SecurityGroupState.class);
String kind = Utils.buildKind(SecurityGroupService.SecurityGroupState.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
securityGroupState.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例7: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
ResourcePoolService.ResourcePoolState rp = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
rp.tenantLinks = new ArrayList<>();
rp.tenantLinks.add(UriUtils.buildUriPath(tenantUri.getPath(),
"tenantA"));
ResourcePoolService.ResourcePoolState startState = postServiceSynchronously(
ResourcePoolService.FACTORY_LINK, rp,
ResourcePoolService.ResourcePoolState.class);
String kind = Utils
.buildKind(ResourcePoolService.ResourcePoolState.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
rp.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例8: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
ComputeDescriptionService.ComputeDescription disk = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
disk.tenantLinks = new ArrayList<>();
disk.tenantLinks.add(UriUtils.buildUriPath(tenantUri.getPath(),
"tenantA"));
ComputeDescriptionService.ComputeDescription startState = postServiceSynchronously(
ComputeDescriptionService.FACTORY_LINK, disk,
ComputeDescriptionService.ComputeDescription.class);
String kind = Utils
.buildKind(ComputeDescriptionService.ComputeDescription.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
disk.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例9: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
SnapshotService.SnapshotState st = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
st.tenantLinks = new ArrayList<>();
st.tenantLinks.add(UriUtils.buildUriPath(tenantUri.getPath(),
"tenantA"));
SnapshotService.SnapshotState startState = postServiceSynchronously(
SnapshotService.FACTORY_LINK,
st, SnapshotService.SnapshotState.class);
String kind = Utils.buildKind(SnapshotService.SnapshotState.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
st.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例10: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
NetworkService.NetworkState networkState = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
networkState.tenantLinks = new ArrayList<>();
networkState.tenantLinks.add(UriUtils.buildUriPath(
tenantUri.getPath(), "tenantA"));
NetworkService.NetworkState startState = postServiceSynchronously(
NetworkService.FACTORY_LINK,
networkState, NetworkService.NetworkState.class);
String kind = Utils.buildKind(NetworkService.NetworkState.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
networkState.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例11: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
StorageDescription storageState = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
storageState.tenantLinks = new ArrayList<>();
storageState.tenantLinks.add(UriUtils.buildUriPath(
tenantUri.getPath(), "tenantA"));
StorageDescription startState = postServiceSynchronously(
StorageDescriptionService.FACTORY_LINK,
storageState, StorageDescription.class);
String kind = Utils.buildKind(StorageDescription.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
storageState.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例12: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
DiskState disk = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
disk.tenantLinks = new ArrayList<>();
disk.tenantLinks.add(UriUtils.buildUriPath(tenantUri.getPath(),
"tenantA"));
DiskState startState = postServiceSynchronously(
DiskService.FACTORY_LINK, disk,
DiskState.class);
String kind = Utils.buildKind(DiskState.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
disk.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例13: testTenantLinksQuery
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
@Test
public void testTenantLinksQuery() throws Throwable {
NetworkInterfaceState nic = buildValidStartState();
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
nic.tenantLinks = new ArrayList<>();
nic.tenantLinks.add(UriUtils.buildUriPath(tenantUri.getPath(),
"tenantA"));
NetworkInterfaceState startState = postServiceSynchronously(
NetworkInterfaceService.FACTORY_LINK, nic,
NetworkInterfaceState.class);
String kind = Utils
.buildKind(NetworkInterfaceState.class);
String propertyName = QueryTask.QuerySpecification
.buildCollectionItemName(ResourceState.FIELD_NAME_TENANT_LINKS);
QueryTask q = createDirectQueryTask(kind, propertyName,
nic.tenantLinks.get(0));
q = querySynchronously(q);
assertNotNull(q.results.documentLinks);
assertThat(q.results.documentCount, is(1L));
assertThat(q.results.documentLinks.get(0),
is(startState.documentSelfLink));
}
示例14: registerEndpoint
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
protected EndpointState registerEndpoint(String endpointType) throws Throwable {
EndpointService.EndpointState endpointState = createEndpointState(endpointType);
URI tenantUri = UriUtils.buildFactoryUri(this.host, TenantService.class);
endpointState.tenantLinks = new ArrayList<>();
endpointState.tenantLinks.add(UriUtils.buildUriPath(
tenantUri.getPath(), "tenantA"));
return postServiceSynchronously(
EndpointService.FACTORY_LINK,
endpointState, EndpointService.EndpointState.class);
}
示例15: buildNetworkState
import com.vmware.xenon.common.UriUtils; //导入方法依赖的package包/类
public static NetworkState buildNetworkState(VerificationHost host) {
URI tenantFactoryURI = UriUtils.buildFactoryUri(host, TenantService.class);
NetworkState network = new NetworkState();
network.regionId = regionId;
network.id = UUID.randomUUID().toString();
network.subnetCIDR = "10.1.0.0/16";
network.tenantLinks = new ArrayList<>();
network.tenantLinks.add(UriUtils.buildUriPath(tenantFactoryURI.getPath(), "tenantA"));
return network;
}