use of com.vmware.photon.controller.model.util.StartServicesHelper.ServiceMetadata in project photon-model by vmware.
the class AdapterServiceMetadataBuilder method build.
/**
* Builds the Adapter Service Metadata
*/
public ServiceMetadata build() {
ServiceMetadata adapter;
if (this.isFactory) {
if (this.factoryCreator != null) {
adapter = ServiceMetadata.factoryService(this.adapterClass, this.factoryCreator);
} else {
adapter = ServiceMetadata.factoryService(this.adapterClass);
}
} else {
if (this.factoryCreator != null) {
adapter = ServiceMetadata.service(this.adapterClass, this.factoryCreator);
} else {
adapter = ServiceMetadata.service(this.adapterClass);
}
}
adapter.extension.putAll(this.extension);
return adapter;
}
use of com.vmware.photon.controller.model.util.StartServicesHelper.ServiceMetadata in project photon-model by vmware.
the class AWSComputeDiskDay2ServiceTest method setUp.
@Before
public void setUp() throws Exception {
CommandLineArgumentParser.parseFromProperties(this);
setAwsClientMockInfo(this.isAwsClientMock, this.awsMockEndpointReference);
AuthCredentialsService.AuthCredentialsServiceState creds = new AuthCredentialsService.AuthCredentialsServiceState();
creds.privateKey = this.secretKey;
creds.privateKeyId = this.accessKey;
TestContext ec2WaitContext = new TestContext(1, Duration.ofSeconds(30L));
AWSUtils.getEc2AsyncClient(creds, TestAWSSetupUtils.regionId, getExecutor()).exceptionally(t -> {
ec2WaitContext.fail(t);
throw new CompletionException(t);
}).thenAccept(ec2Client -> {
this.client = ec2Client;
ec2WaitContext.complete();
});
ec2WaitContext.await();
this.awsTestContext = new HashMap<>();
setUpTestVpc(this.client, this.awsTestContext, this.isMock, this.zoneId);
this.singleNicSpec = (TestAWSSetupUtils.AwsNicSpecs) this.awsTestContext.get(TestAWSSetupUtils.NIC_SPECS_KEY);
this.host = VerificationHost.create(0);
try {
this.host.setMaintenanceIntervalMicros(TimeUnit.MILLISECONDS.toMicros(250));
this.host.start();
PhotonModelServices.startServices(this.host);
PhotonModelAdaptersRegistryAdapters.startServices(this.host);
PhotonModelMetricServices.startServices(this.host);
PhotonModelTaskServices.startServices(this.host);
ServiceMetadata[] serviceMetadata = { factoryService(DiskTaskService.class, DiskTaskService::createFactory) };
StartServicesHelper.startServices(this.host, serviceMetadata);
AWSAdaptersTestUtils.startServicesSynchronously(this.host);
this.host.setTimeoutSeconds(1200);
this.host.waitForServiceAvailable(PhotonModelServices.LINKS);
this.host.waitForServiceAvailable(PhotonModelMetricServices.LINKS);
this.host.waitForServiceAvailable(PhotonModelTaskServices.LINKS);
initResourcePoolAndComputeHost(this.zoneId);
} catch (Throwable e) {
throw new Exception(e);
}
}
Aggregations