Search in sources :

Example 1 with Configuration

use of org.onap.aai.domain.yang.Configuration in project so by onap.

the class BBInputSetupUtilsTest method getRelatedConfigurationByNameFromServiceInstanceTest.

@Test
public void getRelatedConfigurationByNameFromServiceInstanceTest() throws Exception {
    Configuration configuration = new Configuration();
    configuration.setConfigurationId("id123");
    doReturn(Optional.of(configuration)).when(MOCK_aaiResourcesClient).getOne(Configurations.class, Configuration.class, AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("service-instance-id123")).relatedTo(Types.CONFIGURATIONS.getFragment()).queryParam("configuration-name", "configuration-name123"));
    Optional<Configuration> actual = this.bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("service-instance-id123", "configuration-name123");
    assertTrue(actual.isPresent());
    assertEquals(configuration.getConfigurationId(), actual.get().getConfigurationId());
}
Also used : Configuration(org.onap.aai.domain.yang.Configuration) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Test(org.junit.Test)

Example 2 with Configuration

use of org.onap.aai.domain.yang.Configuration in project so by onap.

the class BBInputSetupUtilsTest method getAAIConfigurationTest.

@Test
public void getAAIConfigurationTest() throws IOException {
    final String configurationId = "configurationId";
    Configuration expectedAaiConfiguration = mapper.readValue(new File(RESOURCE_PATH + "ConfigurationInput.json"), Configuration.class);
    doReturn(Optional.of(expectedAaiConfiguration)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class));
    assertThat(bbInputSetupUtils.getAAIConfiguration(configurationId), sameBeanAs(expectedAaiConfiguration));
}
Also used : Configuration(org.onap.aai.domain.yang.Configuration) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) AAIResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) File(java.io.File) Test(org.junit.Test)

Example 3 with Configuration

use of org.onap.aai.domain.yang.Configuration in project so by onap.

the class WorkflowActionBBTasksTest method getConfigurationId.

@Test
public void getConfigurationId() throws Exception {
    org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
    vnfc.setModelInvariantId("modelInvariantId");
    vnfc.setVnfcName("testVnfcName");
    List<Configuration> configurations = new ArrayList<>();
    org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
    configuration.setConfigurationId("configurationId");
    configuration.setModelCustomizationId("modelCustimizationId");
    configuration.setConfigurationName("testConfigurationName");
    configurations.add(configuration);
    doReturn(configurations.get(0).getConfigurationId()).when(workflowActionBBTasks).getConfigurationId(vnfc);
    assertEquals(workflowActionBBTasks.getConfigurationId(vnfc), "configurationId");
}
Also used : Configuration(org.onap.aai.domain.yang.Configuration) ArrayList(java.util.ArrayList) Configuration(org.onap.aai.domain.yang.Configuration) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 4 with Configuration

use of org.onap.aai.domain.yang.Configuration in project so by onap.

the class WorkflowActionBBTasksTest method setConfigurationNameTest.

@Test
public void setConfigurationNameTest() {
    String resourceId = "40bc4ebd-11df-4610-8055-059f7441ec1c";
    WorkflowType resourceType = WorkflowType.CONFIGURATION;
    InfraActiveRequests request = new InfraActiveRequests();
    Configuration configuration = new Configuration();
    configuration.setConfigurationName("configurationName");
    doReturn(configuration).when(bbSetupUtils).getAAIConfiguration(resourceId);
    workflowActionBBTasks.setInstanceName(resourceId, resourceType, request);
    assertEquals("configurationName", request.getConfigurationName());
}
Also used : Configuration(org.onap.aai.domain.yang.Configuration) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 Configuration (org.onap.aai.domain.yang.Configuration)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)2 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 AAIResourceUri (org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri)1 InfraActiveRequests (org.onap.so.db.request.beans.InfraActiveRequests)1