aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org/onap/vid/config
diff options
context:
space:
mode:
authorEinat Vinouze <einat.vinouze@intl.att.com>2019-07-16 17:17:36 +0300
committerIttay Stern <ittay.stern@att.com>2019-07-30 06:01:44 +0300
commite601bbdc43bae9a08e2e10c5139a6f76b47860d7 (patch)
tree1913f0b369ead3f2ea5557e5649d8281eca9871c /vid-app-common/src/test/java/org/onap/vid/config
parent76c6ee4a697617ec4cdee2f3b48bc83136c858c5 (diff)
Implant vid-app-common org.onap.vid.job (main and test)
Issue-ID: VID-378 Change-Id: I41b0bdc2c4e3635f3f3319b1cd63cefc61912dfc Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com> Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/config')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/config/DataSourceConfig.java2
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/config/JobAdapterConfig.java25
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java175
3 files changed, 121 insertions, 81 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 43adc8cf1..15f849a58 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
@@ -63,7 +63,7 @@ public class DataSourceConfig {
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")
+// new ClassPathResource("WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml")
};
sessionFactory.setHibernateProperties(properties);
diff --git a/vid-app-common/src/test/java/org/onap/vid/config/JobAdapterConfig.java b/vid-app-common/src/test/java/org/onap/vid/config/JobAdapterConfig.java
index 7462a32b2..149fad354 100644
--- a/vid-app-common/src/test/java/org/onap/vid/config/JobAdapterConfig.java
+++ b/vid-app-common/src/test/java/org/onap/vid/config/JobAdapterConfig.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file 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.
@@ -21,33 +21,26 @@
package org.onap.vid.config;
-import org.hibernate.SessionFactory;
+import org.mockito.Mockito;
import org.onap.vid.job.JobAdapter;
-import org.onap.vid.job.JobsBrokerService;
import org.onap.vid.job.impl.JobAdapterImpl;
-import org.onap.vid.job.impl.JobsBrokerServiceInDatabaseImpl;
-import org.onap.vid.properties.VidProperties;
-import org.onap.portalsdk.core.service.DataAccessService;
-import org.onap.portalsdk.core.util.SystemProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.togglz.core.manager.FeatureManager;
@Configuration
@EnableTransactionManagement
public class JobAdapterConfig {
@Bean
- public JobAdapter jobAdapter() {
- return new JobAdapterImpl();
+ public FeatureManager featureManager() {
+ return Mockito.mock(FeatureManager.class);
}
@Bean
- public JobsBrokerService jobsBrokerService(DataAccessService dataAccessService, SessionFactory sessionFactory) {
- int maxOpenedInstantiationRequestsToMso = Integer.parseInt(SystemProperties.getProperty(VidProperties.MSO_MAX_OPENED_INSTANTIATION_REQUESTS));
- int pollingIntervalSeconds = Integer.parseInt(SystemProperties.getProperty(VidProperties.MSO_ASYNC_POLLING_INTERVAL_SECONDS));
-
- return new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, maxOpenedInstantiationRequestsToMso, pollingIntervalSeconds);
+ public JobAdapter jobAdapter(FeatureManager featureManager) {
+ return new JobAdapterImpl(featureManager);
}
-}
+} \ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java
index 1fc46eeb9..c4f788689 100644
--- a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java
+++ b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java
@@ -28,6 +28,7 @@ import org.onap.vid.aai.util.HttpsAuthClient;
import org.onap.vid.aai.util.SSLContextProvider;
import org.onap.vid.aai.util.ServletRequestHelper;
import org.onap.vid.aai.util.SystemPropertyHelper;
+import org.onap.vid.dal.AsyncInstantiationRepository;
import org.onap.vid.job.JobAdapter;
import org.onap.vid.job.JobsBrokerService;
import org.onap.vid.job.command.*;
@@ -52,8 +53,13 @@ public class JobCommandsConfigWithMockedMso {
}
@Bean
- public JobsBrokerService jobsBrokerService(DataAccessService dataAccessService, SessionFactory sessionFactory) {
- return new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0);
+ public VersionService versionService() {
+ return Mockito.mock(VersionService.class);
+ }
+
+ @Bean
+ public JobsBrokerService jobsBrokerService(DataAccessService dataAccessService, SessionFactory sessionFactory, VersionService versionService) {
+ return new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0,versionService);
}
@Bean
@@ -76,9 +82,10 @@ public class JobCommandsConfigWithMockedMso {
return new HttpsAuthClient("some random path", systemPropertyHelper, sslContextProvider, featureManager);
}
+
@Bean
- public JobAdapter jobAdapter() {
- return new JobAdapterImpl();
+ public JobAdapter jobAdapter(FeatureManager featureManager) {
+ return new JobAdapterImpl(featureManager);
}
@Bean
@@ -100,119 +107,159 @@ public class JobCommandsConfigWithMockedMso {
}
@Bean
- public AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic(DataAccessService dataAccessService,
- JobAdapter jobAdapter,
- JobsBrokerService jobsBrokerService,
- SessionFactory sessionFactory,
- AaiClientInterface aaiClient,
- FeatureManager featureManager,
- CloudOwnerService cloudOwnerService) {
- return new AsyncInstantiationBusinessLogicImpl(dataAccessService, jobAdapter, jobsBrokerService, sessionFactory, aaiClient, featureManager, cloudOwnerService);
+ public MsoRequestBuilder msoRequestHandlerService(AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ CloudOwnerService cloudOwnerService,
+ AaiClientInterface aaiClient,
+ FeatureManager featureManager) {
+ return new MsoRequestBuilder(asyncInstantiationBusinessLogic, cloudOwnerService, aaiClient, featureManager);
}
-
@Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public MacroServiceInstantiationCommand serviceInstantiationCommand() {
- return new MacroServiceInstantiationCommand();
+ public AsyncInstantiationRepository asyncInstantiationRepository(DataAccessService dataAccessService) {
+ return new AsyncInstantiationRepository(dataAccessService);
}
@Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public ServiceInProgressStatusCommand inProgressStatusCommand() {
- return new ServiceInProgressStatusCommand();
+ public AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic(JobAdapter jobAdapter,
+ JobsBrokerService jobsBrokerService,
+ SessionFactory sessionFactory,
+ AaiClientInterface aaiClient,
+ FeatureManager featureManager,
+ CloudOwnerService cloudOwnerService,
+ AsyncInstantiationRepository asyncInstantiationRepository,
+ AuditService auditService) {
+ return new AsyncInstantiationBusinessLogicImpl(jobAdapter, jobsBrokerService, sessionFactory, aaiClient, featureManager, cloudOwnerService, asyncInstantiationRepository, auditService);
}
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public ALaCarteServiceInstantiationCommand aLaCarteServiceInstantiationCommand() {
- return new ALaCarteServiceInstantiationCommand();
- }
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public ALaCarteServiceCommand aLaCarteServiceCommand(
AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
JobsBrokerService jobsBrokerService,
+ MsoRequestBuilder msoRequestBuilder,
MsoResultHandlerService msoResultHandlerService,
JobAdapter jobAdapter,
InProgressStatusService inProgressStatusService,
WatchChildrenJobsBL watchChildrenJobsBL,
- RestMsoImplementation restMso) {
- return new ALaCarteServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoResultHandlerService, jobAdapter, restMso);
+ RestMsoImplementation restMso,
+ AuditService auditService) {
+ return new ALaCarteServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService);
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public InstanceGroupCommand instanceGroupCommand(
+ public MacroServiceCommand macroServiceCommand(
AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
- MsoResultHandlerService msoResultHandlerService, InProgressStatusService inProgressStatusService,
+ JobsBrokerService jobsBrokerService,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ JobAdapter jobAdapter,
+ InProgressStatusService inProgressStatusService,
WatchChildrenJobsBL watchChildrenJobsBL,
- RestMsoImplementation restMso) {
- return new InstanceGroupCommand(asyncInstantiationBusinessLogic, restMso, msoResultHandlerService, inProgressStatusService, watchChildrenJobsBL);
+ RestMsoImplementation restMso,
+ AuditService auditService) {
+ return new MacroServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService);
}
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public VnfInstantiationCommand vnfInstantiationCommand() {
- return new VnfInstantiationCommand();
- }
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public VolumeGroupInstantiationCommand volumeGroupInstantiationCommand() {
- return new VolumeGroupInstantiationCommand();
- }
-
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public WatchingCommandBaseModule watchingCommandBaseModule() {
- return new WatchingCommandBaseModule();
+ public NetworkCommand networkCommand(
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ RestMsoImplementation restMso,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter) {
+ return new NetworkCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter);
}
-
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public VolumeGroupInProgressStatusCommand volumeGroupInProgressStatusCommand() {
- return new VolumeGroupInProgressStatusCommand();
+ public InstanceGroupCommand instanceGroupCommand(
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ RestMsoImplementation restMso,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter) {
+ return new InstanceGroupCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter);
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public VfmoduleInstantiationCommand vfmoduleInstantiationCommand() {
- return new VfmoduleInstantiationCommand();
+ public InstanceGroupMemberCommand instanceGroupMemberCommand (
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ RestMsoImplementation restMso,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter) {
+ return new InstanceGroupMemberCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, inProgressStatusService,
+ watchChildrenJobsBL, jobsBrokerService, jobAdapter);
}
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public WatchingCommand watchingCommandCommand() {
- return new WatchingCommand();
- }
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public ResourceInProgressStatusCommand resourceInProgressStatusCommand() {
- return new ResourceInProgressStatusCommand();
+ public VnfCommand VnfCommand(
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ RestMsoImplementation restMso,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter,
+ FeatureManager featureManager) {
+ return new VnfCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService ,jobAdapter,
+ featureManager);
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public VnfInProgressStatusCommand vnfInProgressStatusCommand() {
- return new VnfInProgressStatusCommand();
+ public VolumeGroupCommand volumeGroupCommand(
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ RestMsoImplementation restMso,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter) {
+ return new VolumeGroupCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService ,jobAdapter);
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public InstanceGroupInstantiationCommand instanceGroupInstantiationCommand() {
- return new InstanceGroupInstantiationCommand();
+ public VfmoduleCommand VfmoduleCommand(
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ RestMsoImplementation restMso,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter) {
+ return new VfmoduleCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter);
}
-
@Bean
- public AuditService auditService(AsyncInstantiationBusinessLogic asyncInstantiationBL, RestMsoImplementation msoClient) {
- return new AuditServiceImpl(asyncInstantiationBL, msoClient);
+ public AuditService auditService(RestMsoImplementation msoClient, AsyncInstantiationRepository asyncInstantiationRepository) {
+ return new AuditServiceImpl(msoClient, asyncInstantiationRepository);
}
@Bean
- public InProgressStatusService inProgressStatusService(AsyncInstantiationBusinessLogic asyncInstantiationBL, RestMsoImplementation restMso, AuditService auditService) {
- return new InProgressStatusService(asyncInstantiationBL, restMso, auditService);
+ public InProgressStatusService inProgressStatusService(AsyncInstantiationBusinessLogic asyncInstantiationBL, RestMsoImplementation restMso, AuditService auditService, FeatureManager featureManager) {
+ return new InProgressStatusService(asyncInstantiationBL, restMso, auditService, featureManager);
}
@Bean