diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-02-21 14:04:39 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-02-21 14:21:18 +0200 |
commit | 135fc9d006c5923d4a1ca4822c5a71362f5db573 (patch) | |
tree | aae5dce4bc0cc8ac2d6afa83bf0d86065e3c3b90 /vid-app-common/src | |
parent | 660beccba22f856a73b324f5394f2a79c709affd (diff) |
Enable AsyncInstantiationBusinessLogic tests
Issue-ID: VID-378
Change-Id: If0dd6147f1ce7fba3db01c85359f17abad8bcb07
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src')
6 files changed, 615 insertions, 86 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/config/DataSourceConfig.java b/vid-app-common/src/test/java/org/onap/vid/config/DataSourceConfig.java index ba8060da7..b25a7f238 100644 --- a/vid-app-common/src/test/java/org/onap/vid/config/DataSourceConfig.java +++ b/vid-app-common/src/test/java/org/onap/vid/config/DataSourceConfig.java @@ -1,21 +1,25 @@ package org.onap.vid.config; +import java.util.Properties; +import javax.sql.DataSource; import org.hibernate.SessionFactory; import org.onap.portalsdk.core.service.DataAccessService; import org.onap.portalsdk.core.service.DataAccessServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.orm.hibernate4.HibernateTransactionManager; import org.springframework.orm.hibernate4.LocalSessionFactoryBean; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; -import javax.sql.DataSource; -import java.util.Properties; - +/* +this class enable using in-memory DB in Unit test. +*/ @Configuration @EnableTransactionManagement public class DataSourceConfig { @@ -36,8 +40,15 @@ public class DataSourceConfig { properties.put("hbm2ddl.auto", "create"); properties.put("hibernate.hbm2ddl.auto", "create"); - sessionFactory.setPackagesToScan("org.onap"); + Resource[] mappingLocations = { + new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"), + new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml"), + new ClassPathResource("WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml") + }; + sessionFactory.setHibernateProperties(properties); + sessionFactory.setPackagesToScan("org.onap"); + sessionFactory.setMappingLocations(mappingLocations); return sessionFactory; } diff --git a/vid-app-common/src/test/java/org/onap/vid/config/MockedAaiClientAndFeatureManagerConfig.java b/vid-app-common/src/test/java/org/onap/vid/config/MockedAaiClientAndFeatureManagerConfig.java index 1a4eb528e..83b125949 100644 --- a/vid-app-common/src/test/java/org/onap/vid/config/MockedAaiClientAndFeatureManagerConfig.java +++ b/vid-app-common/src/test/java/org/onap/vid/config/MockedAaiClientAndFeatureManagerConfig.java @@ -2,6 +2,8 @@ package org.onap.vid.config; import org.mockito.Mockito; import org.onap.vid.aai.AaiClientInterface; +import org.onap.vid.services.CloudOwnerService; +import org.onap.vid.services.CloudOwnerServiceImpl; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.togglz.core.manager.FeatureManager; @@ -15,6 +17,11 @@ public class MockedAaiClientAndFeatureManagerConfig { } @Bean + public CloudOwnerService cloudOwnerService(AaiClientInterface aaiClient, FeatureManager featureManager) { + return new CloudOwnerServiceImpl(aaiClient, featureManager); + } + + @Bean public AaiClientInterface aaiClient() { return Mockito.mock(AaiClientInterface.class); } diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java index 96b39bcb1..0e74fbd9a 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java @@ -1,9 +1,65 @@ package org.onap.vid.services; +import static com.google.common.collect.Maps.newHashMap; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasItems; +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.matchesPattern; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.core.Every.everyItem; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.onap.vid.job.Job.JobStatus.COMPLETED; +import static org.onap.vid.job.Job.JobStatus.FAILED; +import static org.onap.vid.job.Job.JobStatus.IN_PROGRESS; +import static org.onap.vid.job.Job.JobStatus.PAUSE; +import static org.onap.vid.job.Job.JobStatus.PENDING; +import static org.onap.vid.job.Job.JobStatus.STOPPED; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import java.io.IOException; +import java.lang.reflect.Method; +import java.net.URL; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import javax.inject.Inject; import net.javacrumbs.jsonunit.JsonAssert; import org.apache.commons.io.IOUtils; import org.hibernate.SessionFactory; @@ -36,9 +92,21 @@ import org.onap.vid.model.JobAuditStatus; import org.onap.vid.model.JobAuditStatus.SourceStatus; import org.onap.vid.model.NameCounter; import org.onap.vid.model.ServiceInfo; -import org.onap.vid.model.serviceInstantiation.*; +import org.onap.vid.model.serviceInstantiation.InstanceGroup; +import org.onap.vid.model.serviceInstantiation.Network; +import org.onap.vid.model.serviceInstantiation.ServiceInstantiation; +import org.onap.vid.model.serviceInstantiation.VfModule; +import org.onap.vid.model.serviceInstantiation.Vnf; import org.onap.vid.mso.MsoOperationalEnvironmentTest; -import org.onap.vid.mso.model.*; +import org.onap.vid.mso.model.InstanceGroupInstantiationRequestDetails; +import org.onap.vid.mso.model.ModelInfo; +import org.onap.vid.mso.model.NetworkInstantiationRequestDetails; +import org.onap.vid.mso.model.ServiceDeletionRequestDetails; +import org.onap.vid.mso.model.ServiceInstantiationRequestDetails; +import org.onap.vid.mso.model.VfModuleInstantiationRequestDetails; +import org.onap.vid.mso.model.VfModuleMacro; +import org.onap.vid.mso.model.VnfInstantiationRequestDetails; +import org.onap.vid.mso.model.VolumeGroupRequestDetails; import org.onap.vid.mso.rest.AsyncRequestStatus; import org.onap.vid.properties.Features; import org.onap.vid.testUtils.TestUtils; @@ -46,33 +114,11 @@ import org.onap.vid.utils.DaoUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.testng.Assert; -import org.testng.annotations.*; - -import javax.inject.Inject; -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URL; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.Optional; -import java.util.*; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import static com.google.common.collect.Maps.newHashMap; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.core.Every.everyItem; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.*; -import static org.onap.vid.job.Job.JobStatus.*; -import static org.testng.Assert.*; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; @ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class, MockedAaiClientAndFeatureManagerConfig.class}) public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseTest { @@ -268,7 +314,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT dataAccessService.saveDomainObject(jobDao, getPropsMap()); } - @Test(enabled = false) + @Test public void testServiceInfoAreOrderedAsExpected() { int userId = 2222; createNewTestServicesInfo(String.valueOf(userId)); @@ -277,7 +323,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertThat("Services aren't ordered as expected", serviceInfoListResult, equalTo(expectedOrderServiceInfo)); } - @Test(enabled = false) + @Test public void testServiceInfoAreFilteredAsExpected() { int userId = 2222; createNewTestServicesInfoForFilter(String.valueOf(userId)); @@ -293,7 +339,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertThat("Services aren't ordered filtered as expected", serviceInfoFilteredByUser, equalTo(expectedFilterByUser)); } - @Test(enabled = false, dataProvider = "pauseAndInstanceParams") + @Test(dataProvider = "pauseAndInstanceParams") public void createMacroServiceInstantiationMsoRequestUniqueName(Boolean isPause, HashMap<String, String> vfModuleInstanceParamsMap, List vnfInstanceParams) throws Exception { defineMocks(); ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(isPause, createVnfList(vfModuleInstanceParamsMap, vnfInstanceParams, true), 2, true, PROJECT_NAME, false); @@ -355,7 +401,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT }; } - @Test(enabled = false, dataProvider="dataProviderForInstanceNames") + @Test(dataProvider="dataProviderForInstanceNames") public void pushBulkJob_bulkWithSize3_instancesNamesAreExactlyAsExpected(boolean isUserProvidedNaming, List<String> expectedNames) { int bulkSize = 3; @@ -375,7 +421,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertEquals(serviceInfoList.stream().map(ServiceInfo::getServiceInstanceName).collect(Collectors.toList()), expectedNames); } - @Test(enabled = false, dataProvider = "aLaCarteAndMacroPayload") + @Test(dataProvider = "aLaCarteAndMacroPayload") public void generateMockServiceInstantiationPayload_serializeBackAndForth_sourceShouldBeTheSame(ServiceInstantiation serviceInstantiationPayload) throws IOException { ObjectMapper mapper = new ObjectMapper(); final String asString = mapper.writeValueAsString(serviceInstantiationPayload); @@ -455,7 +501,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT return generateMockMacroServiceInstantiationPayload(isPause, vnfs, 1, true, PROJECT_NAME, false); } - @Test(enabled = false) + @Test public void testUpdateServiceInfo_WithExistingServiceInfo_ServiceInfoIsUpdated() { UUID uuid = createFakedJobAndServiceInfo(); final String STEPH_CURRY = "Steph Curry"; @@ -484,12 +530,12 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT return uuid; } - @Test(enabled = false, expectedExceptions = GenericUncheckedException.class, expectedExceptionsMessageRegExp = UPDATE_SERVICE_INFO_EXCEPTION_MESSAGE) + @Test(expectedExceptions = GenericUncheckedException.class, expectedExceptionsMessageRegExp = UPDATE_SERVICE_INFO_EXCEPTION_MESSAGE) public void testUpdateServiceInfo_WithNonExisting_ThrowException() { asyncInstantiationBL.updateServiceInfo(UUID.randomUUID(), x -> x.setServiceInstanceName("not matter")); } - @Test(enabled = false, expectedExceptions = GenericUncheckedException.class, expectedExceptionsMessageRegExp = UPDATE_SERVICE_INFO_EXCEPTION_MESSAGE) + @Test(expectedExceptions = GenericUncheckedException.class, expectedExceptionsMessageRegExp = UPDATE_SERVICE_INFO_EXCEPTION_MESSAGE) public void testUpdateServiceInfo_WithDoubleServiceWithSameJobUuid_ThrowException() { UUID uuid = createFakedJobAndServiceInfo(); ServiceInfo serviceInfo = new ServiceInfo(); @@ -508,25 +554,25 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT } - @Test(enabled = false, dataProvider = "isPauseAndPropertyDataProvider") + @Test(dataProvider = "isPauseAndPropertyDataProvider") public void testServiceInstantiationPath_RequestPathIsAsExpected(boolean isPause, String expectedProperty) { ServiceInstantiation serviceInstantiationPauseFlagTrue = generateMacroMockServiceInstantiationPayload(isPause, createVnfList(instanceParamsMapWithoutParams, Collections.EMPTY_LIST, true)); String path = asyncInstantiationBL.getServiceInstantiationPath(serviceInstantiationPauseFlagTrue); Assert.assertEquals(path, SystemProperties.getProperty(expectedProperty)); } - @Test(enabled = false) + @Test public void testCreateVnfEndpoint_useProvidedInstanceId() { String path = asyncInstantiationBL.getVnfInstantiationPath("myGreatId"); - assertThat(path, equalTo("/serviceInstances/v7/myGreatId/vnfs")); + assertThat(path, matchesPattern("/serviceInstances/v./myGreatId/vnfs")); } - @Test(enabled = false) + @Test public void createServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected() throws IOException { createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(true); } - @Test(enabled = false) + @Test public void createServiceInfo_WithUserProvidedNamingFalseAndNoVfmodules_ServiceInfoIsAsExpected() throws IOException { createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(false); } @@ -554,7 +600,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result); } - @Test(enabled = false) + @Test public void createALaCarteService_WithUserProvidedNamingFalse_RequestDetailsIsAsExpected() throws IOException { ServiceInstantiation serviceInstantiationPayload = generateMockALaCarteServiceInstantiationPayload(false, newHashMap(), @@ -571,7 +617,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result); } - @Test(enabled = false) + @Test public void generateALaCarteServiceInstantiationRequest_withVnfList_HappyFllow() throws IOException { ServiceInstantiation serviceInstantiationPayload = generateALaCarteWithVnfsServiceInstantiationPayload(); RequestDetailsWrapper<ServiceInstantiationRequestDetails> result = @@ -581,7 +627,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(serviceExpected, result); } - @Test(enabled = false, dataProvider = "createVnfParameters") + @Test(dataProvider = "createVnfParameters") public void createVnfRequestDetails_detailsAreAsExpected(boolean isFlagAddCloudOwnerActive, boolean isUserProvidedNaming, String file) throws IOException { final List<Vnf> vnfList = new ArrayList<>(createVnfList(new HashMap<>(), null, isUserProvidedNaming, true).values()); @@ -619,7 +665,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT }; } - @Test(enabled = false, dataProvider = "vfModuleRequestDetails") + @Test(dataProvider = "vfModuleRequestDetails") public void createVfModuleRequestDetails_detailsAreAsExpected(String volumeGroupInstanceId, boolean isUserProvidedNaming, String fileName) throws IOException { ModelInfo siModelInfo = createServiceModelInfo(); @@ -660,7 +706,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT }; } - @Test(enabled = false, dataProvider = "expectedAggregatedParams") + @Test(dataProvider = "expectedAggregatedParams") public void testAggregateInstanceParamsAndSuppFile(Map<String, String> instanceParams, Map<String, String> suppParams, List<VfModuleInstantiationRequestDetails.UserParamMap<String, String>> expected) { List<VfModuleInstantiationRequestDetails.UserParamMap<String, String>> aggParams = ((AsyncInstantiationBusinessLogicImpl)asyncInstantiationBL).aggregateAllInstanceParams(instanceParams, suppParams); assertThat("Aggregated params are not as expected", aggParams, equalTo(expected)); @@ -674,7 +720,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT }; } - @Test(enabled = false, dataProvider = "expectedNetworkRequestDetailsParameters") + @Test(dataProvider = "expectedNetworkRequestDetailsParameters") public void createNetworkRequestDetails_detailsAreAsExpected(boolean isUserProvidedNaming, String filePath) throws IOException { final List<Network> networksList = new ArrayList<>(createNetworkList(null, isUserProvidedNaming, true).values()); @@ -692,7 +738,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result); } - @Test(enabled = false) + @Test public void createInstanceGroupRequestDetails_detailsAreAsExpected() throws IOException { final InstanceGroup instanceGroup = createInstanceGroup(true, Action.Create); @@ -710,7 +756,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result); } - @Test(enabled = false) + @Test public void checkIfNullProjectNameSentToMso(){ ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true, createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, Collections.EMPTY_LIST, false), @@ -732,7 +778,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT } - @Test(enabled = false) + @Test public void pushBulkJob_macroServiceverifyCreatedDateBehavior_createdDateIsTheSameForAllServicesInSameBulk() { LocalDateTime startTestDate = LocalDateTime.now().withNano(0); final ServiceInstantiation request = generateMockMacroServiceInstantiationPayload( @@ -744,7 +790,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT pushJobAndAssertDates(startTestDate, request); } - @Test(enabled = false) + @Test public void whenCreateServiceInfo_thenModelId_isModelVersionId() { ServiceInfo serviceInfo = asyncInstantiationBL.createServiceInfo("userID", generateALaCarteWithVnfsServiceInstantiationPayload(), @@ -756,7 +802,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT } - @Test(enabled = false) + @Test public void pushBulkJob_aLaCarteServiceverifyCreatedDateBehavior_createdDateIsTheSameForAllServicesInSameBulk() { LocalDateTime startTestDate = LocalDateTime.now().withNano(0); final ServiceInstantiation request = generateALaCarteServiceInstantiationPayload(); @@ -807,7 +853,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT }; } - @Test(enabled = false, dataProvider = "msoToJobStatusDataProvider") + @Test(dataProvider = "msoToJobStatusDataProvider") public void whenGetStatusFromMso_calcRightJobStatus(String msoStatus, Job.JobStatus expectedJobStatus) { AsyncRequestStatus asyncRequestStatus = asyncRequestStatusResponse(msoStatus); assertThat(asyncInstantiationBL.calcStatus(asyncRequestStatus), equalTo(expectedJobStatus)); @@ -852,7 +898,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT } - @Test(enabled = false, dataProvider = "auditStatuses") + @Test(dataProvider = "auditStatuses") public void givenSomeAuditStatuses_getStatusesOfSpecificSourceAndJobId_getSortedResultsMatchingToParameters(SourceStatus expectedSource, String [] expectedSortedStatuses){ UUID jobUuid = UUID.randomUUID(); List<JobAuditStatus> auditStatusList = com.google.common.collect.ImmutableList.of( @@ -870,7 +916,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT - @Test(enabled = false) + @Test public void addSomeVidStatuses_getThem_verifyGetInsertedWithoutDuplicates(){ ImmutableList<JobStatus> statusesToBeInserted = ImmutableList.of(PENDING, IN_PROGRESS, IN_PROGRESS, COMPLETED); UUID jobUuid = UUID.randomUUID(); @@ -915,7 +961,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT }; } - @Test(enabled = false, dataProvider = "msoAuditStatuses") + @Test(dataProvider = "msoAuditStatuses") public void addSomeMsoStatuses_getThem_verifyGetInsertedWithoutDuplicates(UUID jobUuid, ImmutableList<JobAuditStatus> msoStatuses, ImmutableList<String> expectedStatuses, String assertionReason) { msoStatuses.forEach(status -> { asyncInstantiationBL.auditMsoStatus(status.getJobId(), status.getJobStatus(), status.getRequestId() != null ? status.getRequestId().toString() : null, status.getAdditionalInfo()); @@ -924,7 +970,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertThat( assertionReason, statusesFromDB, is(expectedStatuses)); } - @Test(enabled = false) + @Test public void addSameStatusOfVidAndMso_verifyThatBothWereAdded(){ UUID jobUuid = UUID.randomUUID(); JobStatus sameStatus = IN_PROGRESS; @@ -947,7 +993,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT }; } - @Test(enabled = false, dataProvider="msoRequestStatusFiles") + @Test(dataProvider="msoRequestStatusFiles") public void verifyAsyncRequestStatus_canBeReadFromSample(String msoResponseFile) throws IOException { AsyncRequestStatus asyncRequestStatus = TestUtils.readJsonResourceFileAsObject( msoResponseFile, @@ -955,7 +1001,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertThat(asyncRequestStatus.request.requestStatus.getRequestState(), equalTo("COMPLETE")); } - @Test(enabled = false) + @Test public void deleteJobInfo_pending_deleted() { doNothing().when(jobsBrokerServiceMock).delete(any()); UUID uuid = createServicesInfoWithDefaultValues(PENDING); @@ -963,7 +1009,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertNotNull(asyncInstantiationBL.getServiceInfoByJobId(uuid).getDeletedAt(), "service info wasn't deleted"); } - @Test(enabled = false, expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = DELETE_SERVICE_INFO_STATUS_EXCEPTION_MESSAGE) + @Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = DELETE_SERVICE_INFO_STATUS_EXCEPTION_MESSAGE) public void deleteJobInfo_notAllowdStatus_shouldSendError() { UUID uuid = createServicesInfoWithDefaultValues(COMPLETED); doThrow(new IllegalStateException(DELETE_SERVICE_INFO_STATUS_EXCEPTION_MESSAGE)).when(jobsBrokerServiceMock).delete(any()); @@ -982,7 +1028,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT .map(v -> new Object[]{v}).collect(Collectors.toList()).toArray(new Object[][]{}); } - @Test(enabled = false, dataProvider = "jobStatusesFinal") + @Test(dataProvider = "jobStatusesFinal") public void whenHideService_theServiceNotReturnedInServiceList(JobStatus jobStatus) { UUID uuidToHide = createServicesInfoWithDefaultValues(jobStatus); UUID uuidToShown = createServicesInfoWithDefaultValues(jobStatus); @@ -1007,7 +1053,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT .map(v -> new Object[]{v}).collect(Collectors.toList()).toArray(new Object[][]{}); } - @Test(enabled = false, dataProvider = "jobStatusesNotFinal", + @Test(dataProvider = "jobStatusesNotFinal", expectedExceptions = OperationNotAllowedException.class, expectedExceptionsMessageRegExp = "jobId.*Service status does not allow hide service, status = .*") public void hideServiceInfo_notAllowedStatus_shouldSendError(JobStatus jobStatus) { @@ -1020,7 +1066,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT } } - @Test(enabled = false) + @Test public void whenUseGetCounterInMultiThreads_EachThreadGetDifferentCounter() throws InterruptedException { int SIZE = 200; ExecutorService executor = Executors.newFixedThreadPool(SIZE); @@ -1041,7 +1087,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertThat(expectedResults.size(), is(0)); } - @Test(enabled = false) + @Test public void whenUseGetCounterForSameName_numbersReturnedByOrder() { String name = UUID.randomUUID().toString(); @@ -1051,7 +1097,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT } } - @Test(enabled = false) + @Test public void whenNamedInUsedInAai_getNextNumber() { String name = someCommonStepsAndGetName(); ResourceType type = ResourceType.GENERIC_VNF; @@ -1069,7 +1115,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT when(aaiClient.isNodeTypeExistsByName(eq(AsyncInstantiationBusinessLogicImpl.NAME_FOR_CHECK_AAI_STATUS), any())).thenReturn(false); } - @Test(enabled = false, expectedExceptions=ExceptionWithRequestInfo.class) + @Test(expectedExceptions=ExceptionWithRequestInfo.class) public void whenAaiBadResponseCode_throwInvalidAAIResponseException() { String name = someCommonStepsAndGetName(); ResourceType type = ResourceType.SERVICE_INSTANCE; @@ -1077,7 +1123,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT asyncInstantiationBL.getUniqueName(name, type); } - @Test(enabled = false, expectedExceptions=MaxRetriesException.class) + @Test(expectedExceptions=MaxRetriesException.class) public void whenAaiAlwaysReturnNameUsed_throwInvalidAAIResponseException() { String name = someCommonStepsAndGetName(); ResourceType type = ResourceType.VF_MODULE; @@ -1086,7 +1132,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT asyncInstantiationBL.getUniqueName(name, type); } - @Test(enabled = false) + @Test public void testFormattingOfNameAndCounter() { AsyncInstantiationBusinessLogicImpl bl = (AsyncInstantiationBusinessLogicImpl) asyncInstantiationBL; assertThat(bl.formatNameAndCounter("x", 0), equalTo("x")); @@ -1096,7 +1142,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertThat(bl.formatNameAndCounter("x", 1234), equalTo("x_1234")); } - @Test(enabled = false) + @Test public void pushBulkJob_verifyAlacarteFlow_useALaCartServiceInstantiationJobType(){ final ServiceInstantiation request = generateALaCarteServiceInstantiationPayload(); @@ -1109,7 +1155,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertTrue(argumentCaptor.getValue().equals(JobType.ALaCarteServiceInstantiation)); } - @Test(enabled = false) + @Test public void pushBulkJob_verifyMacroFlow_useMacroServiceInstantiationJobType(){ final ServiceInstantiation request = generateMacroMockServiceInstantiationPayload(false, Collections.emptyMap()); @@ -1122,7 +1168,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertTrue(argumentCaptor.getValue().equals(JobType.MacroServiceInstantiation)); } - @Test(enabled = false) + @Test public void generateALaCarteServiceInstantiationRequest_verifyRequestIsAsExpected() throws IOException { ServiceInstantiation serviceInstantiationPayload = generateALaCarteServiceInstantiationPayload(); final URL resource = this.getClass().getResource("/payload_jsons/bulk_alacarte_service_request.json"); @@ -1132,7 +1178,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result); } - @Test(enabled = false) + @Test public void generateALaCarteServiceDeletionRequest_verifyRequestIsAsExpected() throws IOException { final URL resource = this.getClass().getResource("/payload_jsons/bulk_alacarte_service_deletion_request.json"); String expected = IOUtils.toString(resource, "UTF-8"); @@ -1144,17 +1190,17 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result); } - @Test(enabled = false) + @Test public void getALaCarteServiceDeletionPath_verifyPathIsAsExpected() throws IOException { - String expected = "/serviceInstantiation/v7/serviceInstances/f36f5734-e9df-4fbf-9f35-61be13f028a1"; + String expected = "/serviceInstantiation/v./serviceInstances/f36f5734-e9df-4fbf-9f35-61be13f028a1"; String result = asyncInstantiationBL.getServiceDeletionPath("f36f5734-e9df-4fbf-9f35-61be13f028a1"); - assertThat(expected,equalTo(result)); + assertThat(result, matchesPattern(expected)); } - @Test(enabled = false) + @Test public void getInstanceGroupsDeletionPath_verifyPathIsAsExpected() { assertEquals(asyncInstantiationBL.getInstanceGroupDeletePath("9aada4af-0f9b-424f-ae21-e693bd3e005b"), @@ -1229,7 +1275,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT }; } - @Test(enabled = false, dataProvider="testBuildVnfInstanceParamsDataProvider") + @Test(dataProvider="testBuildVnfInstanceParamsDataProvider") public void testBuildVnfInstanceParams(List<Map<String, String>> currentVnfInstanceParams, List<List<Map<String, String>>> vfModulesInstanceParams, boolean isFeatureActive, @@ -1242,7 +1288,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT } - @Test(enabled = false) + @Test public void whenLcpRegionNotEmpty_thenCloudRegionIdOfResourceIsLegacy() { String legacyCloudRegion = "legacyCloudRegion"; Vnf vnf = new Vnf(new ModelInfo(), null, null, Action.Create.name(), null, "anyCloudRegion", legacyCloudRegion, null, null, null, false, null, null); @@ -1251,7 +1297,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT } - @Test(enabled = false) + @Test public void whenLcpRegionNotEmpty_thenCloudRegionIdOfServiceIsLegacy() { String legacyCloudRegion = "legacyCloudRegion"; ServiceInstantiation service = new ServiceInstantiation(new ModelInfo(), null, null, null, null, null, null, @@ -1260,7 +1306,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertThat(service.getLcpCloudRegionId(), equalTo(legacyCloudRegion)); } - @Test(enabled = false) + @Test public void createVolumeGroup_verifyResultAsExpected() throws IOException { final URL resource = this.getClass().getResource("/payload_jsons/volumegroup_instantiation_request.json"); VfModule vfModule = createVfModule("201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", @@ -1285,7 +1331,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result); } - @Test(enabled = false) + @Test public void getJobTypeByRequest_verifyResultAsExpected(){ ServiceInstantiation service = new ServiceInstantiation(new ModelInfo(), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties index baf56d36c..ef444944d 100644 --- a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties +++ b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties @@ -150,12 +150,17 @@ mso.restapi.network.instance=/serviceInstances/v5/<service_instance_id>/networks mso.restapi.vf.module.instance=/serviceInstances/v7/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules mso.restapi.vf.module.scaleout=/serviceInstantiation/v7/serviceInstances/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules/scaleOut mso.restapi.volume.group.instance=/serviceInstances/v5/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups +mso.restapi.instance.group=/serviceInstantiation/v7/instanceGroups mso.restapi.get.orc.req=/orchestrationRequests/v5 mso.restapi.get.orc.reqs=/orchestrationRequests/v5? mso.restapi.get.man.tasks=/tasks/v1 mso.restapi.configurations=/serviceInstances/v6/<service_instance_id>/configurations mso.restapi.configuration.instance=${mso.restapi.configurations}<configuration_id> +mso.restapi.serviceInstantiationApiRoot=/serviceInstantiation/v7 +mso.restapi.serviceInstanceCreate=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances +mso.restapi.serviceInstanceAssign=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/assign + vid.truststore.filename=/opt/app/vid/etc/vid_keystore.jks mso.dme2.client.timeout=30000 mso.dme2.client.read.timeout=120000 diff --git a/vid-app-common/src/test/resources/WEB-INF/fusion/orm/Fusion.hbm.xml b/vid-app-common/src/test/resources/WEB-INF/fusion/orm/Fusion.hbm.xml new file mode 100644 index 000000000..e9eed439b --- /dev/null +++ b/vid-app-common/src/test/resources/WEB-INF/fusion/orm/Fusion.hbm.xml @@ -0,0 +1,394 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START========================================== + ONAP Portal SDK + =================================================================== + Copyright © 2017 AT&T Intellectual Property. All rights reserved. + =================================================================== + + Unless otherwise specified, all software contained herein is licensed + under the Apache License, Version 2.0 (the “License”); + you may not use this software except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Unless otherwise specified, all documentation contained herein is licensed + under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + you may not use this documentation except in compliance with the License. + You may obtain a copy of the License at + + https://creativecommons.org/licenses/by/4.0/ + + Unless required by applicable law or agreed to in writing, documentation + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ============LICENSE_END============================================ + + + --> + +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> + +<hibernate-mapping package="org.onap.portalsdk.core.domain"> + + <!-- User class mapping details --> + <class name="User" table="FN_USER"> + <id name="id" column="user_id" > + <generator class="native"> + <param name="sequence">seq_fn_user</param> + </generator> + </id> + + <property name="orgId" column="org_id"/> + <property name="managerId" column="manager_id"/> + <property name="firstName" column="first_name"/> + <property name="middleInitial" column="middle_name"/> + <property name="lastName" column="last_name"/> + <property name="phone" column="phone"/> + <property name="fax" column="fax"/> + <property name="cellular" column="cellular"/> + <property name="email" column="email"/> + <property name="addressId" column="address_id"/> + <property name="alertMethodCd" column="alert_method_cd"/> + + <property name="address1" column="address_line_1"/> + <property name="address2" column="address_line_2"/> + <property name="city" column="city"/> + <property name="state" column="state_cd"/> + <property name="zipCode" column="zip_code"/> + <property name="country" column="country_cd"/> + + <property name="hrid" column="hrid"/> + <property name="orgUserId" column="org_user_id"/> + <property name="orgCode" column="org_code"/> + <property name="loginId" column="login_id"/> + <property name="loginPwd" column="login_pwd"/> + <property name="lastLoginDate" column="last_login_date" type="timestamp"/> + + <property name="locationClli" column="location_clli" /> + <property name="orgManagerUserId" column="org_manager_userid" /> + <property name="company" column="company" /> + <property name="department" column="department" /> + <property name="departmentName" column="department_name" /> + <property name="businessUnit" column="business_unit" /> + <property name="businessUnitName" column="business_unit_name" /> + <property name="jobTitle" column="job_title" /> + <property name="siloStatus" column="silo_status" /> + <property name="financialLocCode" column="fin_loc_code" /> + + <property name="active" column="active_yn" type="yes_no"/> + <property name="internal" column="is_internal_yn" type="yes_no"/> + + <property name="created" type="timestamp" column="created_date" /> + <property name="modified" type="timestamp" column="modified_date" /> + + <property name="createdId" column="created_id" /> + <property name="modifiedId" column="modified_id" /> + <property name="timeZoneId" column="timezone" /> + + <set name="userApps" table="FN_USER_ROLE" lazy="false" sort="natural" inverse="true" cascade="all-delete-orphan"> + <key column="user_id"/> + <one-to-many class="org.onap.portalsdk.core.domain.UserApp" /> + </set> + + <set name="pseudoRoles" table="FN_USER_PSEUDO_ROLE" lazy="false" sort="natural"> + <key column="user_id"/> + <many-to-many column="pseudo_role_id" class="org.onap.portalsdk.core.domain.Role" /> + </set> + </class> + + <!-- Profile class mapping details; + dupe of User class, but fewer fields --> + <class name="Profile" table="FN_USER"> + <id name="id" column="user_id" > + <generator class="increment"/> + </id> + <property name="first_name" column="first_name"/> + <property name="last_name" column="last_name"/> + <property name="email" column="email"/> + <property name="orgManagerUserId" column="org_manager_userid" /> + <property name="active_yn" column="active_yn"/> + <property name="orgUserId" column="org_user_id"/> + </class> + + <class name="UserApp" table="fn_user_role"> + <composite-id> + <key-property name="userId" type="long"> + <column name="user_id" precision="11" scale="0" /> + </key-property> + <key-many-to-one name="app" class="org.onap.portalsdk.core.domain.App" column="app_id" /> + <key-many-to-one name="role" class="org.onap.portalsdk.core.domain.Role" column="role_id" /> + </composite-id> + <property name="priority" type="java.lang.Short"> + <column name="priority" precision="4" scale="0" /> + </property> + </class> + + <!-- App class mapping details --> + <class name="App" table="fn_app"> + <id name="id" column="app_id"/> + <property name="name" column="app_name"/> + <property name="appPassword" column="app_password"/> + <property name="username" column="app_username"/> + <property name="imageUrl" column="app_image_url"/> + <property name="description" column="app_description"/> + <property name="notes" column="app_notes"/> + <property name="url" column="app_url"/> + <property name="alternateUrl" column="app_alternate_url"/> + <property name="restEndpoint" column="app_rest_endpoint"/> + <property name="mlAppName" column="ml_app_name"/> + <property name="mlAppAdminId" column="ml_app_admin_id"/> + <property name="motsId" column="mots_id"/> + <property name="open" column="open"/> + <property name="enabled" column="enabled"/> + <property name="thumbnail" column="thumbnail" type="blob"/> + <property name="uebKey" column="ueb_key"/> + <property name="uebSecret" column="ueb_secret"/> + <property name="uebTopicName" column="ueb_topic_name"/> + </class> + + + <!-- Audit Log class mapping details --> + <class name="AuditLog" table="fn_audit_log"> + <id name="id" column="log_id"> + <!-- <generator class="sequence"> + <param name="sequence">seq_fn_audit_log</param> + </generator> --> + <generator class="native"> + <param name="sequence">seq_fn_audit_log</param> + </generator> + </id> + <property name="activityCode" column="activity_cd"/> + <property name="affectedRecordId" column="affected_record_id" /> + <property name="comments" column="comments" /> + <property name="createdId" column="user_id" /> + </class> + + <!-- User Role class mapping details --> + <class name="Role" table="FN_ROLE"> + <id name="id" column="role_id"> + <generator class="native"> + <param name="sequence">seq_fn_role</param> + </generator> + </id> + + <property name="name" column="role_name"/> + <property name="priority" column="priority" /> + <property name="active" column="active_yn" type="yes_no"/> + + <set name="roleFunctions" table="FN_ROLE_FUNCTION" lazy="false" sort="natural"> + <key column="role_id"/> + <many-to-many column="function_cd" class="org.onap.portalsdk.core.domain.RoleFunction"/> + </set> + + <set name="childRoles" table="FN_ROLE_COMPOSITE" lazy="false" sort="natural"> + <key column="parent_role_id"/> + <many-to-many column="child_role_id" class="org.onap.portalsdk.core.domain.Role"/> + </set> + + <set name="parentRoles" table="FN_ROLE_COMPOSITE" lazy="false" sort="natural"> + <key column="child_role_id"/> + <many-to-many column="parent_role_id" class="org.onap.portalsdk.core.domain.Role"/> + </set> + + </class> + + + + <!-- User Role Function class mapping details --> + <class name="RoleFunction" table="FN_FUNCTION"> + <id name="code" column="function_cd" /> + <property name="name" column="function_name" /> + <property name="type" column="type" /> + <property name="action" column="action" /> + </class> + + <!-- Menu class mapping details --> + <class name="Menu" table="FN_MENU"> + <id name="id" column="menu_id"> + <generator class="native"> + <param name="sequence">seq_fn_menu</param> + </generator> + </id> + + <!-- <property name="menuLevel" column="level-1"/> --> + <property name="label" column="label"/> + <property name="parentId" column="parent_id"/> + <property name="action" column="action"/> + <property name="functionCd" column="function_cd"/> + <property name="sortOrder" column="sort_order"/> + <property name="servlet" column="servlet"/> + <property name="queryString" column="query_string"/> + <property name="externalUrl" column="external_url"/> + <property name="target" column="target"/> + <property name="menuSetCode" column="menu_set_cd"/> + <property name="active" column="active_yn" type="yes_no"/> + <property name="separator" column="separator_yn" type="yes_no"/> + <property name="imageSrc" column="image_src" /> + </class> + + <class name="MenuData" table="FN_MENU"> + <!-- <id name="id" column="menu_id"/> --> + <id name="id" column="menu_id"> + <generator class="native"> + <param name="sequence">seq_fn_menu</param> + </generator> + </id> + <property name="label" column="label"/> + <property name="action" column="action"/> + <property name="functionCd" column="function_cd"/> + <property name="sortOrder" column="sort_order"/> + <property name="servlet" column="servlet"/> + <property name="queryString" column="query_string"/> + <property name="externalUrl" column="external_url"/> + <property name="target" column="target"/> + <property name="active" column="active_yn" type="yes_no"/> + <property name="separator" column="separator_yn" type="yes_no"/> + <property name="imageSrc" column="image_src" /> + <property name="menuSetCode" column="menu_set_cd" /> + + <many-to-one name="parentMenu" column="parent_id" class="MenuData"/> + + <set name="childMenus" lazy="false" sort="natural" inverse="true" where="active_yn = 'Y'"> + <key column="parent_id"/> + <one-to-many class="MenuData"/> + </set> + </class> + + <!-- Broadcast Message class mapping details --> + <class name="BroadcastMessage" table="fn_broadcast_message"> + <id name="id" column="message_id"> + <generator class="native"> + <param name="sequence">seq_fn_broadcast_message</param> + </generator> + </id> + <property name="messageText" column="message_text"/> + <property name="locationId" column="message_location_id"/> + + <property name="startDate" column="broadcast_start_date" type="timestamp"/> + <property name="endDate" column="broadcast_end_date" type="timestamp"/> + + <property name="sortOrder" column="sort_order"/> + <property name="active" column="active_yn" type="yes_no"/> + + <property name="siteCd" column="broadcast_site_cd" /> + </class> + + + <!-- State Lookup class mapping details --> + <class name="LuState" table="FN_LU_STATE"> + <id name="abbr" column="state_cd" /> + <property name="state" /> + </class> + + <!-- Country Lookup class mapping details --> + <class name="LuCountry" table="FN_LU_COUNTRY"> + <id name="abbr" column="country_cd" /> + <property name="country" /> + <property name="fullName" column="full_name" /> + <property name="webphoneCountryLabel" column="fullwebphone_country_label_name" /> + </class> + + <class name="LuTimeZone" table="FN_LU_TIMEZONE"> + <id name="timezoneId" column="timezone_id" /> + <property name="name" column="timezone_name" /> + <property name="value" column="timezone_value" /> + </class> + + + <!-- Lookup (id/value bean) class mapping details --> + <class name="Lookup"> + <composite-id name="nameValueId" class="org.onap.portalsdk.core.domain.support.NameValueId"> + <key-property name="val"/> + <key-property name="lab" /> + </composite-id> + </class> + + <class name="UrlsAccessible" table="V_URL_ACCESS"> + <composite-id name="urlsAccessibleKey" class="org.onap.portalsdk.core.domain.UrlsAccessibleKey"> + <key-property name="url" column="url"/> + <key-property name="functionCd" column="function_cd"/> + </composite-id> + </class> + + + <query name="ParentIdForLabelList"> + select distinct md.parentMenu.id from MenuData as md where md.label = :paramLabel and md.label is not null + </query> + + <query name="IdForLabelList"> + select distinct md.id from MenuData as md where md.label = :paramLabel + </query> + + <query name="parentList"> + select distinct md.id, md.label, md.parentMenu.id from MenuData as md where md.label is not null + </query> + + <query name="functionCDlistOld"> + select distinct functionCd from MenuData + </query> + + <query name="functionCDlist"> + select distinct code from RoleFunction + </query> + + <query name="menuData"> + from MenuData where menuSetCode = :menu_set_cd and parentMenu is null + </query> + <query name="restrictedUrls"> + FROM UrlsAccessible A where upper(A.urlsAccessibleKey.url) = upper(:current_url) + </query> + + <query name="getUserNameById"> + select firstName, lastName from User where id = :user_id + </query> + + <query name="getUserEmail"> + select email from User where id = :user_id + </query> + + <query name="getAllUsers"> + select id, firstName, lastName from User where active = true order by lastName, firstName + </query> + + <query name="getRoleNameById"> + select name from Role where id = :role_id + </query> + + <query name="getAllRoles"> + select id, name from Role order by name + </query> + + <query name="getUserByProfileId"> + select orgUserId from User where id = :user_id + </query> + + <query name="getUserIdByorgUserId"> + select id from User where orgUserId = :orgUserId + </query> + + <query name="getUserByOrgUserId"> + FROM User WHERE orgUserId = :org_user_id + </query> + + <query name="getUserByLoginId"> + FROM User WHERE loginId = :login_id + </query> + + <query name="getUserByLoginIdLoginPwd"> + FROM User WHERE loginId = :login_id and loginPwd = :login_pwd + </query> + +</hibernate-mapping> diff --git a/vid-app-common/src/test/resources/WEB-INF/fusion/orm/Workflow.hbm.xml b/vid-app-common/src/test/resources/WEB-INF/fusion/orm/Workflow.hbm.xml new file mode 100644 index 000000000..75361ed34 --- /dev/null +++ b/vid-app-common/src/test/resources/WEB-INF/fusion/orm/Workflow.hbm.xml @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START========================================== + ONAP Portal SDK + =================================================================== + Copyright © 2017 AT&T Intellectual Property. All rights reserved. + =================================================================== + + Unless otherwise specified, all software contained herein is licensed + under the Apache License, Version 2.0 (the “License”); + you may not use this software except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Unless otherwise specified, all documentation contained herein is licensed + under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + you may not use this documentation except in compliance with the License. + You may obtain a copy of the License at + + https://creativecommons.org/licenses/by/4.0/ + + Unless required by applicable law or agreed to in writing, documentation + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ============LICENSE_END============================================ + + + --> + +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> + +<hibernate-mapping package="org.onap.portalsdk.workflow.domain"> + + + <!-- WorkflowSchedule mapping details --> + <class name="WorkflowSchedule" table="fn_schedule_workflows"> + <id name="id" column="id_schedule_workflows"> + <generator class="native"> + </generator> + </id> + + <property name="serverUrl" column="workflow_server_url"/> + <property name="workflowKey" column="workflow_key"/> + <property name="arguments" column="workflow_arguments"/> + <property name="cronDetails" column="startDateTimeCron"/> + <property name="startDateTime" column="start_date_time"/> + <property name="endDateTime" column="endDateTime"/> + <property name="recurrence" column="recurrence"/> + + </class> + + + +</hibernate-mapping> |