summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorTomasz Golabek <tomasz.golabek@nokia.com>2019-04-05 14:46:13 +0200
committerOren Kleks <orenkle@amdocs.com>2019-04-22 06:15:17 +0000
commit5ed13032ff4803aa27cd1f1986ba34037be9c479 (patch)
treedfc93aba8e0096720a1f1ffc0e7e9c35c3ee1675 /catalog-be/src/main
parent521000b2278eaf9fb1e57533e523014da1900098 (diff)
Some unit tests for catalog-be
Code coverage for some classes from catalog-be increased. Some refactor made if needed. Change-Id: I1b292cfbe4b0d2aa4fbe22871da3228aa434b823 Issue-ID: SDC-2220 Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingManager.java12
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/ConfigurationProvider.java32
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/config/CatalogBESpringConfig.java27
3 files changed, 67 insertions, 4 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingManager.java
index f7c46b2eb9..4e2b85eeb6 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingManager.java
@@ -16,12 +16,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
*/
package org.openecomp.sdc.be.auditing.impl;
import org.openecomp.sdc.be.auditing.api.AuditEventFactory;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
@@ -30,6 +31,7 @@ import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent;
import org.openecomp.sdc.common.log.elements.LogFieldsMdcHandler;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.log.wrappers.LoggerSdcAudit;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@@ -39,15 +41,17 @@ public class AuditingManager {
private final AuditingDao auditingDao;
private final AuditCassandraDao cassandraDao;
+ private final ConfigurationProvider configurationProvider;
- public AuditingManager(AuditingDao auditingDao, AuditCassandraDao cassandraDao) {
+ @Autowired
+ public AuditingManager(AuditingDao auditingDao, AuditCassandraDao cassandraDao, ConfigurationProvider configurationProvider) {
this.auditingDao = auditingDao;
this.cassandraDao = cassandraDao;
+ this.configurationProvider = configurationProvider;
}
-
public String auditEvent(AuditEventFactory factory) {
- if (ConfigurationManager.getConfigurationManager().getConfiguration().isDisableAudit()) {
+ if (configurationProvider.getConfiguration().isDisableAudit()) {
return null;
}
String msg = factory.getLogMessage();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/ConfigurationProvider.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/ConfigurationProvider.java
new file mode 100644
index 0000000000..eea1b30e2d
--- /dev/null
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/ConfigurationProvider.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.be.auditing.impl;
+
+import org.openecomp.sdc.be.config.Configuration;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.springframework.stereotype.Component;
+
+@Component("configurationProvider")
+public class ConfigurationProvider {
+
+ public Configuration getConfiguration() {
+ return ConfigurationManager.getConfigurationManager().getConfiguration();
+ }
+}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/config/CatalogBESpringConfig.java b/catalog-be/src/main/java/org/openecomp/sdc/config/CatalogBESpringConfig.java
index aa5cdac691..75f7154f18 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/config/CatalogBESpringConfig.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/config/CatalogBESpringConfig.java
@@ -1,5 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
package org.openecomp.sdc.config;
+import org.openecomp.sdc.be.auditing.impl.ConfigurationProvider;
import org.openecomp.sdc.be.components.impl.ComponentLocker;
import org.openecomp.sdc.be.components.impl.lock.ComponentLockAspect;
import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
@@ -41,6 +63,11 @@ public class CatalogBESpringConfig {
return new LifecycleBusinessLogic();
}
+ @Bean(name = "configurationProvider")
+ public ConfigurationProvider configurationProvider() {
+ return new ConfigurationProvider();
+ }
+
@Bean(name = "transactionManager")
public TransactionManager transactionManager() {
return new TransactionManager();