diff options
Diffstat (limited to 'common-app-api/src/test/java')
53 files changed, 990 insertions, 4707 deletions
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/BeEcompErrorManagerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/BeEcompErrorManagerTest.java deleted file mode 100644 index 440f7587c7..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/BeEcompErrorManagerTest.java +++ /dev/null @@ -1,733 +0,0 @@ -package org.openecomp.sdc.be.config; - -import org.junit.Test; -import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; -import org.openecomp.sdc.common.config.IEcompConfigurationManager; - - -public class BeEcompErrorManagerTest { - - private BeEcompErrorManager createTestSubject() { - return BeEcompErrorManager.getInstance(); - } - - - @Test - public void testGetInstance() throws Exception { - BeEcompErrorManager result; - - // default test - result = BeEcompErrorManager.getInstance(); - } - - - - - @Test - public void testGetConfigurationManager() throws Exception { - BeEcompErrorManager testSubject; - IEcompConfigurationManager result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getConfigurationManager(); - } - - - @Test - public void testLogBeUebAuthenticationError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String reason = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeUebAuthenticationError(context, reason); - } - - - @Test - public void testLogBeHealthCheckRecovery() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeHealthCheckRecovery(context); - } - - - @Test - public void testLogBeHealthCheckTitanRecovery() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeHealthCheckTitanRecovery(context); - } - - - @Test - public void testLogBeHealthCheckElasticSearchRecovery() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeHealthCheckElasticSearchRecovery(context); - } - - - @Test - public void testLogBeHealthCheckUebClusterRecovery() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeHealthCheckUebClusterRecovery(context); - } - - - @Test - public void testLogFeHealthCheckRecovery() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logFeHealthCheckRecovery(context); - } - - - @Test - public void testLogBeHealthCheckError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeHealthCheckError(context); - } - - - @Test - public void testLogBeHealthCheckTitanError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeHealthCheckTitanError(context); - } - - - @Test - public void testLogBeHealthCheckElasticSearchError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeHealthCheckElasticSearchError(context); - } - - - @Test - public void testLogBeHealthCheckUebClusterError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeHealthCheckUebClusterError(context); - } - - - @Test - public void testLogFeHealthCheckError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logFeHealthCheckError(context); - } - - - @Test - public void testLogBeUebConnectionError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String reason = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeUebConnectionError(context, reason); - } - - - @Test - public void testLogBeUebUnkownHostError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String host = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeUebUnkownHostError(context, host); - } - - - @Test - public void testLogBeComponentMissingError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String componentType = ""; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeComponentMissingError(context, componentType, name); - } - - - @Test - public void testLogBeIncorrectComponentError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String componentType = ""; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeIncorrectComponentError(context, componentType, name); - } - - - @Test - public void testLogBeInvalidConfigurationError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String parameterName = ""; - String parameterValue = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeInvalidConfigurationError(context, parameterName, parameterValue); - } - - - @Test - public void testLogBeUebObjectNotFoundError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String notFoundObjectName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeUebObjectNotFoundError(context, notFoundObjectName); - } - - - @Test - public void testLogBeDistributionEngineInvalidArtifactType() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String artifactType = ""; - String validArtifactTypes = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeDistributionEngineInvalidArtifactType(context, artifactType, validArtifactTypes); - } - - - @Test - public void testLogBeMissingConfigurationError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String parameterName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeMissingConfigurationError(context, parameterName); - } - - - @Test - public void testLogBeConfigurationInvalidListSizeError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String parameterName = ""; - int listMinimumSize = 0; - - // default test - testSubject = createTestSubject(); - testSubject.logBeConfigurationInvalidListSizeError(context, parameterName, listMinimumSize); - } - - - @Test - public void testLogErrorConfigFileFormat() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logErrorConfigFileFormat(context, description); - } - - - @Test - public void testLogBeMissingArtifactInformationError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String missingInfo = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeMissingArtifactInformationError(context, missingInfo); - } - - - @Test - public void testLogBeArtifactMissingError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String artifactName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeArtifactMissingError(context, artifactName); - } - - - @Test - public void testLogBeUserMissingError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String userId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeUserMissingError(context, userId); - } - - - @Test - public void testLogBeInvalidTypeError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String type = ""; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeInvalidTypeError(context, type, name); - } - - - @Test - public void testLogBeInvalidValueError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String value = ""; - String name = ""; - String type = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeInvalidValueError(context, value, name, type); - } - - - @Test - public void testLogBeArtifactPayloadInvalid() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeArtifactPayloadInvalid(context); - } - - - @Test - public void testLogBeArtifactInformationInvalidError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeArtifactInformationInvalidError(context); - } - - - @Test - public void testLogBeDistributionMissingError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String distributionName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeDistributionMissingError(context, distributionName); - } - - - @Test - public void testLogBeGraphObjectMissingError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String objectType = ""; - String objectName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeGraphObjectMissingError(context, objectType, objectName); - } - - - @Test - public void testLogBeInvalidJsonInput() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeInvalidJsonInput(context); - } - - - @Test - public void testLogBeInitializationError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeInitializationError(context); - } - - - @Test - public void testLogBeFailedAddingResourceInstanceError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String resourceName = ""; - String serviceId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeFailedAddingResourceInstanceError(context, resourceName, serviceId); - } - - - @Test - public void testLogBeUebSystemError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String operation = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeUebSystemError(context, operation); - } - - - @Test - public void testLogBeDistributionEngineSystemError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String operation = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeDistributionEngineSystemError(context, operation); - } - - - @Test - public void testLogBeFailedAddingNodeTypeError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String nodeType = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeFailedAddingNodeTypeError(context, nodeType); - } - - - @Test - public void testLogBeDaoSystemError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeDaoSystemError(context); - } - - - @Test - public void testLogBeSystemError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeSystemError(context); - } - - - @Test - public void testLogBeExecuteRollbackError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeExecuteRollbackError(context); - } - - - @Test - public void testLogBeFailedLockObjectError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String type = ""; - String id = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeFailedLockObjectError(context, type, id); - } - - - @Test - public void testLogBeFailedCreateNodeError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String nodeName = ""; - String status = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeFailedCreateNodeError(context, nodeName, status); - } - - - @Test - public void testLogBeFailedUpdateNodeError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String nodeName = ""; - String status = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeFailedUpdateNodeError(context, nodeName, status); - } - - - @Test - public void testLogBeFailedDeleteNodeError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String nodeName = ""; - String status = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeFailedDeleteNodeError(context, nodeName, status); - } - - - @Test - public void testLogBeFailedRetrieveNodeError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String nodeName = ""; - String status = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeFailedRetrieveNodeError(context, nodeName, status); - } - - - @Test - public void testLogBeFailedFindParentError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String node = ""; - String status = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeFailedFindParentError(context, node, status); - } - - - @Test - public void testLogBeFailedFindAllNodesError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String nodeType = ""; - String parentNode = ""; - String status = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeFailedFindAllNodesError(context, nodeType, parentNode, status); - } - - - @Test - public void testLogBeFailedFindAssociationError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String nodeType = ""; - String fromNode = ""; - String status = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeFailedFindAssociationError(context, nodeType, fromNode, status); - } - - - @Test - public void testLogBeComponentCleanerSystemError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String operation = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeComponentCleanerSystemError(context, operation); - } - - - @Test - public void testLogBeRestApiGeneralError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logBeRestApiGeneralError(context); - } - - - @Test - public void testLogFqdnResolveError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logFqdnResolveError(context, description); - } - - - @Test - public void testLogSiteSwitchoverInfo() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.logSiteSwitchoverInfo(context, description); - } - - - @Test - public void testLogInternalAuthenticationError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String description = ""; - ErrorSeverity severity = null; - - // test 1 - testSubject = createTestSubject(); - severity = null; - testSubject.logInternalAuthenticationError(context, description, severity); - } - - - @Test - public void testLogInternalConnectionError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String description = ""; - ErrorSeverity severity = null; - - // test 1 - testSubject = createTestSubject(); - severity = null; - testSubject.logInternalConnectionError(context, description, severity); - } - - - @Test - public void testLogInternalDataError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String description = ""; - ErrorSeverity severity = null; - - // test 1 - testSubject = createTestSubject(); - severity = null; - testSubject.logInternalDataError(context, description, severity); - } - - - @Test - public void testLogInvalidInputError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String description = ""; - ErrorSeverity severity = null; - - // test 1 - testSubject = createTestSubject(); - severity = null; - testSubject.logInvalidInputError(context, description, severity); - } - - - @Test - public void testLogInternalFlowError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String description = ""; - ErrorSeverity severity = null; - - // test 1 - testSubject = createTestSubject(); - severity = null; - testSubject.logInternalFlowError(context, description, severity); - } - - - @Test - public void testLogInternalUnexpectedError() throws Exception { - BeEcompErrorManager testSubject; - String context = ""; - String description = ""; - ErrorSeverity severity = null; - - // test 1 - testSubject = createTestSubject(); - severity = null; - testSubject.logInternalUnexpectedError(context, description, severity); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/CleanComponentsConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/CleanComponentsConfigurationTest.java deleted file mode 100644 index f7124d3eb4..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/CleanComponentsConfigurationTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.openecomp.sdc.be.config; - -import java.util.List; - -import org.junit.Test; - - -public class CleanComponentsConfigurationTest { - - private CleanComponentsConfiguration createTestSubject() { - return new CleanComponentsConfiguration(); - } - - - @Test - public void testGetCleanIntervalInMinutes() throws Exception { - CleanComponentsConfiguration testSubject; - long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCleanIntervalInMinutes(); - } - - - - - - @Test - public void testGetComponentsToClean() throws Exception { - CleanComponentsConfiguration testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentsToClean(); - } - - - @Test - public void testSetComponentsToClean() throws Exception { - CleanComponentsConfiguration testSubject; - List<String> componentsToClean = null; - - // default test - testSubject = createTestSubject(); - testSubject.setComponentsToClean(componentsToClean); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java deleted file mode 100644 index 0604e80ffc..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java +++ /dev/null @@ -1,1453 +0,0 @@ -package org.openecomp.sdc.be.config; - -import java.util.Date; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.junit.Test; -import org.openecomp.sdc.be.config.Configuration.ApplicationL1CacheConfig; -import org.openecomp.sdc.be.config.Configuration.ApplicationL2CacheConfig; -import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig; -import org.openecomp.sdc.be.config.Configuration.BeMonitoringConfig; -import org.openecomp.sdc.be.config.Configuration.CassandrConfig; -import org.openecomp.sdc.be.config.Configuration.EcompPortalConfig; -import org.openecomp.sdc.be.config.Configuration.ElasticSearchConfig; -import org.openecomp.sdc.be.config.Configuration.OnboardingConfig; -import org.openecomp.sdc.be.config.Configuration.SwitchoverDetectorConfig; -import org.openecomp.sdc.be.config.Configuration.ToscaValidatorsConfig; -import org.openecomp.sdc.be.config.Configuration.VfModuleProperty; - - -public class ConfigurationTest { - - private Configuration createTestSubject() { - return new Configuration(); - } - - - @Test - public void testGetGenericAssetNodeTypes() throws Exception { - Configuration testSubject; - Map<String, String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getGenericAssetNodeTypes(); - } - - - @Test - public void testSetGenericAssetNodeTypes() throws Exception { - Configuration testSubject; - Map<String, String> genericAssetNodeTypes = null; - - // default test - testSubject = createTestSubject(); - testSubject.setGenericAssetNodeTypes(genericAssetNodeTypes); - } - - - @Test - public void testGetSwitchoverDetector() throws Exception { - Configuration testSubject; - SwitchoverDetectorConfig result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSwitchoverDetector(); - } - - - @Test - public void testSetSwitchoverDetector() throws Exception { - Configuration testSubject; - SwitchoverDetectorConfig switchoverDetector = null; - - // default test - testSubject = createTestSubject(); - testSubject.setSwitchoverDetector(switchoverDetector); - } - - - @Test - public void testGetApplicationL1Cache() throws Exception { - Configuration testSubject; - ApplicationL1CacheConfig result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getApplicationL1Cache(); - } - - - @Test - public void testSetApplicationL1Cache() throws Exception { - Configuration testSubject; - ApplicationL1CacheConfig applicationL1Cache = null; - - // default test - testSubject = createTestSubject(); - testSubject.setApplicationL1Cache(applicationL1Cache); - } - - - @Test - public void testGetApplicationL2Cache() throws Exception { - Configuration testSubject; - ApplicationL2CacheConfig result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getApplicationL2Cache(); - } - - - @Test - public void testSetApplicationL2Cache() throws Exception { - Configuration testSubject; - ApplicationL2CacheConfig applicationL2Cache = null; - - // default test - testSubject = createTestSubject(); - testSubject.setApplicationL2Cache(applicationL2Cache); - } - - - @Test - public void testGetCassandraConfig() throws Exception { - Configuration testSubject; - CassandrConfig result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCassandraConfig(); - } - - - @Test - public void testSetCassandraConfig() throws Exception { - Configuration testSubject; - CassandrConfig cassandraKeySpace = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCassandraConfig(cassandraKeySpace); - } - - - @Test - public void testGetIdentificationHeaderFields() throws Exception { - Configuration testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getIdentificationHeaderFields(); - } - - - @Test - public void testSetIdentificationHeaderFields() throws Exception { - Configuration testSubject; - List<String> identificationHeaderFields = null; - - // default test - testSubject = createTestSubject(); - testSubject.setIdentificationHeaderFields(identificationHeaderFields); - } - - - @Test - public void testGetReleased() throws Exception { - Configuration testSubject; - Date result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getReleased(); - } - - - @Test - public void testGetVersion() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVersion(); - } - - - @Test - public void testSetReleased() throws Exception { - Configuration testSubject; - Date released = null; - - // default test - testSubject = createTestSubject(); - testSubject.setReleased(released); - } - - - @Test - public void testSetVersion() throws Exception { - Configuration testSubject; - String version = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVersion(version); - } - - - @Test - public void testGetProtocols() throws Exception { - Configuration testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProtocols(); - } - - - @Test - public void testSetProtocols() throws Exception { - Configuration testSubject; - List<String> protocols = null; - - // default test - testSubject = createTestSubject(); - testSubject.setProtocols(protocols); - } - - - @Test - public void testGetUsers() throws Exception { - Configuration testSubject; - Map<String, String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUsers(); - } - - - @Test - public void testSetUsers() throws Exception { - Configuration testSubject; - Map<String, String> users = null; - - // default test - testSubject = createTestSubject(); - testSubject.setUsers(users); - } - - - @Test - public void testGetBeFqdn() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getBeFqdn(); - } - - - @Test - public void testSetBeFqdn() throws Exception { - Configuration testSubject; - String beHost = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setBeFqdn(beHost); - } - - - @Test - public void testGetBeHttpPort() throws Exception { - Configuration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getBeHttpPort(); - } - - - @Test - public void testSetBeHttpPort() throws Exception { - Configuration testSubject; - Integer beHttpPort = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setBeHttpPort(beHttpPort); - } - - - @Test - public void testGetBeSslPort() throws Exception { - Configuration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getBeSslPort(); - } - - - @Test - public void testSetBeSslPort() throws Exception { - Configuration testSubject; - Integer beSslPort = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setBeSslPort(beSslPort); - } - - - @Test - public void testGetBeContext() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getBeContext(); - } - - - @Test - public void testSetBeContext() throws Exception { - Configuration testSubject; - String beContext = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setBeContext(beContext); - } - - - @Test - public void testGetBeProtocol() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getBeProtocol(); - } - - - @Test - public void testSetBeProtocol() throws Exception { - Configuration testSubject; - String beProtocol = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setBeProtocol(beProtocol); - } - - - @Test - public void testGetNeo4j() throws Exception { - Configuration testSubject; - Map<String, Object> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getNeo4j(); - } - - - @Test - public void testSetNeo4j() throws Exception { - Configuration testSubject; - Map<String, Object> neo4j = null; - - // default test - testSubject = createTestSubject(); - testSubject.setNeo4j(neo4j); - } - - - @Test - public void testGetElasticSearch() throws Exception { - Configuration testSubject; - ElasticSearchConfig result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getElasticSearch(); - } - - - @Test - public void testSetElasticSearch() throws Exception { - Configuration testSubject; - ElasticSearchConfig elasticSearch = null; - - // default test - testSubject = createTestSubject(); - testSubject.setElasticSearch(elasticSearch); - } - - - @Test - public void testGetTitanCfgFile() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTitanCfgFile(); - } - - - @Test - public void testSetTitanCfgFile() throws Exception { - Configuration testSubject; - String titanCfgFile = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setTitanCfgFile(titanCfgFile); - } - - - @Test - public void testGetTitanMigrationKeySpaceCfgFile() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTitanMigrationKeySpaceCfgFile(); - } - - - @Test - public void testSetTitanMigrationKeySpaceCfgFile() throws Exception { - Configuration testSubject; - String titanMigrationKeySpaceCfgFile = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setTitanMigrationKeySpaceCfgFile(titanMigrationKeySpaceCfgFile); - } - - - @Test - public void testGetTitanInMemoryGraph() throws Exception { - Configuration testSubject; - Boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTitanInMemoryGraph(); - } - - - @Test - public void testSetTitanInMemoryGraph() throws Exception { - Configuration testSubject; - Boolean titanInMemoryGraph = null; - - // default test - testSubject = createTestSubject(); - testSubject.setTitanInMemoryGraph(titanInMemoryGraph); - } - - - @Test - public void testGetStartMigrationFrom() throws Exception { - Configuration testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getStartMigrationFrom(); - } - - - @Test - public void testSetStartMigrationFrom() throws Exception { - Configuration testSubject; - int startMigrationFrom = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setStartMigrationFrom(startMigrationFrom); - } - - - @Test - public void testGetTitanLockTimeout() throws Exception { - Configuration testSubject; - Long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTitanLockTimeout(); - } - - - @Test - public void testSetTitanLockTimeout() throws Exception { - Configuration testSubject; - Long titanLockTimeout = null; - - // default test - testSubject = createTestSubject(); - testSubject.setTitanLockTimeout(titanLockTimeout); - } - - - @Test - public void testGetTitanHealthCheckReadTimeout() throws Exception { - Configuration testSubject; - Long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTitanHealthCheckReadTimeout(); - } - - - - - @Test - public void testSetTitanHealthCheckReadTimeout() throws Exception { - Configuration testSubject; - Long titanHealthCheckReadTimeout = null; - - // default test - testSubject = createTestSubject(); - testSubject.setTitanHealthCheckReadTimeout(titanHealthCheckReadTimeout); - } - - - @Test - public void testGetTitanReconnectIntervalInSeconds() throws Exception { - Configuration testSubject; - Long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTitanReconnectIntervalInSeconds(); - } - - - - - @Test - public void testSetTitanReconnectIntervalInSeconds() throws Exception { - Configuration testSubject; - Long titanReconnectIntervalInSeconds = null; - - // default test - testSubject = createTestSubject(); - testSubject.setTitanReconnectIntervalInSeconds(titanReconnectIntervalInSeconds); - } - - - @Test - public void testGetEsReconnectIntervalInSeconds() throws Exception { - Configuration testSubject; - Long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getEsReconnectIntervalInSeconds(); - } - - - - - @Test - public void testSetEsReconnectIntervalInSeconds() throws Exception { - Configuration testSubject; - Long esReconnectIntervalInSeconds = null; - - // default test - testSubject = createTestSubject(); - testSubject.setEsReconnectIntervalInSeconds(esReconnectIntervalInSeconds); - } - - - @Test - public void testGetArtifactTypes() throws Exception { - Configuration testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactTypes(); - } - - - @Test - public void testSetArtifactTypes() throws Exception { - Configuration testSubject; - List<String> artifactTypes = null; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactTypes(artifactTypes); - } - - - @Test - public void testGetExcludeResourceCategory() throws Exception { - Configuration testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getExcludeResourceCategory(); - } - - - @Test - public void testSetExcludeResourceCategory() throws Exception { - Configuration testSubject; - List<String> excludeResourceCategory = null; - - // default test - testSubject = createTestSubject(); - testSubject.setExcludeResourceCategory(excludeResourceCategory); - } - - - @Test - public void testGetExcludeResourceType() throws Exception { - Configuration testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getExcludeResourceType(); - } - - - @Test - public void testSetExcludeResourceType() throws Exception { - Configuration testSubject; - List<String> excludeResourceType = null; - - // default test - testSubject = createTestSubject(); - testSubject.setExcludeResourceType(excludeResourceType); - } - - - @Test - public void testGetToscaArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaArtifacts(); - } - - - @Test - public void testSetToscaArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> toscaArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setToscaArtifacts(toscaArtifacts); - } - - - @Test - public void testGetInformationalResourceArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInformationalResourceArtifacts(); - } - - - @Test - public void testSetInformationalResourceArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> informationalResourceArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInformationalResourceArtifacts(informationalResourceArtifacts); - } - - - @Test - public void testGetInformationalServiceArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInformationalServiceArtifacts(); - } - - - @Test - public void testSetInformationalServiceArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> informationalServiceArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInformationalServiceArtifacts(informationalServiceArtifacts); - } - - - @Test - public void testGetServiceApiArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceApiArtifacts(); - } - - - @Test - public void testSetServiceApiArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> serviceApiArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceApiArtifacts(serviceApiArtifacts); - } - - - @Test - public void testGetServiceDeploymentArtifacts() throws Exception { - Configuration testSubject; - Map<String, ArtifactTypeConfig> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceDeploymentArtifacts(); - } - - - @Test - public void testSetServiceDeploymentArtifacts() throws Exception { - Configuration testSubject; - Map<String, ArtifactTypeConfig> serviceDeploymentArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceDeploymentArtifacts(serviceDeploymentArtifacts); - } - - - @Test - public void testGetResourceDeploymentArtifacts() throws Exception { - Configuration testSubject; - Map<String, ArtifactTypeConfig> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceDeploymentArtifacts(); - } - - - @Test - public void testSetResourceDeploymentArtifacts() throws Exception { - Configuration testSubject; - Map<String, ArtifactTypeConfig> resourceDeploymentArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceDeploymentArtifacts(resourceDeploymentArtifacts); - } - - - @Test - public void testSetResourceInstanceDeploymentArtifacts() throws Exception { - Configuration testSubject; - Map<String, ArtifactTypeConfig> resourceInstanceDeploymentArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceInstanceDeploymentArtifacts(resourceInstanceDeploymentArtifacts); - } - - - @Test - public void testGetResourceInstanceDeploymentArtifacts() throws Exception { - Configuration testSubject; - Map<String, ArtifactTypeConfig> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceInstanceDeploymentArtifacts(); - } - - - @Test - public void testGetExcludeServiceCategory() throws Exception { - Configuration testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getExcludeServiceCategory(); - } - - - @Test - public void testSetExcludeServiceCategory() throws Exception { - Configuration testSubject; - List<String> excludeServiceCategory = null; - - // default test - testSubject = createTestSubject(); - testSubject.setExcludeServiceCategory(excludeServiceCategory); - } - - - @Test - public void testGetLicenseTypes() throws Exception { - Configuration testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLicenseTypes(); - } - - - @Test - public void testSetLicenseTypes() throws Exception { - Configuration testSubject; - List<String> licenseTypes = null; - - // default test - testSubject = createTestSubject(); - testSubject.setLicenseTypes(licenseTypes); - } - - - @Test - public void testGetAdditionalInformationMaxNumberOfKeys() throws Exception { - Configuration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalInformationMaxNumberOfKeys(); - } - - - @Test - public void testSetAdditionalInformationMaxNumberOfKeys() throws Exception { - Configuration testSubject; - Integer additionalInformationMaxNumberOfKeys = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalInformationMaxNumberOfKeys(additionalInformationMaxNumberOfKeys); - } - - - @Test - public void testGetSystemMonitoring() throws Exception { - Configuration testSubject; - BeMonitoringConfig result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSystemMonitoring(); - } - - - @Test - public void testSetSystemMonitoring() throws Exception { - Configuration testSubject; - BeMonitoringConfig systemMonitoring = null; - - // default test - testSubject = createTestSubject(); - testSubject.setSystemMonitoring(systemMonitoring); - } - - - @Test - public void testGetDefaultHeatArtifactTimeoutMinutes() throws Exception { - Configuration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDefaultHeatArtifactTimeoutMinutes(); - } - - - @Test - public void testSetDefaultHeatArtifactTimeoutMinutes() throws Exception { - Configuration testSubject; - Integer defaultHeatArtifactTimeoutMinutes = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setDefaultHeatArtifactTimeoutMinutes(defaultHeatArtifactTimeoutMinutes); - } - - - @Test - public void testGetUebHealthCheckReconnectIntervalInSeconds() throws Exception { - Configuration testSubject; - Long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUebHealthCheckReconnectIntervalInSeconds(); - } - - - @Test - public void testSetUebHealthCheckReconnectIntervalInSeconds() throws Exception { - Configuration testSubject; - Long uebHealthCheckReconnectIntervalInSeconds = null; - - // default test - testSubject = createTestSubject(); - testSubject.setUebHealthCheckReconnectIntervalInSeconds(uebHealthCheckReconnectIntervalInSeconds); - } - - - @Test - public void testGetUebHealthCheckReadTimeout() throws Exception { - Configuration testSubject; - Long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUebHealthCheckReadTimeout(); - } - - - @Test - public void testSetUebHealthCheckReadTimeout() throws Exception { - Configuration testSubject; - Long uebHealthCheckReadTimeout = null; - - // default test - testSubject = createTestSubject(); - testSubject.setUebHealthCheckReadTimeout(uebHealthCheckReadTimeout); - } - - - @Test - public void testGetCleanComponentsConfiguration() throws Exception { - Configuration testSubject; - CleanComponentsConfiguration result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCleanComponentsConfiguration(); - } - - - @Test - public void testSetCleanComponentsConfiguration() throws Exception { - Configuration testSubject; - CleanComponentsConfiguration cleanComponentsConfiguration = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCleanComponentsConfiguration(cleanComponentsConfiguration); - } - - - @Test - public void testToString() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - - @Test - public void testGetUnLoggedUrls() throws Exception { - Configuration testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUnLoggedUrls(); - } - - - @Test - public void testSetUnLoggedUrls() throws Exception { - Configuration testSubject; - List<String> unLoggedUrls = null; - - // default test - testSubject = createTestSubject(); - testSubject.setUnLoggedUrls(unLoggedUrls); - } - - - @Test - public void testGetDeploymentResourceArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDeploymentResourceArtifacts(); - } - - - @Test - public void testSetDeploymentResourceArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> deploymentResourceArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDeploymentResourceArtifacts(deploymentResourceArtifacts); - } - - - @Test - public void testGetHeatEnvArtifactHeader() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHeatEnvArtifactHeader(); - } - - - @Test - public void testSetHeatEnvArtifactHeader() throws Exception { - Configuration testSubject; - String heatEnvArtifactHeader = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setHeatEnvArtifactHeader(heatEnvArtifactHeader); - } - - - @Test - public void testGetHeatEnvArtifactFooter() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHeatEnvArtifactFooter(); - } - - - @Test - public void testSetHeatEnvArtifactFooter() throws Exception { - Configuration testSubject; - String heatEnvArtifactFooter = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setHeatEnvArtifactFooter(heatEnvArtifactFooter); - } - - - @Test - public void testGetDeploymentResourceInstanceArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDeploymentResourceInstanceArtifacts(); - } - - - @Test - public void testSetDeploymentResourceInstanceArtifacts() throws Exception { - Configuration testSubject; - Map<String, Object> deploymentResourceInstanceArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDeploymentResourceInstanceArtifacts(deploymentResourceInstanceArtifacts); - } - - - @Test - public void testGetArtifactsIndex() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactsIndex(); - } - - - @Test - public void testSetArtifactsIndex() throws Exception { - Configuration testSubject; - String artifactsIndex = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactsIndex(artifactsIndex); - } - - - @Test - public void testGetResourceInformationalDeployedArtifacts() throws Exception { - Configuration testSubject; - Map<String, ArtifactTypeConfig> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceInformationalDeployedArtifacts(); - } - - - @Test - public void testSetResourceInformationalDeployedArtifacts() throws Exception { - Configuration testSubject; - Map<String, ArtifactTypeConfig> resourceInformationalDeployedArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceInformationalDeployedArtifacts(resourceInformationalDeployedArtifacts); - } - - - @Test - public void testGetResourceTypes() throws Exception { - Configuration testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceTypes(); - } - - - @Test - public void testSetResourceTypes() throws Exception { - Configuration testSubject; - List<String> resourceTypes = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceTypes(resourceTypes); - } - - - @Test - public void testGetToscaFilesDir() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaFilesDir(); - } - - - @Test - public void testSetToscaFilesDir() throws Exception { - Configuration testSubject; - String toscaFilesDir = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setToscaFilesDir(toscaFilesDir); - } - - - @Test - public void testGetHeatTranslatorPath() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHeatTranslatorPath(); - } - - - @Test - public void testSetHeatTranslatorPath() throws Exception { - Configuration testSubject; - String heatTranslatorPath = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setHeatTranslatorPath(heatTranslatorPath); - } - - - @Test - public void testGetRequirementsToFulfillBeforeCert() throws Exception { - Configuration testSubject; - Map<String, Set<String>> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRequirementsToFulfillBeforeCert(); - } - - - @Test - public void testSetRequirementsToFulfillBeforeCert() throws Exception { - Configuration testSubject; - Map<String, Set<String>> requirementsToFulfillBeforeCert = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRequirementsToFulfillBeforeCert(requirementsToFulfillBeforeCert); - } - - - @Test - public void testGetCapabilitiesToConsumeBeforeCert() throws Exception { - Configuration testSubject; - Map<String, Set<String>> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCapabilitiesToConsumeBeforeCert(); - } - - - @Test - public void testSetCapabilitiesToConsumeBeforeCert() throws Exception { - Configuration testSubject; - Map<String, Set<String>> capabilitiesToConsumeBeforeCert = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCapabilitiesToConsumeBeforeCert(capabilitiesToConsumeBeforeCert); - } - - - @Test - public void testGetOnboarding() throws Exception { - Configuration testSubject; - OnboardingConfig result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getOnboarding(); - } - - - @Test - public void testSetOnboarding() throws Exception { - Configuration testSubject; - OnboardingConfig onboarding = null; - - // default test - testSubject = createTestSubject(); - testSubject.setOnboarding(onboarding); - } - - - @Test - public void testGetEcompPortal() throws Exception { - Configuration testSubject; - EcompPortalConfig result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getEcompPortal(); - } - - - @Test - public void testSetEcompPortal() throws Exception { - Configuration testSubject; - EcompPortalConfig ecompPortal = null; - - // default test - testSubject = createTestSubject(); - testSubject.setEcompPortal(ecompPortal); - } - - - @Test - public void testGetToscaValidators() throws Exception { - Configuration testSubject; - ToscaValidatorsConfig result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaValidators(); - } - - - @Test - public void testSetToscaValidators() throws Exception { - Configuration testSubject; - ToscaValidatorsConfig toscaValidators = null; - - // default test - testSubject = createTestSubject(); - testSubject.setToscaValidators(toscaValidators); - } - - - @Test - public void testIsDisableAudit() throws Exception { - Configuration testSubject; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isDisableAudit(); - } - - - @Test - public void testSetDisableAudit() throws Exception { - Configuration testSubject; - boolean enableAudit = false; - - // default test - testSubject = createTestSubject(); - testSubject.setDisableAudit(enableAudit); - } - - - @Test - public void testGetResourceInformationalArtifacts() throws Exception { - Configuration testSubject; - Map<String, ArtifactTypeConfig> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResourceInformationalArtifacts(); - } - - - @Test - public void testSetResourceInformationalArtifacts() throws Exception { - Configuration testSubject; - Map<String, ArtifactTypeConfig> resourceInformationalArtifacts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResourceInformationalArtifacts(resourceInformationalArtifacts); - } - - - @Test - public void testGetVfModuleProperties() throws Exception { - Configuration testSubject; - Map<String, VfModuleProperty> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVfModuleProperties(); - } - - - @Test - public void testSetVfModuleProperties() throws Exception { - Configuration testSubject; - Map<String, VfModuleProperty> vfModuleProperties = null; - - // default test - testSubject = createTestSubject(); - testSubject.setVfModuleProperties(vfModuleProperties); - } - - - @Test - public void testGetToscaConformanceLevel() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getToscaConformanceLevel(); - } - - - @Test - public void testSetToscaConformanceLevel() throws Exception { - Configuration testSubject; - String toscaConformanceLevel = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setToscaConformanceLevel(toscaConformanceLevel); - } - - - @Test - public void testGetMinToscaConformanceLevel() throws Exception { - Configuration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMinToscaConformanceLevel(); - } - - - @Test - public void testSetMinToscaConformanceLevel() throws Exception { - Configuration testSubject; - String toscaConformanceLevel = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setMinToscaConformanceLevel(toscaConformanceLevel); - } - - - @Test - public void testGetDefaultImports() throws Exception { - Configuration testSubject; - List<Map<String, Map<String, String>>> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDefaultImports(); - } - - - @Test - public void testSetDefaultImports() throws Exception { - Configuration testSubject; - LinkedList<Map<String, Map<String, String>>> defaultImports = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDefaultImports(defaultImports); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/DistributionEngineConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/DistributionEngineConfigurationTest.java index cceedef12c..1f777a73db 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/DistributionEngineConfigurationTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/be/config/DistributionEngineConfigurationTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.config; -import java.util.List; - import org.junit.Test; import org.openecomp.sdc.be.config.DistributionEngineConfiguration.ComponentArtifactTypesConfig; import org.openecomp.sdc.be.config.DistributionEngineConfiguration.CreateTopicConfig; @@ -9,8 +7,7 @@ import org.openecomp.sdc.be.config.DistributionEngineConfiguration.DistributionN import org.openecomp.sdc.be.config.DistributionEngineConfiguration.DistributionStatusTopicConfig; import org.openecomp.sdc.common.http.config.ExternalServiceConfig; -import java.util.*; -import org.junit.Assert; +import java.util.List; public class DistributionEngineConfigurationTest { diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/DmaapConsumerConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/DmaapConsumerConfigurationTest.java index b773be49cc..a4087b34c5 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/DmaapConsumerConfigurationTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/be/config/DmaapConsumerConfigurationTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.config; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.config.DmaapConsumerConfiguration.Credential; diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorConfigurationTest.java deleted file mode 100644 index d9e6066224..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorConfigurationTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.openecomp.sdc.be.config; - -import java.util.Map; - -import org.junit.Test; - - -public class ErrorConfigurationTest { - - private ErrorConfiguration createTestSubject() { - return new ErrorConfiguration(); - } - - - @Test - public void testGetErrors() throws Exception { - ErrorConfiguration testSubject; - Map<String, ErrorInfo> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getErrors(); - } - - - @Test - public void testSetErrors() throws Exception { - ErrorConfiguration testSubject; - Map<String, ErrorInfo> errors = null; - - // default test - testSubject = createTestSubject(); - testSubject.setErrors(errors); - } - - - - - - @Test - public void testToString() throws Exception { - ErrorConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorInfoTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorInfoTest.java deleted file mode 100644 index 4c95543fb9..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorInfoTest.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.openecomp.sdc.be.config; - -import org.junit.Test; -import org.openecomp.sdc.be.config.ErrorInfo.ErrorInfoType; - - -public class ErrorInfoTest { - - private ErrorInfo createTestSubject() { - return new ErrorInfo(); - } - - - @Test - public void testGetCode() throws Exception { - ErrorInfo testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCode(); - } - - - @Test - public void testSetCode() throws Exception { - ErrorInfo testSubject; - Integer code = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setCode(code); - } - - - @Test - public void testGetMessage() throws Exception { - ErrorInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMessage(); - } - - - @Test - public void testSetMessage() throws Exception { - ErrorInfo testSubject; - String message = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setMessage(message); - } - - - @Test - public void testGetMessageId() throws Exception { - ErrorInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMessageId(); - } - - - @Test - public void testSetMessageId() throws Exception { - ErrorInfo testSubject; - String messageId = ""; - - // test 1 - testSubject = createTestSubject(); - messageId = null; - testSubject.setMessageId(messageId); - - // test 2 - testSubject = createTestSubject(); - messageId = ""; - testSubject.setMessageId(messageId); - } - - - @Test - public void testGetErrorInfoType() throws Exception { - ErrorInfo testSubject; - ErrorInfoType result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getErrorInfoType(); - } - - - - - @Test - public void testToString() throws Exception { - ErrorInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/Neo4jErrorsConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/Neo4jErrorsConfigurationTest.java deleted file mode 100644 index 6b7b163f45..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/Neo4jErrorsConfigurationTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.openecomp.sdc.be.config; - -import java.util.Map; - -import org.junit.Test; - - -public class Neo4jErrorsConfigurationTest { - - private Neo4jErrorsConfiguration createTestSubject() { - return new Neo4jErrorsConfiguration(); - } - - - @Test - public void testGetErrors() throws Exception { - Neo4jErrorsConfiguration testSubject; - Map<String, String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getErrors(); - } - - - @Test - public void testSetErrors() throws Exception { - Neo4jErrorsConfiguration testSubject; - Map<String, String> errors = null; - - // default test - testSubject = createTestSubject(); - testSubject.setErrors(errors); - } - - - - - - @Test - public void testToString() throws Exception { - Neo4jErrorsConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/validation/DeploymentArtifactHeatConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/validation/DeploymentArtifactHeatConfigurationTest.java deleted file mode 100644 index d2c394bff2..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/validation/DeploymentArtifactHeatConfigurationTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.openecomp.sdc.be.config.validation; - -import java.util.Map; - -import org.junit.Test; - - -public class DeploymentArtifactHeatConfigurationTest { - - private DeploymentArtifactHeatConfiguration createTestSubject() { - return new DeploymentArtifactHeatConfiguration(); - } - - - @Test - public void testGetHeat_template_version() throws Exception { - DeploymentArtifactHeatConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHeat_template_version(); - } - - - @Test - public void testSetHeat_template_version() throws Exception { - DeploymentArtifactHeatConfiguration testSubject; - String heat_template_version = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setHeat_template_version(heat_template_version); - } - - - @Test - public void testGetResources() throws Exception { - DeploymentArtifactHeatConfiguration testSubject; - Map<String, Object> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getResources(); - } - - - @Test - public void testSetResources() throws Exception { - DeploymentArtifactHeatConfiguration testSubject; - Map<String, Object> resources = null; - - // default test - testSubject = createTestSubject(); - testSubject.setResources(resources); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnumTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnumTest.java index 8eab423743..d5013bd315 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnumTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnumTest.java @@ -1,9 +1,9 @@ package org.openecomp.sdc.common.api; -import java.util.List; - import org.junit.Test; +import java.util.List; + public class ArtifactGroupTypeEnumTest { diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactTypeEnumTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactTypeEnumTest.java deleted file mode 100644 index 525080e535..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ArtifactTypeEnumTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.openecomp.sdc.common.api; - -import java.util.List; - -import org.junit.Test; - - -public class ArtifactTypeEnumTest { - - private ArtifactTypeEnum createTestSubject() { - return ArtifactTypeEnum.AAI_SERVICE_MODEL; - } - - - @Test - public void testGetType() throws Exception { - ArtifactTypeEnum testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getType(); - } - - - @Test - public void testSetType() throws Exception { - ArtifactTypeEnum testSubject; - String type = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setType(type); - } - - - @Test - public void testFindType() throws Exception { - String type = ""; - ArtifactTypeEnum result; - - // default test - result = ArtifactTypeEnum.findType(type); - } - - - @Test - public void testGetAllTypes() throws Exception { - List<String> result; - - // default test - result = ArtifactTypeEnum.getAllTypes(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ConfigurationListenerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/api/ConfigurationListenerTest.java index bdfedd89cf..e381ff613d 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ConfigurationListenerTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/api/ConfigurationListenerTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.api; -import javax.annotation.Generated; - import org.junit.Test; public class ConfigurationListenerTest { diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/api/HealthCheckInfoTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/api/HealthCheckInfoTest.java index 0da2aa3271..c06273eee9 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/api/HealthCheckInfoTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/api/HealthCheckInfoTest.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.common.api; -import java.util.List; - import org.junit.Test; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; +import java.util.List; + public class HealthCheckInfoTest { private HealthCheckInfo createTestSubject() { diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ResponseInfoTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/api/ResponseInfoTest.java deleted file mode 100644 index d05484db40..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ResponseInfoTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.openecomp.sdc.common.api; - -import org.junit.Test; -import org.openecomp.sdc.common.api.ResponseInfo.ResponseStatusEnum; - - -public class ResponseInfoTest { - - private ResponseInfo createTestSubject() { - return new ResponseInfo(null, ""); - } - - - @Test - public void testGetApplicativeStatus() throws Exception { - ResponseInfo testSubject; - ResponseStatusEnum result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getApplicativeStatus(); - } - - - @Test - public void testSetApplicativeStatus() throws Exception { - ResponseInfo testSubject; - ResponseStatusEnum applicativeStatus = null; - - // default test - testSubject = createTestSubject(); - testSubject.setApplicativeStatus(applicativeStatus); - } - - - @Test - public void testGetDescription() throws Exception { - ResponseInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDescription(); - } - - - @Test - public void testSetDescription() throws Exception { - ResponseInfo testSubject; - String description = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDescription(description); - } - - - -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ToscaNodeTypeInfoTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/api/ToscaNodeTypeInfoTest.java deleted file mode 100644 index 42b057e521..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ToscaNodeTypeInfoTest.java +++ /dev/null @@ -1,134 +0,0 @@ -package org.openecomp.sdc.common.api; - -import java.util.List; - -import org.junit.Test; - - -public class ToscaNodeTypeInfoTest { - - private ToscaNodeTypeInfo createTestSubject() { - return new ToscaNodeTypeInfo(); - } - - - @Test - public void testGetTemplateName() throws Exception { - ToscaNodeTypeInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTemplateName(); - } - - - @Test - public void testSetTemplateName() throws Exception { - ToscaNodeTypeInfo testSubject; - String templateName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setTemplateName(templateName); - } - - - @Test - public void testGetNodeName() throws Exception { - ToscaNodeTypeInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getNodeName(); - } - - - @Test - public void testSetNodeName() throws Exception { - ToscaNodeTypeInfo testSubject; - String nodeName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setNodeName(nodeName); - } - - - @Test - public void testGetTemplateVersion() throws Exception { - ToscaNodeTypeInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTemplateVersion(); - } - - - @Test - public void testSetTemplateVersion() throws Exception { - ToscaNodeTypeInfo testSubject; - String templateVersion = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setTemplateVersion(templateVersion); - } - - - @Test - public void testGetInterfaces() throws Exception { - ToscaNodeTypeInfo testSubject; - List<ToscaNodeTypeInterface> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getInterfaces(); - } - - - @Test - public void testSetInterfaces() throws Exception { - ToscaNodeTypeInfo testSubject; - List<ToscaNodeTypeInterface> interfaces = null; - - // default test - testSubject = createTestSubject(); - testSubject.setInterfaces(interfaces); - } - - - @Test - public void testGetIconPath() throws Exception { - ToscaNodeTypeInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getIconPath(); - } - - - @Test - public void testSetIconPath() throws Exception { - ToscaNodeTypeInfo testSubject; - String iconPath = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setIconPath(iconPath); - } - - - @Test - public void testToString() throws Exception { - ToscaNodeTypeInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ToscaNodeTypeInterfaceTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/api/ToscaNodeTypeInterfaceTest.java deleted file mode 100644 index 9c19d3132d..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/api/ToscaNodeTypeInterfaceTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.openecomp.sdc.common.api; - -import java.util.List; - -import org.junit.Test; - - -public class ToscaNodeTypeInterfaceTest { - - private ToscaNodeTypeInterface createTestSubject() { - return new ToscaNodeTypeInterface(); - } - - - @Test - public void testGetScripts() throws Exception { - ToscaNodeTypeInterface testSubject; - List<String> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getScripts(); - } - - - @Test - public void testSetScripts() throws Exception { - ToscaNodeTypeInterface testSubject; - List<String> scripts = null; - - // default test - testSubject = createTestSubject(); - testSubject.setScripts(scripts); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/api/UploadArtifactInfoTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/api/UploadArtifactInfoTest.java index 9df5fad7ba..6b3c23bd71 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/api/UploadArtifactInfoTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/api/UploadArtifactInfoTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.api; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/api/YamlSuffixEnumTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/api/YamlSuffixEnumTest.java deleted file mode 100644 index aeea08999f..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/api/YamlSuffixEnumTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.openecomp.sdc.common.api; - -import java.util.List; - -import org.junit.Test; - - -public class YamlSuffixEnumTest { - - private YamlSuffixEnum createTestSubject() { - return YamlSuffixEnum.YAML; - } - - - @Test - public void testGetSuffix() throws Exception { - YamlSuffixEnum testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSuffix(); - } - - - @Test - public void testSetSuufix() throws Exception { - YamlSuffixEnum testSubject; - String suffix = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setSuufix(suffix); - } - - - @Test - public void testGetSuffixes() throws Exception { - List<String> result; - - // default test - result = YamlSuffixEnum.getSuffixes(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/config/EcompErrorConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/config/EcompErrorConfigurationTest.java index 7ebe341b9c..60e088ecbb 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/config/EcompErrorConfigurationTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/config/EcompErrorConfigurationTest.java @@ -1,12 +1,9 @@ package org.openecomp.sdc.common.config; -import java.util.Map; - -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; +import java.util.Map; + public class EcompErrorConfigurationTest { diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/config/EcompErrorInfoTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/config/EcompErrorInfoTest.java index 65fc197e62..c5ef7cbff9 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/config/EcompErrorInfoTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/config/EcompErrorInfoTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.config; -import javax.annotation.Generated; - import org.junit.Test; public class EcompErrorInfoTest { diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsvTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsvTest.java index bdcbca016d..8bd503de3b 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsvTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsvTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.config.generation; -import javax.annotation.Generated; - import org.junit.Test; public class GenerateEcompErrorsCsvTest { diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKeysEnumTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKeysEnumTest.java deleted file mode 100644 index ec55db5c95..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKeysEnumTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.openecomp.sdc.common.datastructure; - -import org.junit.Test; - - -public class AuditingFieldsKeysEnumTest { - - private AuditingFieldsKeysEnum createTestSubject() { - return AuditingFieldsKeysEnum.AUDIT_ACTION; - } - - - @Test - public void testGetValueClass() throws Exception { - AuditingFieldsKeysEnum testSubject; - Class<?> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getValueClass(); - } - - - @Test - public void testGetDisplayName() throws Exception { - AuditingFieldsKeysEnum testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDisplayName(); - } - - - @Test - public void testSetDisplayName() throws Exception { - AuditingFieldsKeysEnum testSubject; - String displayName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDisplayName(displayName); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/ESTimeBasedEventTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/ESTimeBasedEventTest.java deleted file mode 100644 index 4d5d97b7fa..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/ESTimeBasedEventTest.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.openecomp.sdc.common.datastructure; - -import java.util.Map; - -import org.junit.Test; - - -public class ESTimeBasedEventTest { - - private ESTimeBasedEvent createTestSubject() { - return new ESTimeBasedEvent(); - } - - - - - @Test - public void testCalculateYearIndexSuffix() throws Exception { - ESTimeBasedEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.calculateYearIndexSuffix(); - } - - - @Test - public void testCalculateMonthIndexSuffix() throws Exception { - ESTimeBasedEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.calculateMonthIndexSuffix(); - } - - - @Test - public void testCalculateDayIndexSuffix() throws Exception { - ESTimeBasedEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.calculateDayIndexSuffix(); - } - - - @Test - public void testCalculateHourIndexSuffix() throws Exception { - ESTimeBasedEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.calculateHourIndexSuffix(); - } - - - @Test - public void testCalculateMinuteIndexSuffix() throws Exception { - ESTimeBasedEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.calculateMinuteIndexSuffix(); - } - - - - - - @Test - public void testGetTimestamp() throws Exception { - ESTimeBasedEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTimestamp(); - } - - - @Test - public void testSetTimestamp() throws Exception { - ESTimeBasedEvent testSubject; - String timestamp = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setTimestamp(timestamp); - } - - - @Test - public void testGetFields() throws Exception { - ESTimeBasedEvent testSubject; - Map<String, Object> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getFields(); - } - - - @Test - public void testSetFields() throws Exception { - ESTimeBasedEvent testSubject; - Map<String, Object> fields = null; - - // default test - testSubject = createTestSubject(); - testSubject.setFields(fields); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/MonitoringFieldsKeysEnumTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/MonitoringFieldsKeysEnumTest.java deleted file mode 100644 index 515ee0bb76..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/MonitoringFieldsKeysEnumTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.openecomp.sdc.common.datastructure; - -import org.junit.Test; - - -public class MonitoringFieldsKeysEnumTest { - - private MonitoringFieldsKeysEnum createTestSubject() { - return MonitoringFieldsKeysEnum.MONITORING_APP_ID; - } - - - @Test - public void testGetValueClass() throws Exception { - MonitoringFieldsKeysEnum testSubject; - Class<?> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getValueClass(); - } - - - @Test - public void testGetDisplayName() throws Exception { - MonitoringFieldsKeysEnum testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDisplayName(); - } - - - @Test - public void testSetDisplayName() throws Exception { - MonitoringFieldsKeysEnum testSubject; - String displayName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDisplayName(displayName); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/WrapperTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/WrapperTest.java deleted file mode 100644 index 9c18861d40..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/WrapperTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.openecomp.sdc.common.datastructure; - -import org.junit.Test; - - -public class WrapperTest { - - private Wrapper createTestSubject() { - return new Wrapper(null); - } - - - - - @Test - public void testIsEmpty() throws Exception { - Wrapper testSubject; - boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isEmpty(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/ecomplog/EcompLoggerMetricTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/ecomplog/EcompLoggerMetricTest.java deleted file mode 100644 index e3efad46ed..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/ecomplog/EcompLoggerMetricTest.java +++ /dev/null @@ -1,316 +0,0 @@ -package org.openecomp.sdc.common.ecomplog; - -import org.junit.Test; -import org.openecomp.sdc.common.ecomplog.Enums.Severity; -import org.openecomp.sdc.common.ecomplog.api.IEcompMdcWrapper; - -public class EcompLoggerMetricTest { - - private EcompLoggerMetric createTestSubject() { - return new EcompLoggerMetric(new EcompMDCWrapper(new Stopwatch())); - } - - - @Test - public void testGetInstance() throws Exception { - EcompLoggerMetric result; - - // default test - result = EcompLoggerMetric.getInstance(); - } - - - @Test - public void testStartTimer() throws Exception { - EcompLoggerMetric testSubject; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.startTimer(); - } - - - @Test - public void testSetKeyRequestId() throws Exception { - EcompLoggerMetric testSubject; - String keyRequestId = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setKeyRequestId(keyRequestId); - } - - - @Test - public void testStopTimer() throws Exception { - EcompLoggerMetric testSubject; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.stopTimer(); - } - - - @Test - public void testSetAutoServerFQDN() throws Exception { - EcompLoggerMetric testSubject; - String serverFQDN = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setAutoServerFQDN(serverFQDN); - } - - - @Test - public void testSetAutoServerIPAddress() throws Exception { - EcompLoggerMetric testSubject; - String serverIPAddress = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setAutoServerIPAddress(serverIPAddress); - } - - - @Test - public void testSetInstanceUUID() throws Exception { - EcompLoggerMetric testSubject; - String instanceUUID = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setInstanceUUID(instanceUUID); - } - - - @Test - public void testSetOptProcessKey() throws Exception { - EcompLoggerMetric testSubject; - String processKey = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setOptProcessKey(processKey); - } - - - @Test - public void testSetOptAlertSeverity() throws Exception { - EcompLoggerMetric testSubject; - Severity alertSeverity = null; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setOptAlertSeverity(alertSeverity.OK); - } - - - @Test - public void testSetOptCustomField1() throws Exception { - EcompLoggerMetric testSubject; - String customField1 = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setOptCustomField1(customField1); - } - - - @Test - public void testSetOptCustomField2() throws Exception { - EcompLoggerMetric testSubject; - String customField2 = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setOptCustomField2(customField2); - } - - - @Test - public void testSetOptCustomField3() throws Exception { - EcompLoggerMetric testSubject; - String customField3 = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setOptCustomField3(customField3); - } - - - @Test - public void testSetOptCustomField4() throws Exception { - EcompLoggerMetric testSubject; - String customField4 = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setOptCustomField4(customField4); - } - - - @Test - public void testSetRemoteHost() throws Exception { - EcompLoggerMetric testSubject; - String remoteHost = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setRemoteHost(remoteHost); - } - - - @Test - public void testSetServiceName() throws Exception { - EcompLoggerMetric testSubject; - String serviceName = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setServiceName(serviceName); - } - - - @Test - public void testSetStatusCode() throws Exception { - EcompLoggerMetric testSubject; - String statusCode = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setStatusCode(statusCode); - } - - - @Test - public void testSetPartnerName() throws Exception { - EcompLoggerMetric testSubject; - String partnerName = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setPartnerName(partnerName); - } - - - @Test - public void testSetResponseCode() throws Exception { - EcompLoggerMetric testSubject; - int responseCode = 0; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setResponseCode(responseCode); - } - - - @Test - public void testSetResponseDesc() throws Exception { - EcompLoggerMetric testSubject; - String responseDesc = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setResponseDesc(responseDesc); - } - - - @Test - public void testSetOptServiceInstanceId() throws Exception { - EcompLoggerMetric testSubject; - String serviceInstanceId = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setOptServiceInstanceId(serviceInstanceId); - } - - - @Test - public void testSetOptClassName() throws Exception { - EcompLoggerMetric testSubject; - String className = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setOptClassName(className); - } - - - @Test - public void testSetTargetEntity() throws Exception { - EcompLoggerMetric testSubject; - String targetEntity = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setTargetEntity(targetEntity); - } - - - @Test - public void testSetTargetServiceName() throws Exception { - EcompLoggerMetric testSubject; - String targetServiceName = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setTargetServiceName(targetServiceName); - } - - - @Test - public void testSetTargetVirtualEntity() throws Exception { - EcompLoggerMetric testSubject; - String targetVirtualEntity = ""; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.setTargetVirtualEntity(targetVirtualEntity); - } - - - @Test - public void testClear() throws Exception { - EcompLoggerMetric testSubject; - EcompLoggerMetric result; - - // default test - testSubject = createTestSubject(); - result = testSubject.clear(); - } - - - @Test - public void testInitializeMandatoryFields() throws Exception { - EcompLoggerMetric testSubject; - - // default test - testSubject = createTestSubject(); - testSubject.initializeMandatoryFields(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/http/config/TimeoutsTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/http/config/TimeoutsTest.java index d7b14f64ee..385b69b17f 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/http/config/TimeoutsTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/http/config/TimeoutsTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.http.config; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/kpi/api/ASDCKpiApiTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/kpi/api/ASDCKpiApiTest.java deleted file mode 100644 index 3ff24f2b07..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/kpi/api/ASDCKpiApiTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.openecomp.sdc.common.kpi.api; - -import org.junit.Test; - - -public class ASDCKpiApiTest { - - private ASDCKpiApi createTestSubject() { - return new ASDCKpiApi(); - } - - - @Test - public void testCountImportResourcesKPI() throws Exception { - - // default test - ASDCKpiApi.countImportResourcesKPI(); - } - - - @Test - public void testCountCreatedResourcesKPI() throws Exception { - - // default test - ASDCKpiApi.countCreatedResourcesKPI(); - } - - - @Test - public void testCountCreatedServicesKPI() throws Exception { - - // default test - ASDCKpiApi.countCreatedServicesKPI(); - } - - - @Test - public void testCountUsersAuthorizations() throws Exception { - - // default test - ASDCKpiApi.countUsersAuthorizations(); - } - - - @Test - public void testCountActivatedDistribution() throws Exception { - - // default test - ASDCKpiApi.countActivatedDistribution(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/listener/AppContextListenerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/listener/AppContextListenerTest.java deleted file mode 100644 index 298f6fe85d..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/listener/AppContextListenerTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.openecomp.sdc.common.listener; - -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; - -import org.junit.Test; - - -public class AppContextListenerTest { - - private AppContextListener createTestSubject() { - return new AppContextListener(); - } - - - - - - @Test - public void testContextDestroyed() throws Exception { - AppContextListener testSubject; - ServletContextEvent context = null; - - // default test - testSubject = createTestSubject(); - testSubject.contextDestroyed(context); - } - - - - -// @Test - public void testGetManifestInfo() throws Exception { - ServletContext application = null; - Map<String, String> result; - - // default test - result = AppContextListener.getManifestInfo(application); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandlerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandlerTest.java new file mode 100644 index 0000000000..155ea4fb0b --- /dev/null +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandlerTest.java @@ -0,0 +1,99 @@ +/*- + * ============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========================================================= + */ + +package org.openecomp.sdc.common.log.elements; + +import org.junit.Before; +import org.junit.Test; +import org.slf4j.MDC; + +import static org.junit.Assert.*; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.*; + +public class LogFieldsMdcHandlerTest { + + private LogFieldsMdcHandler ecompMdcWrapper; + + @Before + public void init(){ + ecompMdcWrapper = new LogFieldsMdcHandler(); + ecompMdcWrapper.clear(); + MDC.clear(); + } + + @Test + public void isMDCParamEmpty_shouldReturnTrue_onNonNullValueInMDC(){ + MDC.put("Key","value1"); + assertFalse(ecompMdcWrapper.isMDCParamEmpty("Key")); + } + @Test + public void isMDCParamEmpty_shouldReturnFalse_onEmptyStringInMDC(){ + MDC.put("Key",""); + assertTrue(ecompMdcWrapper.isMDCParamEmpty("Key")); + } + + @Test + public void isMDCParamEmpty_shouldReturnFalse_onNullValueInMDC(){ + MDC.put("Key",null); + assertTrue(ecompMdcWrapper.isMDCParamEmpty("Key")); + } + + @Test + public void startTimer_shouldFilecompMdcWrappereginTimestampField(){ + ecompMdcWrapper.startMetricTimer(); + assertFalse(ecompMdcWrapper.isMDCParamEmpty(MDC_METRIC_BEGIN_TIMESTAMP)); + } + + @Test + public void stopTimer_shouldFillEndTimestampField_ifStartTimerWasCalledPreviously(){ + ecompMdcWrapper.startAuditTimer(); + ecompMdcWrapper.stopAuditTimer(); + assertFalse(ecompMdcWrapper.isMDCParamEmpty(MDC_END_TIMESTAMP)); + } + + @Test + public void clear_shouldRemoveAllMandatoryAndOptionalFields_And_OnlyThem(){ + ecompMdcWrapper.setClassName("class1"); + ecompMdcWrapper.setPartnerName("partner1"); + ecompMdcWrapper.setOptCustomField1("of1"); + ecompMdcWrapper.clear(); + assertNull(MDC.get(MDC_CLASS_NAME)); + assertNull(MDC.get(MDC_PARTNER_NAME)); + assertNull(MDC.get(MDC_OPT_FIELD1)); + } + + @Test + public void clear_shouldNotThrowAnException_WhenNoFieldWasAssignedAsMandatoryOrOptional(){ + ecompMdcWrapper.setClassName("class1"); + ecompMdcWrapper.setPartnerName("partner1"); + ecompMdcWrapper.setOptCustomField1("of1"); + Exception exp = null; + try { + ecompMdcWrapper.clear(); + } + catch (Exception e) + { + exp =e; + } + assertNull(exp); + } + +} + diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerAsdcUtilTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerAsdcUtilTest.java new file mode 100644 index 0000000000..23c54ce1cc --- /dev/null +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerAsdcUtilTest.java @@ -0,0 +1,170 @@ +package org.openecomp.sdc.common.log.elements; + + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; +import org.openecomp.sdc.common.log.enums.LogLevel; +import org.openecomp.sdc.common.log.enums.Severity; +import org.openecomp.sdc.common.log.wrappers.LoggerSdcAudit; +import org.openecomp.sdc.common.log.wrappers.LoggerSdcUtilBase; + +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.core.UriInfo; +import java.net.URI; +import java.net.URISyntaxException; + +import static java.net.HttpURLConnection.*; +import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; + +/** + * Created by dd4296 on 12/19/2017. + * + * test get partner name + */ +@RunWith(MockitoJUnitRunner.class) +public class LoggerAsdcUtilTest { + + private final String chromeUserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"; + private final String firefoxUserAgent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 Firefox"; + private final String explorerUserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)"; + + private final String testUserId = "ml007"; + private final String urlWithUserName = "/api/v1/user/" + testUserId; + + class SdcEelfAuditTest extends LoggerSdcAudit { + + SdcEelfAuditTest(Class<?> clazz) { + super(clazz); + } + + public String getPartnerName(String userAgent, String userID, String url) { + return super.getPartnerName(userAgent, userID, url); + } + } + + @Mock + private ContainerRequestContext requestContext; + @Mock + UriInfo uriInfo; + + private SdcEelfAuditTest asdcEelfAudit; + + @Before + public void Init () throws URISyntaxException { + asdcEelfAudit = new SdcEelfAuditTest(LoggerAsdcUtilTest.class); + when(requestContext.getHeaderString(anyString())).thenReturn("ab2222"); + when(requestContext.getUriInfo()).thenReturn(uriInfo); + URI uri = new URI("http:/abc.com/getId"); + when(uriInfo.getRequestUri()).thenReturn(uri); + when(uriInfo.getBaseUri()).thenReturn(uri); + + } + + @Test + public void extract_user_id_from_userAgentTest() { + + String userIdChrome = asdcEelfAudit.getPartnerName(chromeUserAgent, "", ""); + assertEquals(userIdChrome.toLowerCase(), "chrome_FE".toLowerCase()); + + String userIdFireFox = asdcEelfAudit.getPartnerName(firefoxUserAgent, "", ""); + assertEquals(userIdFireFox.toLowerCase(), "firefox_FE".toLowerCase()); + + String userIdIE = asdcEelfAudit.getPartnerName(explorerUserAgent, "", ""); + assertEquals(userIdIE.toLowerCase(), "explorer_FE".toLowerCase()); + } + + @Test + public void extract_user_id_from_urlTest() { + + String userId = asdcEelfAudit.getPartnerName("", "", urlWithUserName); + assertEquals(testUserId, userId); + } + + @Test + public void extract_user_id_from_paramTest() { + + String userId = asdcEelfAudit.getPartnerName("", testUserId, ""); + assertEquals(userId, testUserId); + } + + @Test + public void extract_user_id_priorityTest() { + + String userId = asdcEelfAudit.getPartnerName(chromeUserAgent, testUserId, urlWithUserName); + assertEquals(userId, testUserId); + + String userIdUrl = asdcEelfAudit.getPartnerName(chromeUserAgent, "", urlWithUserName); + assertEquals(userIdUrl, testUserId); + + String userIdUserAgent = asdcEelfAudit.getPartnerName(chromeUserAgent, "", ""); + assertEquals(userIdUserAgent.toLowerCase(), "chrome_FE".toLowerCase()); + } + + @Test + public void check_http_error_convert_to_eelf_code() { + class LoggerSdcUtilBaseTest extends LoggerSdcUtilBase { + public EcompLoggerErrorCode convertHttpCodeToErrorCode(int httpResponseCode) { + return super.convertHttpCodeToErrorCode(httpResponseCode); + } + } + + LoggerSdcUtilBaseTest utilBase = new LoggerSdcUtilBaseTest(); + + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_BAD_REQUEST), EcompLoggerErrorCode.AVAILABILITY_TIMEOUTS_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_UNAUTHORIZED), EcompLoggerErrorCode.AVAILABILITY_TIMEOUTS_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_NOT_FOUND), EcompLoggerErrorCode.AVAILABILITY_TIMEOUTS_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_CLIENT_TIMEOUT), EcompLoggerErrorCode.AVAILABILITY_TIMEOUTS_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_GONE), EcompLoggerErrorCode.AVAILABILITY_TIMEOUTS_ERROR); + + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_PAYMENT_REQUIRED), EcompLoggerErrorCode.PERMISSION_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_FORBIDDEN), EcompLoggerErrorCode.PERMISSION_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_BAD_METHOD), EcompLoggerErrorCode.PERMISSION_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_PROXY_AUTH), EcompLoggerErrorCode.PERMISSION_ERROR); + + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_NOT_ACCEPTABLE), EcompLoggerErrorCode.DATA_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_LENGTH_REQUIRED), EcompLoggerErrorCode.DATA_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_PRECON_FAILED), EcompLoggerErrorCode.DATA_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_REQ_TOO_LONG), EcompLoggerErrorCode.DATA_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_ENTITY_TOO_LARGE), EcompLoggerErrorCode.DATA_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_UNSUPPORTED_TYPE), EcompLoggerErrorCode.DATA_ERROR); + + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_CONFLICT), EcompLoggerErrorCode.SCHEMA_ERROR); + + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_OK), EcompLoggerErrorCode.SUCCESS); + + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_INTERNAL_ERROR), EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_NOT_IMPLEMENTED), EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_BAD_GATEWAY), EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_UNAVAILABLE), EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_GATEWAY_TIMEOUT), EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR); + Assert.assertEquals(utilBase.convertHttpCodeToErrorCode(HTTP_VERSION), EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR); + + } + + @Test + public void takenCareOf_shouldBeTrue_ifStartedLogWasCalled(){ + asdcEelfAudit.startLog(requestContext); + assertTrue(asdcEelfAudit.isFlowBeingTakenCare()); + } + + @Test + public void takenCareOf_shouldBeFalse_ifStartedLogWasNoCalled(){ + assertFalse(asdcEelfAudit.isFlowBeingTakenCare()); + } + + @Test + public void takenCareOf_shouldBeFalse_ifStartedLogWasCalleAndLogWasCalledToo(){ + asdcEelfAudit.startLog(requestContext); + + asdcEelfAudit.log(null,null,null, LogLevel.INFO, Severity.OK, "message"); + assertFalse(asdcEelfAudit.isFlowBeingTakenCare()); + } + +} diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerAuditTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerAuditTest.java new file mode 100644 index 0000000000..1cc4024c4a --- /dev/null +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerAuditTest.java @@ -0,0 +1,96 @@ +package org.openecomp.sdc.common.log.elements; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; +import org.openecomp.sdc.common.log.enums.LogLevel; +import org.openecomp.sdc.common.log.enums.Severity; +import org.openecomp.sdc.common.log.enums.StatusCode; +import org.slf4j.Logger; +import org.slf4j.MDC; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.UUID; + +import static org.openecomp.sdc.common.log.api.ILogConfiguration.*; +import static org.openecomp.sdc.common.log.elements.LogFieldsMdcHandler.hostAddress; + +@RunWith(MockitoJUnitRunner.class) +public class LoggerAuditTest { + @Mock + private Logger logger; + + private LoggerAudit auditLog; + + @Before + public void init() { + auditLog = new LoggerAudit(LogFieldsMdcHandler.getInstance(), logger); + } + + @After + public void tearDown() { + MDC.clear(); + } + + @Test + public void whenNoAuditFieldsArePopulated_ShouldReturnAssertTrue_onMdcMap() { + auditLog.clear() + .log(LogLevel.INFO, "some error code"); + Assert.assertNotNull(MDC.get(MDC_SERVER_FQDN)); + Assert.assertNotNull(MDC.get(MDC_SERVER_IP_ADDRESS)); + } + + @Test + public void whenAllAuditFieldsArePopulated_ShouldReturnAssertTrue_onEachMACField() throws UnknownHostException { + + String uuid = UUID.randomUUID().toString(); + String hostName = InetAddress.getByName(hostAddress).getCanonicalHostName(); + String hostAddress = InetAddress.getLocalHost().getHostAddress(); + + auditLog.clear() + .startTimer() + .stopTimer() + .setKeyRequestId(uuid) + .setInstanceUUID(MDC_INSTANCE_UUID) + .setRemoteHost(MDC_REMOTE_HOST) + .setServiceName(MDC_SERVICE_NAME) + .setResponseCode(EcompLoggerErrorCode.DATA_ERROR) + .setStatusCode("201") + .setResponseDesc(MDC_RESPONSE_DESC) + .setPartnerName(MDC_PARTNER_NAME) + + .setOptClassName(LoggerAuditTest.class.toString()) + .setOptAlertSeverity(Severity.CRITICAL) + .setOptProcessKey(MDC_PROCESS_KEY) + .setOptServiceInstanceId(MDC_SERVICE_INSTANCE_ID) + .log(LogLevel.DEBUG, ""); + + + Assert.assertFalse(LogFieldsMdcHandler.getInstance().isMDCParamEmpty(MDC_AUDIT_BEGIN_TIMESTAMP)); + Assert.assertFalse(LogFieldsMdcHandler.getInstance().isMDCParamEmpty(MDC_END_TIMESTAMP)); + Assert.assertFalse(LogFieldsMdcHandler.getInstance().isMDCParamEmpty(MDC_ELAPSED_TIME)); + + Assert.assertEquals(MDC.get(MDC_SERVER_IP_ADDRESS), hostAddress); + Assert.assertEquals(MDC.get(MDC_SERVER_FQDN), hostName); + Assert.assertEquals(MDC.get(MDC_REMOTE_HOST), MDC_REMOTE_HOST); + Assert.assertEquals(MDC.get(MDC_STATUS_CODE), StatusCode.COMPLETE.getStatusCodeEnum()); + + Assert.assertEquals(MDC.get(MDC_KEY_REQUEST_ID), uuid); + Assert.assertEquals(MDC.get(MDC_SERVICE_NAME), MDC_SERVICE_NAME); + Assert.assertEquals(MDC.get(MDC_PARTNER_NAME), MDC_PARTNER_NAME); + Assert.assertEquals(MDC.get(MDC_RESPONSE_CODE), String.valueOf(EcompLoggerErrorCode.DATA_ERROR.getErrorCode())); + Assert.assertEquals(MDC.get(MDC_RESPONSE_DESC), MDC_RESPONSE_DESC); + Assert.assertEquals(MDC.get(MDC_INSTANCE_UUID), MDC_INSTANCE_UUID); + Assert.assertEquals(MDC.get(MDC_CLASS_NAME), LoggerAuditTest.class.toString()); + + Assert.assertEquals(MDC.get(MDC_ALERT_SEVERITY), String.valueOf(Severity.CRITICAL.getSeverityType())); + Assert.assertEquals(MDC.get(MDC_PROCESS_KEY), MDC_PROCESS_KEY); + Assert.assertEquals(MDC.get(MDC_SERVICE_INSTANCE_ID), MDC_SERVICE_INSTANCE_ID); + } +} diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerDebugTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerDebugTest.java new file mode 100644 index 0000000000..4b1742eab8 --- /dev/null +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerDebugTest.java @@ -0,0 +1,89 @@ +package org.openecomp.sdc.common.log.elements; + +/** + * Created by dd4296 on 12/25/2017. + */ + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.common.log.enums.LogLevel; +import org.openecomp.sdc.common.util.ThreadLocalsHolder; +import org.slf4j.Logger; +import org.slf4j.MDC; + +import java.net.UnknownHostException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.*; + +@RunWith(MockitoJUnitRunner.class) +public class LoggerDebugTest { + + @Mock + private Logger logger; + + private LoggerDebug debugLog; + + @Before + public void init() { + debugLog = new LoggerDebug(LogFieldsMdcHandler.getInstance(), logger); + ThreadLocalsHolder.setUuid(null); + MDC.clear(); + } + + @Test + public void whenNoFieldsIsPopulated_RequestedMdcFieldsAreEmpty() { + debugLog.clear() + .log(LogLevel.DEBUG, "some error code"); + assertNull(MDC.get(MDC_KEY_REQUEST_ID)); + } + + @Test + public void debugLogCheckValidationValidFieldsTest() { + debugLog.clear() + .startTimer() + .setKeyRequestId("uuid") + .log(LogLevel.DEBUG, "some error code"); + + Assert.assertEquals(MDC.get(MDC_KEY_REQUEST_ID), "uuid"); + } + + @Test + public void whenOnlyDebugUUIDFieldsIsPopulated_ShouldReturnAssertTrue_onUUIDFieldCheck() { + debugLog.clear() + .setKeyRequestId("uuid") + .log(LogLevel.DEBUG, "some error code"); + + Assert.assertEquals(MDC.get(MDC_KEY_REQUEST_ID), "uuid"); + } + + @Test + public void whenAllDebugFieldsArePopulated_ShouldReturnAssertTrue_onEachMACFieldCheck() throws UnknownHostException { + debugLog.clear() + .startTimer() + .setKeyRequestId(MDC_KEY_REQUEST_ID) + .log(LogLevel.DEBUG, "some message"); + + Assert.assertTrue(LogFieldsMdcHandler.getInstance().isMDCParamEmpty(MDC_END_TIMESTAMP)); + Assert.assertTrue(LogFieldsMdcHandler.getInstance().isMDCParamEmpty(MDC_ELAPSED_TIME)); + Assert.assertTrue(LogFieldsMdcHandler.getInstance().isMDCParamEmpty(MDC_STATUS_CODE)); + } + + + @Test + public void validateMandatoryFields(){ + assertEquals(MDC_KEY_REQUEST_ID, debugLog.checkMandatoryFieldsExistInMDC().trim()); + } + + @Test + public void validateMandatoryFieldsWhenFieldIsSet(){ + debugLog.clear() + .setKeyRequestId("1234"); + assertEquals("", debugLog.checkMandatoryFieldsExistInMDC()); + } +} diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerErrorTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerErrorTest.java new file mode 100644 index 0000000000..e7fd3455e5 --- /dev/null +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerErrorTest.java @@ -0,0 +1,72 @@ +package org.openecomp.sdc.common.log.elements; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.common.config.EcompErrorCode; +import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; +import org.openecomp.sdc.common.log.enums.LogLevel; +import org.openecomp.sdc.common.util.ThreadLocalsHolder; +import org.slf4j.Logger; +import org.slf4j.MDC; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.*; + +@RunWith(MockitoJUnitRunner.class) +public class LoggerErrorTest { + private LoggerError errorLog; + + @Mock + private Logger logger; + @Before + public void init() { + errorLog = LoggerFactory.getMdcLogger(LoggerError.class, logger); + MDC.clear(); + } + + @Test + public void allFieldsArePresentTest() { + ThreadLocalsHolder.setUuid("uuid"); + errorLog.log(LogLevel.ERROR, EcompLoggerErrorCode.AVAILABILITY_TIMEOUTS_ERROR, "service", "entity", "server error"); + + Assert.assertEquals(MDC.get(MDC_ERROR_CODE), String.valueOf(EcompLoggerErrorCode.AVAILABILITY_TIMEOUTS_ERROR.getErrorCode())); + Assert.assertEquals("uuid", MDC.get(MDC_KEY_REQUEST_ID)); + Assert.assertEquals("entity", MDC.get(MDC_TARGET_ENTITY)); + Assert.assertEquals("service", MDC.get(MDC_SERVICE_NAME)); + } + + @Test + public void missingFieldsTest() { + errorLog.clear() + .log(LogLevel.ERROR,"some message"); + } + + @Test + public void convertEcompErrorForLogging_correctName() { + assertEquals(EcompLoggerErrorCode.AVAILABILITY_TIMEOUTS_ERROR, EcompLoggerErrorCode.getByValue(EcompErrorCode.E_210.name())); + } + + @Test + public void convertEcompErrorForLogging_correctName_2() { + assertEquals(EcompLoggerErrorCode.DATA_ERROR, EcompLoggerErrorCode.getByValue(EcompErrorCode.E_399.name())); + } + + @Test + public void convertEcompErrorForLogging_NotConvertable() { + assertEquals(EcompLoggerErrorCode.UNKNOWN_ERROR, EcompLoggerErrorCode.getByValue("ABC")); + } + + @Test + public void convertEcompErrorForLogging_NotConvertable_2() { + assertEquals(EcompLoggerErrorCode.UNKNOWN_ERROR, EcompLoggerErrorCode.getByValue("E_ABC")); + } + + @Test + public void convertEcompErrorForLogging_Success() { + assertEquals(EcompLoggerErrorCode.SUCCESS, EcompLoggerErrorCode.getByValue("E_0")); + } +} diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerMetricTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerMetricTest.java new file mode 100644 index 0000000000..cee7da585f --- /dev/null +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/log/elements/LoggerMetricTest.java @@ -0,0 +1,112 @@ +package org.openecomp.sdc.common.log.elements; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.common.log.enums.LogLevel; +import org.openecomp.sdc.common.log.enums.Severity; +import org.openecomp.sdc.common.util.ThreadLocalsHolder; +import org.slf4j.Logger; +import org.slf4j.MDC; + +import javax.ws.rs.core.Response; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.UUID; + +import static org.openecomp.sdc.common.log.api.ILogConfiguration.*; +import static org.openecomp.sdc.common.log.elements.LogFieldsMdcHandler.hostAddress; + +/** + * Created by dd4296 on 12/31/2017. + */ +@RunWith(MockitoJUnitRunner.class) +public class LoggerMetricTest { + @Mock + private Logger logger; + + @Mock + Response.StatusType statusType; + + private LoggerMetric metricLog; + + @Before + public void init() { + metricLog = new LoggerMetric(LogFieldsMdcHandler.getInstance(), logger); + } + + @After + public void tearDown() { + MDC.clear(); + ThreadLocalsHolder.setUuid(null); + } + + @Test + public void whenNoMetricFieldsArePopulated_ShouldReturnassertEquals_onMdcMap() { + metricLog.clear() + .log(LogLevel.DEBUG, "some error code"); + Assert.assertNotNull(MDC.get(MDC_SERVER_FQDN)); + Assert.assertNotNull(MDC.get(MDC_SERVER_IP_ADDRESS)); + } + + @Test + public void whenAllMetricFieldsArePopulated_ShouldReturnassertEquals_onEachMACField() throws UnknownHostException { + String uuid = UUID.randomUUID().toString(); + ThreadLocalsHolder.setUuid(uuid); + + String hostName = InetAddress.getByName(hostAddress).getCanonicalHostName(); + String hostAddress = InetAddress.getLocalHost().getHostAddress(); + + metricLog.clear() + .startTimer() + .stopTimer() + .setInstanceUUID(MDC_INSTANCE_UUID) + .setRemoteHost(MDC_REMOTE_HOST) + .setServiceName(MDC_SERVICE_NAME) + .setResponseCode(500) + .setStatusCode("201") + .setResponseDesc(MDC_RESPONSE_DESC) + .setPartnerName(MDC_PARTNER_NAME) + + .setOptClassName(LoggerMetricTest.class.toString()) + .setOptAlertSeverity(Severity.CRITICAL) + .setOptProcessKey(MDC_PROCESS_KEY) + .setOptServiceInstanceId(MDC_SERVICE_INSTANCE_ID) + + .setTargetEntity(MDC_TARGET_ENTITY) + .setTargetServiceName(MDC_TARGET_SERVICE_NAME) + .setTargetVirtualEntity(MDC_TARGET_VIRTUAL_ENTITY) + + .log(LogLevel.DEBUG, ""); + + + Assert.assertFalse(LogFieldsMdcHandler.getInstance().isMDCParamEmpty(MDC_METRIC_BEGIN_TIMESTAMP)); + Assert.assertFalse(LogFieldsMdcHandler.getInstance().isMDCParamEmpty(MDC_END_TIMESTAMP)); + Assert.assertFalse(LogFieldsMdcHandler.getInstance().isMDCParamEmpty(MDC_ELAPSED_TIME)); + + Assert.assertEquals(MDC.get(MDC_SERVER_IP_ADDRESS),hostAddress); + Assert.assertEquals(MDC.get(MDC_SERVER_FQDN), hostName); + Assert.assertEquals(MDC.get(MDC_REMOTE_HOST), MDC_REMOTE_HOST); + Assert.assertEquals(MDC.get(MDC_STATUS_CODE) ,"201"); + + Assert.assertEquals(MDC.get(MDC_KEY_REQUEST_ID), uuid); + Assert.assertEquals(MDC.get(MDC_SERVICE_NAME) ,MDC_SERVICE_NAME); + Assert.assertEquals(MDC.get(MDC_PARTNER_NAME) ,MDC_PARTNER_NAME); + Assert.assertEquals(MDC.get(MDC_RESPONSE_CODE) ,"500"); + Assert.assertEquals(MDC.get(MDC_RESPONSE_DESC) ,MDC_RESPONSE_DESC); + Assert.assertEquals(MDC.get(MDC_INSTANCE_UUID) ,MDC_INSTANCE_UUID); + Assert.assertEquals(MDC.get(MDC_CLASS_NAME) ,LoggerMetricTest.class.toString()); + + Assert.assertEquals(MDC.get(MDC_ALERT_SEVERITY) ,String.valueOf(Severity.CRITICAL.getSeverityType())); + Assert.assertEquals(MDC.get(MDC_PROCESS_KEY) ,MDC_PROCESS_KEY); + Assert.assertEquals(MDC.get(MDC_SERVICE_INSTANCE_ID) ,MDC_SERVICE_INSTANCE_ID); + + Assert.assertEquals(MDC.get(MDC_TARGET_ENTITY) ,MDC_TARGET_ENTITY); + Assert.assertEquals(MDC.get(MDC_TARGET_SERVICE_NAME) ,MDC_TARGET_SERVICE_NAME); + Assert.assertEquals(MDC.get(MDC_TARGET_VIRTUAL_ENTITY) ,MDC_TARGET_VIRTUAL_ENTITY); + } +} diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/log/wrappers/LoggerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/log/wrappers/LoggerTest.java new file mode 100644 index 0000000000..b965a0bc55 --- /dev/null +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/log/wrappers/LoggerTest.java @@ -0,0 +1,261 @@ +package org.openecomp.sdc.common.log.wrappers; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.common.log.api.ILogConfiguration; +import org.openecomp.sdc.common.log.elements.LoggerError; +import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; +import org.openecomp.sdc.common.log.enums.LogLevel; +import org.openecomp.sdc.common.log.enums.Severity; +import org.openecomp.sdc.common.util.ThreadLocalsHolder; +import org.slf4j.MDC; +import org.slf4j.Marker; + +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; +import java.net.URI; +import java.net.URISyntaxException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.contains; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.*; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.*; + +@RunWith(MockitoJUnitRunner.class) +public class LoggerTest { + + private final static String targetEntity = "DCEA"; + private final static String serviceName = "testService"; + private final static String message = "Logger message"; + private final static String exceptionMsg= "Exception testing"; + private final static String missingFieldsMessageFragment = "mandatory parameters for ECOMP logging"; + + @Mock + private org.slf4j.Logger logger; + @Mock + private ContainerRequestContext requestContext; + @Mock + private UriInfo uriInfo; + @Mock + private Response.StatusType statusType; + + @InjectMocks + private Logger commonLogger; + + @Captor + private ArgumentCaptor<String> captor; + + @Before + public void setUp() { + MDC.clear(); + } + + @Test + public void validateErrorLogWhenErrorSettingsProvided() { + when(logger.isErrorEnabled()).thenReturn(true); + commonLogger.error(EcompLoggerErrorCode.PERMISSION_ERROR, serviceName, targetEntity, message); + + verify(logger).error(any(Marker.class), captor.capture(), any(Object[].class)); + assertEquals(message, captor.getValue()); + assertEquals(String.valueOf(EcompLoggerErrorCode.PERMISSION_ERROR.getErrorCode()), MDC.get(ILogConfiguration.MDC_ERROR_CODE)); + assertEquals(LogLevel.ERROR.name(), MDC.get(ILogConfiguration.MDC_ERROR_CATEGORY)); + assertEquals(targetEntity, MDC.get(ILogConfiguration.MDC_TARGET_ENTITY)); + assertEquals(serviceName, MDC.get(ILogConfiguration.MDC_SERVICE_NAME)); + } + + @Test + public void validateWarnMessageIsLoggedWhenAllErrorSettingsProvided() { + when(logger.isErrorEnabled()).thenReturn(true); + commonLogger.error(EcompLoggerErrorCode.AVAILABILITY_TIMEOUTS_ERROR, serviceName, targetEntity, message); + + verify(logger).error(any(Marker.class), captor.capture(), any(Object[].class)); + assertEquals(message, captor.getValue()); + assertEquals(String.valueOf(EcompLoggerErrorCode.AVAILABILITY_TIMEOUTS_ERROR.getErrorCode()), MDC.get(ILogConfiguration.MDC_ERROR_CODE)); + assertEquals(LogLevel.ERROR.name(), MDC.get(ILogConfiguration.MDC_ERROR_CATEGORY)); + assertEquals(targetEntity, MDC.get(ILogConfiguration.MDC_TARGET_ENTITY)); + assertEquals(serviceName, MDC.get(ILogConfiguration.MDC_SERVICE_NAME)); + } + + @Test + public void validateFatalMessageIsLoggedWhenAllErrorSettingsProvided() { + when(logger.isErrorEnabled()).thenReturn(true); + commonLogger.fatal(EcompLoggerErrorCode.PERMISSION_ERROR, serviceName, targetEntity, message); + + verify(logger).error(any(Marker.class), captor.capture(), any(Object[].class)); + assertEquals(message, captor.getValue()); + assertEquals(String.valueOf(EcompLoggerErrorCode.PERMISSION_ERROR.getErrorCode()), MDC.get(ILogConfiguration.MDC_ERROR_CODE)); + assertEquals(LogLevel.FATAL.name(), MDC.get(ILogConfiguration.MDC_ERROR_CATEGORY)); + assertEquals(targetEntity, MDC.get(ILogConfiguration.MDC_TARGET_ENTITY)); + assertEquals(serviceName, MDC.get(ILogConfiguration.MDC_SERVICE_NAME)); + } + + @Test + public void validateErrorMessageIsNotLoggedWhenErrorLevelIsDisabledEvenIfErrorSettingsProvided() { + commonLogger.error(EcompLoggerErrorCode.PERMISSION_ERROR, serviceName, targetEntity, message); + verify(logger, never()).error(any(Marker.class), any(String.class)); + } + + @Test + public void validateErrorLogWhenErrorSettingsProvidedPartially() { + when(logger.isErrorEnabled()).thenReturn(true); + commonLogger.error(message); + + verify(logger).error(any(Marker.class), eq(message), any(Object[].class)); + assertEquals(String.valueOf(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR.getErrorCode()), MDC.get(ILogConfiguration.MDC_ERROR_CODE)); + assertEquals(LogLevel.ERROR.name(), MDC.get(ILogConfiguration.MDC_ERROR_CATEGORY)); + assertNull(MDC.get(ILogConfiguration.MDC_TARGET_ENTITY)); + assertEquals(LoggerError.defaultServiceName, MDC.get(ILogConfiguration.MDC_SERVICE_NAME)); + } + + @Test + public void errorMessageIsNotLoggedWhenErrorLevelIsDisabled() { + commonLogger.error(message); + verify(logger, times(0)).error(any(Marker.class), anyString()); + } + + @Test + public void traceMessageWithExceptionIsNotLoggedWhenTraceLevelIsDisabled() { + commonLogger.trace(message, new UnsupportedOperationException()); + verify(logger, times(0)).trace(any(Marker.class), anyString()); + } + + @Test + public void verifyInfoMessage() { + when(logger.isInfoEnabled()).thenReturn(true); + commonLogger.info("Text"); + assertEquals(LogLevel.INFO.name(), MDC.get(MDC_ERROR_CATEGORY)); + assertEquals(String.valueOf(EcompLoggerErrorCode.SUCCESS.getErrorCode()), MDC.get(MDC_ERROR_CODE)); + assertEquals(LoggerError.defaultServiceName, MDC.get(ILogConfiguration.MDC_SERVICE_NAME)); + } + + @Test + public void verifyWarnMessage() { + when(logger.isWarnEnabled()).thenReturn(true); + commonLogger.warn("Text"); + assertEquals(LogLevel.WARN.name(), MDC.get(MDC_ERROR_CATEGORY)); + assertEquals(String.valueOf(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR.getErrorCode()), MDC.get(MDC_ERROR_CODE)); + assertEquals(LoggerError.defaultServiceName, MDC.get(ILogConfiguration.MDC_SERVICE_NAME)); + } + + @Test + public void validateErrorLogWithExceptionWhenErrorSettingsProvidedPartially() { + ThreadLocalsHolder.setUuid("uuid"); + final String logFieldsNotProvidedMsg = "mandatory parameters for ECOMP logging, missing fields: ServiceName PartnerName"; + when(logger.isWarnEnabled()).thenReturn(true); + commonLogger.warn(message, new NullPointerException(exceptionMsg)); + + //the expected warn message + verify(logger).warn(any(Marker.class), contains(message), any(Object[].class)); + assertEquals(String.valueOf(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR.getErrorCode()), MDC.get(ILogConfiguration.MDC_ERROR_CODE)); + assertEquals(LogLevel.WARN.name(), MDC.get(ILogConfiguration.MDC_ERROR_CATEGORY)); + assertEquals("uuid", MDC.get(ILogConfiguration.MDC_KEY_REQUEST_ID)); + assertNull(MDC.get(ILogConfiguration.MDC_TARGET_ENTITY)); + assertEquals(LoggerError.defaultServiceName, MDC.get(ILogConfiguration.MDC_SERVICE_NAME)); + } + + + @Test + public void validateDebugLogWithException() { + final String msg = "Debug message"; + ThreadLocalsHolder.setUuid("uuid"); + when(logger.isDebugEnabled()).thenReturn(true); + commonLogger.debug(msg, new RuntimeException()); + + verify(logger).debug(any(Marker.class), eq(msg), any(RuntimeException.class)); + } + + @Test + public void validateTraceLogWithExceptionAndPartialParamsAndDebugLevelDisabled() { + final String msg = "Debug message"; + when(logger.isTraceEnabled()).thenReturn(true); + commonLogger.trace(msg, new RuntimeException()); + + verify(logger).trace(any(Marker.class), eq(msg), any(RuntimeException.class)); + } + + @Test + public void warnMessageWithParameterIsNotLoggedIfWarnLevelIsDisabled() { + commonLogger.warn("msg", "param"); + verify(logger, times(0)).warn(any(Marker.class), + anyString(), any(Object.class)); + } + + @Test + public void verifyMdcValuesAreStoredWhenAuditAndErrorLoggersAreInvokedSequentially() throws URISyntaxException { + final String uuid = "12345"; + final String message = "message"; + when(requestContext.getHeaderString(anyString())).thenReturn("ab2222"); + when(requestContext.getUriInfo()).thenReturn(uriInfo); + when(logger.isErrorEnabled()).thenReturn(true); + + URI uri = new URI("http:/abc.com/getId"); + when(uriInfo.getRequestUri()).thenReturn(uri); + when(uriInfo.getBaseUri()).thenReturn(uri); + when(statusType.getStatusCode()).thenReturn(200); + when(statusType.getReasonPhrase()).thenReturn("OK"); + LoggerSdcAudit audit = new LoggerSdcAudit(this.getClass()); + ThreadLocalsHolder.setUuid(uuid); + audit.startLog(requestContext); + audit.log("abc.log.com", requestContext, statusType, LogLevel.INFO, Severity.OK, message); + + commonLogger.error(message); + verify(logger).error(any(Marker.class), eq(message), any(Object[].class)); + assertEquals(uuid, MDC.get(MDC_KEY_REQUEST_ID)); + assertEquals("/", MDC.get(MDC_SERVICE_NAME)); + assertEquals(LogLevel.ERROR.name(), MDC.get(MDC_ERROR_CATEGORY)); + assertEquals(String.valueOf(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR.getErrorCode()), MDC.get(MDC_ERROR_CODE)); + } + + @Test + public void verifyLoggerDoesNothingWhenTheLevelIsNotSet() { + if (commonLogger.isDebugEnabled()) { + commonLogger.debug("text"); + } + verify(logger, times(0)).debug(any(Marker.class), anyString(), eq((Object[])null)); + } + + @Test + public void verifyLoggerTraceMethodIsCalledWhenTheLevelIsSet() { + ThreadLocalsHolder.setUuid("1234"); + when(logger.isTraceEnabled()).thenReturn(true); + if (commonLogger.isTraceEnabled()) { + commonLogger.trace("text"); + } + verify(logger, times(1)).trace(any(Marker.class), anyString(), eq((Object[])null)); + } + + + @Test + public void verifyMdcValuesAreStoredWhenTraceLoggerIsInvokedAfterAuditStart() throws URISyntaxException { + final String uuid = "12345"; + final String message = "message"; + when(requestContext.getHeaderString(anyString())).thenReturn("ab2222"); + when(requestContext.getUriInfo()).thenReturn(uriInfo); + when(logger.isTraceEnabled()).thenReturn(true); + + URI uri = new URI("http:/abc.com/getId"); + when(uriInfo.getRequestUri()).thenReturn(uri); + when(uriInfo.getBaseUri()).thenReturn(uri); + LoggerSdcAudit audit = new LoggerSdcAudit(this.getClass()); + ThreadLocalsHolder.setUuid(uuid); + audit.startLog(requestContext); + + commonLogger.trace(message); + verify(logger).trace(any(Marker.class), captor.capture(), eq((Object[])null)); + assertEquals(message, captor.getValue()); + assertEquals(uuid, MDC.get(MDC_KEY_REQUEST_ID)); + } + + +} diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/monitoring/MonitoringEventTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/monitoring/MonitoringEventTest.java deleted file mode 100644 index 66f519197c..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/monitoring/MonitoringEventTest.java +++ /dev/null @@ -1,242 +0,0 @@ -package org.openecomp.sdc.common.monitoring; - -import org.junit.Test; - - -public class MonitoringEventTest { - - private MonitoringEvent createTestSubject() { - return new MonitoringEvent(); - } - - - @Test - public void testGetHostid() throws Exception { - MonitoringEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHostid(); - } - - - @Test - public void testSetHostid() throws Exception { - MonitoringEvent testSubject; - String hostid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setHostid(hostid); - } - - - @Test - public void testGetHostcpu() throws Exception { - MonitoringEvent testSubject; - Long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHostcpu(); - } - - - @Test - public void testSetHostcpu() throws Exception { - MonitoringEvent testSubject; - Long hostcpu = null; - - // default test - testSubject = createTestSubject(); - testSubject.setHostcpu(hostcpu); - } - - - @Test - public void testGetHostmem() throws Exception { - MonitoringEvent testSubject; - Double result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHostmem(); - } - - - @Test - public void testSetHostmem() throws Exception { - MonitoringEvent testSubject; - Double hostmem = null; - - // default test - testSubject = createTestSubject(); - testSubject.setHostmem(hostmem); - } - - - @Test - public void testGetHostdisk() throws Exception { - MonitoringEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHostdisk(); - } - - - @Test - public void testSetHostdisk() throws Exception { - MonitoringEvent testSubject; - String hostdisk = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setHostdisk(hostdisk); - } - - - @Test - public void testGetJvmid() throws Exception { - MonitoringEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getJvmid(); - } - - - @Test - public void testSetJvmid() throws Exception { - MonitoringEvent testSubject; - String jvmid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setJvmid(jvmid); - } - - - @Test - public void testGetJvmcpu() throws Exception { - MonitoringEvent testSubject; - Long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getJvmcpu(); - } - - - @Test - public void testSetJvmcpu() throws Exception { - MonitoringEvent testSubject; - Long jvmcpu = null; - - // default test - testSubject = createTestSubject(); - testSubject.setJvmcpu(jvmcpu); - } - - - @Test - public void testGetJvmmem() throws Exception { - MonitoringEvent testSubject; - Long result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getJvmmem(); - } - - - @Test - public void testSetJvmmem() throws Exception { - MonitoringEvent testSubject; - Long jvmmem = null; - - // default test - testSubject = createTestSubject(); - testSubject.setJvmmem(jvmmem); - } - - - @Test - public void testGetJvmtnum() throws Exception { - MonitoringEvent testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getJvmtnum(); - } - - - @Test - public void testSetJvmtnum() throws Exception { - MonitoringEvent testSubject; - Integer jvmtnum = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setJvmtnum(jvmtnum); - } - - - @Test - public void testGetAppid() throws Exception { - MonitoringEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAppid(); - } - - - @Test - public void testSetAppid() throws Exception { - MonitoringEvent testSubject; - String appid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setAppid(appid); - } - - - @Test - public void testGetAppstat() throws Exception { - MonitoringEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAppstat(); - } - - - @Test - public void testSetAppstat() throws Exception { - MonitoringEvent testSubject; - String appstat = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setAppstat(appstat); - } - - - @Test - public void testToString() throws Exception { - MonitoringEvent testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestConfigurationInfoTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestConfigurationInfoTest.java deleted file mode 100644 index efbb7d799d..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestConfigurationInfoTest.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.openecomp.sdc.common.rest.api; - -import org.junit.Test; - - -public class RestConfigurationInfoTest { - - private RestConfigurationInfo createTestSubject() { - return new RestConfigurationInfo(); - } - - - @Test - public void testGetReadTimeoutInSec() throws Exception { - RestConfigurationInfo testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getReadTimeoutInSec(); - } - - - @Test - public void testSetReadTimeoutInSec() throws Exception { - RestConfigurationInfo testSubject; - Integer readTimeoutInSec = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setReadTimeoutInSec(readTimeoutInSec); - } - - - @Test - public void testGetIgnoreCertificate() throws Exception { - RestConfigurationInfo testSubject; - Boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getIgnoreCertificate(); - } - - - @Test - public void testSetIgnoreCertificate() throws Exception { - RestConfigurationInfo testSubject; - Boolean ignoreCertificate = null; - - // default test - testSubject = createTestSubject(); - testSubject.setIgnoreCertificate(ignoreCertificate); - } - - - @Test - public void testGetConnectionPoolSize() throws Exception { - RestConfigurationInfo testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getConnectionPoolSize(); - } - - - @Test - public void testSetConnectionPoolSize() throws Exception { - RestConfigurationInfo testSubject; - Integer connectionPoolSize = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setConnectionPoolSize(connectionPoolSize); - } - - - @Test - public void testGetConnectTimeoutInSec() throws Exception { - RestConfigurationInfo testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getConnectTimeoutInSec(); - } - - - @Test - public void testSetConnectTimeoutInSec() throws Exception { - RestConfigurationInfo testSubject; - Integer connectTimeoutInSec = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setConnectTimeoutInSec(connectTimeoutInSec); - } - - - @Test - public void testToString() throws Exception { - RestConfigurationInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/test/CommonUtilsTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/test/CommonUtilsTest.java index 8cab6b4ed4..51490a6827 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/test/CommonUtilsTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/test/CommonUtilsTest.java @@ -20,15 +20,6 @@ package org.openecomp.sdc.common.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.junit.Test; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.util.GeneralUtility; @@ -40,6 +31,13 @@ import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.*; + public class CommonUtilsTest { private static Logger log = LoggerFactory.getLogger(CommonUtilsTest.class.getName()); @@ -138,35 +136,35 @@ public class CommonUtilsTest { @Test public void testRemoveHtml() { - assertTrue("gooboo".equals(ValidationUtils.removeHtmlTags("<b>goo<b></b></b><b>boo</b>"))); - assertTrue("goo<boo".equals(ValidationUtils.removeHtmlTags("<b>goo<b></b><</b><b>boo</b>"))); - assertTrue("goo boo".equals(ValidationUtils.removeHtmlTags("goo boo"))); - assertTrue("goo# . boo12".equals(ValidationUtils.removeHtmlTags("goo# . boo12"))); + assertEquals("gooboo", ValidationUtils.removeHtmlTags("<b>goo<b></b></b><b>boo</b>")); + assertEquals("goo<boo", ValidationUtils.removeHtmlTags("<b>goo<b></b><</b><b>boo</b>")); + assertEquals("goo boo", ValidationUtils.removeHtmlTags("goo boo")); + assertEquals("goo# . boo12", ValidationUtils.removeHtmlTags("goo# . boo12")); } @Test public void testnormaliseWhitespace() { - assertTrue("goo boo".equals(ValidationUtils.normaliseWhitespace("goo boo"))); - assertTrue("goo boo ".equals(ValidationUtils.normaliseWhitespace("goo boo "))); - assertTrue("goo boo".equals(ValidationUtils.normaliseWhitespace("goo boo"))); + assertEquals("goo boo", ValidationUtils.normaliseWhitespace("goo boo")); + assertEquals("goo boo ", ValidationUtils.normaliseWhitespace("goo boo ")); + assertEquals("goo boo", ValidationUtils.normaliseWhitespace("goo boo")); } @Test public void teststripOctets() { - assertTrue("goo boo".equals(ValidationUtils.stripOctets("goo%1F boo"))); - assertTrue("goo boo ".equals(ValidationUtils.stripOctets("goo boo %1F"))); - assertTrue("goo boo".equals(ValidationUtils.stripOctets("%1Fgoo boo"))); + assertEquals("goo boo", ValidationUtils.stripOctets("goo%1F boo")); + assertEquals("goo boo ", ValidationUtils.stripOctets("goo boo %1F")); + assertEquals("goo boo", ValidationUtils.stripOctets("%1Fgoo boo")); } @Test public void testRemoveNoneUtf8Chars() { - assertTrue("goo boo".equals(ValidationUtils.removeNoneUtf8Chars("goo boo"))); - assertTrue("goo boo!!._".equals(ValidationUtils.removeNoneUtf8Chars("goo boo!!._"))); - assertTrue("goo boo".equals(ValidationUtils.removeNoneUtf8Chars("goo boo"))); - assertTrue("goo bo123o".equals(ValidationUtils.removeNoneUtf8Chars("goo bo123o"))); - assertTrue("goo bo123o".equals(ValidationUtils.removeNoneUtf8Chars("goo קקbo123oגכקק"))); - assertTrue("goo bo123o".equals(ValidationUtils.removeNoneUtf8Chars("goo bo1������23o"))); + assertEquals("goo boo", ValidationUtils.removeNoneUtf8Chars("goo boo")); + assertEquals("goo boo!!._", ValidationUtils.removeNoneUtf8Chars("goo boo!!._")); + assertEquals("goo boo", ValidationUtils.removeNoneUtf8Chars("goo boo")); + assertEquals("goo bo123o", ValidationUtils.removeNoneUtf8Chars("goo bo123o")); + assertEquals("goo bo123o", ValidationUtils.removeNoneUtf8Chars("goo קקbo123oגכקק")); + assertEquals("goo bo123o", ValidationUtils.removeNoneUtf8Chars("goo bo1������23o")); } @Test @@ -334,15 +332,15 @@ public class CommonUtilsTest { @Test public void normalizeFileNameTest() { - assertTrue("too.jpeg".equals(ValidationUtils.normalizeFileName("too.jpeg"))); - assertTrue("too..jpeg".equals(ValidationUtils.normalizeFileName("too..jpeg"))); - assertTrue("too..jpeg".equals(ValidationUtils.normalizeFileName("t*o:o..jpe<>g"))); - assertTrue("goo.too..jpeg".equals(ValidationUtils.normalizeFileName("goo.t*o:o..jpe<>g"))); - assertTrue("goo.too..jpeg".equals(ValidationUtils.normalizeFileName(" goo.t*o:o..jpe<>g "))); - assertTrue("goo-too-mo.jpeg".equals(ValidationUtils.normalizeFileName("goo too----mo.jpeg"))); - assertTrue("goo-too-mo.jpeg".equals(ValidationUtils.normalizeFileName(".\\..\\goo too----mo.jpeg"))); - assertTrue("goo-too-mo.jpeg".equals(ValidationUtils.normalizeFileName("__--goo too----mo.jpeg--__"))); - assertTrue("goo-too-mo.jpeg".equals(ValidationUtils.normalizeFileName("_ -goo too----mo.jpeg _-- _-"))); + assertEquals("too.jpeg", ValidationUtils.normalizeFileName("too.jpeg")); + assertEquals("too..jpeg", ValidationUtils.normalizeFileName("too..jpeg")); + assertEquals("too..jpeg", ValidationUtils.normalizeFileName("t*o:o..jpe<>g")); + assertEquals("goo.too..jpeg", ValidationUtils.normalizeFileName("goo.t*o:o..jpe<>g")); + assertEquals("goo.too..jpeg", ValidationUtils.normalizeFileName(" goo.t*o:o..jpe<>g ")); + assertEquals("goo-too-mo.jpeg", ValidationUtils.normalizeFileName("goo too----mo.jpeg")); + assertEquals("goo-too-mo.jpeg", ValidationUtils.normalizeFileName(".\\..\\goo too----mo.jpeg")); + assertEquals("goo-too-mo.jpeg", ValidationUtils.normalizeFileName("__--goo too----mo.jpeg--__")); + assertEquals("goo-too-mo.jpeg", ValidationUtils.normalizeFileName("_ -goo too----mo.jpeg _-- _-")); } @@ -466,7 +464,7 @@ public class CommonUtilsTest { options.setDefaultScalarStyle(DumperOptions.ScalarStyle.FOLDED); Yaml yaml = new Yaml(options); - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("k1", "val"); parameters.put("k2", "\"val\""); diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/test/E2EHttpClientTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/test/E2EHttpClientTest.java index 9dbb146d5a..5617403de8 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/test/E2EHttpClientTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/test/E2EHttpClientTest.java @@ -1,10 +1,5 @@ package org.openecomp.sdc.common.test; -import java.net.MalformedURLException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - import org.junit.Ignore; import org.junit.Test; import org.openecomp.sdc.common.http.client.api.HttpExecuteException; @@ -13,6 +8,11 @@ import org.openecomp.sdc.common.http.client.api.HttpResponse; import org.openecomp.sdc.common.http.config.HttpClientConfig; import org.openecomp.sdc.common.http.config.Timeouts; +import java.net.MalformedURLException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + public class E2EHttpClientTest { @Ignore diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/test/TestExternalConfiguration.java b/common-app-api/src/test/java/org/openecomp/sdc/common/test/TestExternalConfiguration.java index d2ec093f39..839190b30f 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/test/TestExternalConfiguration.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/test/TestExternalConfiguration.java @@ -20,18 +20,8 @@ package org.openecomp.sdc.common.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; @@ -46,6 +36,13 @@ import org.openecomp.sdc.common.test.config.TestNotExistConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.*; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + public class TestExternalConfiguration { private static Logger log = LoggerFactory.getLogger(TestExternalConfiguration.class.getName()); @@ -80,7 +77,7 @@ public class TestExternalConfiguration { TestConfiguration testConfiguration = configurationSource.getAndWatchConfiguration(TestConfiguration.class, configurationListener); - assertTrue(testConfiguration != null); + assertNotNull(testConfiguration); log.debug("{}", testConfiguration); assertEquals(testConfiguration.getBeHost(), "172.20.37.245"); assertEquals(testConfiguration.getBeProtocol(), "http"); @@ -104,7 +101,7 @@ public class TestExternalConfiguration { TestNotExistConfiguration testConfiguration = configurationSource .getAndWatchConfiguration(TestNotExistConfiguration.class, configurationListener); - assertTrue(testConfiguration == null); + assertNull(testConfiguration); } @@ -129,7 +126,7 @@ public class TestExternalConfiguration { TestConfiguration testConfiguration = configurationSource.getAndWatchConfiguration(TestConfiguration.class, configurationListener); - assertTrue(testConfiguration != null); + assertNotNull(testConfiguration); log.debug("{}", testConfiguration); assertEquals(testConfiguration.getBeHost(), "172.20.37.245"); assertEquals(testConfiguration.getBeProtocol(), "http"); @@ -157,7 +154,7 @@ public class TestExternalConfiguration { FileWriter fw = null; BufferedWriter out = null; try { - List<String> lines = new ArrayList<String>(); + List<String> lines = new ArrayList<>(); String line = null; fr = new FileReader(f1); br = new BufferedReader(fr); @@ -223,7 +220,7 @@ public class TestExternalConfiguration { DistributionEngineConfiguration deConfiguration = configurationSource .getAndWatchConfiguration(DistributionEngineConfiguration.class, configurationListener); - assertTrue(deConfiguration != null); + assertNotNull(deConfiguration); log.debug("{}", deConfiguration); assertEquals(deConfiguration.getDistributionNotifTopicName(), "ASDC-DISTR-NOTIF-TOPIC"); assertEquals(deConfiguration.getDistributionStatusTopicName(), "ASDC-DISTR-STATUS-TOPIC"); @@ -236,12 +233,12 @@ public class TestExternalConfiguration { assertEquals(deConfiguration.getEnvironments().size(), 1); assertEquals(deConfiguration.getEnvironments().iterator().next(), "PROD"); - assertEquals(deConfiguration.getDistribNotifResourceArtifactTypes().getInfo(), null); + assertNull(deConfiguration.getDistribNotifResourceArtifactTypes().getInfo()); assertEquals(deConfiguration.getDistribNotifResourceArtifactTypes().getLifecycle().size(), 2); assertTrue(deConfiguration.getDistribNotifResourceArtifactTypes().getLifecycle().contains("HEAT")); assertTrue(deConfiguration.getDistribNotifResourceArtifactTypes().getLifecycle().contains("DG_XML")); - assertEquals(deConfiguration.getDistribNotifServiceArtifactTypes().getLifecycle(), null); + assertNull(deConfiguration.getDistribNotifServiceArtifactTypes().getLifecycle()); assertEquals(deConfiguration.getDistribNotifServiceArtifactTypes().getInfo().size(), 1); assertTrue(deConfiguration.getDistribNotifServiceArtifactTypes().getInfo().contains("MURANO-PKG")); diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/test/YamlTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/test/YamlTest.java index 81e17849b1..78465fbac4 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/test/YamlTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/test/YamlTest.java @@ -20,14 +20,14 @@ package org.openecomp.sdc.common.test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import org.apache.commons.codec.binary.Base64; import org.junit.BeforeClass; import org.junit.Test; import org.openecomp.sdc.common.util.YamlToObjectConverter; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + public class YamlTest { private static YamlToObjectConverter yamlToObjectConverter; diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/test/config/TestConfiguration.java b/common-app-api/src/test/java/org/openecomp/sdc/common/test/config/TestConfiguration.java index f8acf549fa..5674441454 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/test/config/TestConfiguration.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/test/config/TestConfiguration.java @@ -20,13 +20,13 @@ package org.openecomp.sdc.common.test.config; -import static java.lang.String.format; +import org.openecomp.sdc.common.api.BasicConfiguration; import java.util.Date; import java.util.List; import java.util.Map; -import org.openecomp.sdc.common.api.BasicConfiguration; +import static java.lang.String.format; public class TestConfiguration extends BasicConfiguration { diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/test/config/TestNotExistConfiguration.java b/common-app-api/src/test/java/org/openecomp/sdc/common/test/config/TestNotExistConfiguration.java index 76f694f5b8..303532c772 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/test/config/TestNotExistConfiguration.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/test/config/TestNotExistConfiguration.java @@ -20,10 +20,10 @@ package org.openecomp.sdc.common.test.config; -import static java.lang.String.format; - import org.openecomp.sdc.common.api.BasicConfiguration; +import static java.lang.String.format; + public class TestNotExistConfiguration extends BasicConfiguration { /** diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/util/CapabilityTypeNameEnumTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/util/CapabilityTypeNameEnumTest.java deleted file mode 100644 index 67862928ce..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/util/CapabilityTypeNameEnumTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openecomp.sdc.common.util; - -import org.junit.Test; - - -public class CapabilityTypeNameEnumTest { - - private CapabilityTypeNameEnum createTestSubject() { - return CapabilityTypeNameEnum.ATTACHMENT; - } - - - @Test - public void testGetCapabilityName() throws Exception { - CapabilityTypeNameEnum testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCapabilityName(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/util/GeneralUtilityTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/util/GeneralUtilityTest.java deleted file mode 100644 index ebfffe572a..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/util/GeneralUtilityTest.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.openecomp.sdc.common.util; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; - - -public class GeneralUtilityTest { - - private GeneralUtility createTestSubject() { - return new GeneralUtility(); - } - - - @Test - public void testGenerateTextFile() throws Exception { - String fileName = ""; - String fileData = ""; - boolean result; - - // default test - result = GeneralUtility.generateTextFile(fileName, fileData); - } - - - @Test - public void testIsBase64Encoded() throws Exception { - byte[] data = new byte[] { ' ' }; - boolean result; - - // default test - result = GeneralUtility.isBase64Encoded(data); - } - - - @Test - public void testIsBase64Encoded_1() throws Exception { - String str = ""; - boolean result; - - // default test - result = GeneralUtility.isBase64Encoded(str); - } - - - @Test - public void testIsExceedingLimit() throws Exception { - String str = ""; - int limit = 0; - boolean result; - - // test 1 - str = null; - result = GeneralUtility.isExceedingLimit(str, limit); - Assert.assertEquals(false, result); - - // test 2 - str = ""; - result = GeneralUtility.isExceedingLimit(str, limit); - Assert.assertEquals(false, result); - } - - - @Test - public void testIsExceedingLimit_1() throws Exception { - List<String> strList = null; - int limit = 0; - int delimiterLength = 0; - boolean result; - - // test 1 - strList = null; - result = GeneralUtility.isExceedingLimit(strList, limit, delimiterLength); - Assert.assertEquals(false, result); - } - - - @Test - public void testGetFilenameExtension() throws Exception { - String fileName = ""; - String result; - - // test 1 - fileName = null; - result = GeneralUtility.getFilenameExtension(fileName); - Assert.assertEquals("", result); - - // test 2 - fileName = ""; - result = GeneralUtility.getFilenameExtension(fileName); - Assert.assertEquals("", result); - } - - - @Test - public void testCalculateMD5Base64EncodedByByteArray() throws Exception { - byte[] payload = new byte[] { ' ' }; - String result; - - // default test - result = GeneralUtility.calculateMD5Base64EncodedByByteArray(payload); - } - - - @Test - public void testCalculateMD5Base64EncodedByString() throws Exception { - String data = ""; - String result; - - // default test - result = GeneralUtility.calculateMD5Base64EncodedByString(data); - } - - - @Test - public void testIsEmptyString() throws Exception { - String str = ""; - boolean result; - - // default test - result = GeneralUtility.isEmptyString(str); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/util/GsonFactoryTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/util/GsonFactoryTest.java deleted file mode 100644 index 0840d27934..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/util/GsonFactoryTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openecomp.sdc.common.util; - -import org.junit.Test; - -import com.google.gson.Gson; - - -public class GsonFactoryTest { - - private GsonFactory createTestSubject() { - return new GsonFactory(); - } - - - @Test - public void testGetGson() throws Exception { - Gson result; - - // default test - result = GsonFactory.getGson(); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/util/SerializationUtilsTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/util/SerializationUtilsTest.java index f403bca574..95394afc91 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/util/SerializationUtilsTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/util/SerializationUtilsTest.java @@ -1,10 +1,7 @@ package org.openecomp.sdc.common.util; -import javax.annotation.Generated; - -import org.junit.Test; - import fj.data.Either; +import org.junit.Test; public class SerializationUtilsTest { diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/util/StreamUtilsTests.java b/common-app-api/src/test/java/org/openecomp/sdc/common/util/StreamUtilsTests.java index deb9029e0d..5ee8f42b6b 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/util/StreamUtilsTests.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/util/StreamUtilsTests.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.common.util; -import static org.junit.Assert.assertTrue; +import fj.data.Either; +import static org.junit.Assert.assertEquals; +import org.junit.Test; import java.util.ArrayList; import java.util.Arrays; @@ -29,16 +31,14 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.junit.Test; - -import fj.data.Either; +import static org.junit.Assert.assertTrue; public class StreamUtilsTests { @Test public void testTakeWhilePredicateNotMet() { List<Either<Integer, Boolean>> list = buildListWith10Integers(); - assertTrue(StreamUtils.takeWhile(list.stream(), p -> p.isLeft()).count() == 10); + assertEquals(10, StreamUtils.takeWhile(list.stream(), Either::isLeft).count()); } @Test @@ -46,8 +46,8 @@ public class StreamUtilsTests { List<Either<Integer, Boolean>> list = buildListWith10Integers(); addToBooleansToList(list); - final Stream<Either<Integer, Boolean>> takeWhileStream = StreamUtils.takeWhile(list.stream(), p -> p.isLeft()); - assertTrue(takeWhileStream.filter(p -> p.isRight()).count() == 0); + final Stream<Either<Integer, Boolean>> takeWhileStream = StreamUtils.takeWhile(list.stream(), Either::isLeft); + assertEquals(0, takeWhileStream.filter(Either::isRight).count()); } @Test @@ -67,12 +67,12 @@ public class StreamUtilsTests { }; List<Integer> num1to10 = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - Stream<Either<Integer, Boolean>> streamEithers = num1to10.stream().map(e -> cons.apply(e)); - List<Either<Integer, Boolean>> collect = StreamUtils.takeWhilePlusOneNoEval(streamEithers, e -> e.isLeft()) + Stream<Either<Integer, Boolean>> streamEithers = num1to10.stream().map(cons::apply); + List<Either<Integer, Boolean>> collect = StreamUtils.takeWhilePlusOneNoEval(streamEithers, Either::isLeft) .collect(Collectors.toList()); assertTrue(bucket.size() <= 6); assertTrue(collect.size() <= 6); - assertTrue(collect.stream().filter(e -> e.isRight()).count() == 1); + assertEquals(1, collect.stream().filter(Either::isRight).count()); } @@ -80,7 +80,7 @@ public class StreamUtilsTests { public void testTakeWhilePlusOnePredicateNotMet() { List<Either<Integer, Boolean>> list = buildListWith10Integers(); - assertTrue(StreamUtils.takeWhilePlusOne(list.stream(), p -> p.isLeft()).count() == 10); + assertEquals(10, StreamUtils.takeWhilePlusOne(list.stream(), Either::isLeft).count()); } @Test @@ -89,8 +89,8 @@ public class StreamUtilsTests { addToBooleansToList(list); final Stream<Either<Integer, Boolean>> takeWhilePlusOneStream = StreamUtils.takeWhilePlusOne(list.stream(), - p -> p.isLeft()); - assertTrue(takeWhilePlusOneStream.filter(p -> p.isRight()).count() == 1); + Either::isLeft); + assertEquals(1, takeWhilePlusOneStream.filter(Either::isRight).count()); } private void addToBooleansToList(List<Either<Integer, Boolean>> list) { @@ -108,15 +108,15 @@ public class StreamUtilsTests { @Test public void myTest() { - List<Integer> list = new ArrayList<Integer>(); + List<Integer> list = new ArrayList<>(); for (int i = 0; i < 10; i++) { list.add(i); } - List<Either<Integer, Boolean>> container = new ArrayList<Either<Integer, Boolean>>(); - list.stream().map(e -> myBusinessLogic(e, container)).filter(p -> p.isRight()).findAny(); + List<Either<Integer, Boolean>> container = new ArrayList<>(); + list.stream().map(e -> myBusinessLogic(e, container)).filter(Either::isRight).findAny(); // Actual Results are in container - assertTrue(container.size() == 6); + assertEquals(6, container.size()); } diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/util/ValidationUtilsTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/util/ValidationUtilsTest.java deleted file mode 100644 index 9b30039023..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/util/ValidationUtilsTest.java +++ /dev/null @@ -1,603 +0,0 @@ -package org.openecomp.sdc.common.util; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; - - -public class ValidationUtilsTest { - - private ValidationUtils createTestSubject() { - return new ValidationUtils(); - } - - - @Test - public void testValidateArtifactLabel() throws Exception { - String label = ""; - boolean result; - - // default test - result = ValidationUtils.validateArtifactLabel(label); - } - - - @Test - public void testValidateArtifactDisplayName() throws Exception { - String displayName = ""; - boolean result; - - // default test - result = ValidationUtils.validateArtifactDisplayName(displayName); - } - - - - - @Test - public void testNormalizeCategoryName4Display() throws Exception { - String str = ""; - String result; - - // test 1 - str = "123"; - result = ValidationUtils.normalizeCategoryName4Display(str); - Assert.assertEquals("123", result); - - // test 2 - str = "123#123"; - result = ValidationUtils.normalizeCategoryName4Display(str); - Assert.assertEquals("123#123", result); - } - - - @Test - public void testNormalizeCategoryName4Uniqueness() throws Exception { - String str = ""; - String result; - - // default test - result = ValidationUtils.normalizeCategoryName4Uniqueness(str); - } - - - @Test - public void testValidateCategoryDisplayNameLength() throws Exception { - String label = ""; - boolean result; - - // default test - result = ValidationUtils.validateCategoryDisplayNameLength(label); - } - - - @Test - public void testValidateProductFullNameLength() throws Exception { - String fullName = ""; - boolean result; - - // default test - result = ValidationUtils.validateProductFullNameLength(fullName); - } - - - @Test - public void testValidateArtifactLabelLength() throws Exception { - String label = ""; - boolean result; - - // default test - result = ValidationUtils.validateArtifactLabelLength(label); - } - - - @Test - public void testValidateResourceInstanceNameLength() throws Exception { - String resourceInstanceName = ""; - boolean result; - - // default test - result = ValidationUtils.validateResourceInstanceNameLength(resourceInstanceName); - } - - - @Test - public void testValidateResourceInstanceName() throws Exception { - String resourceInstanceName = ""; - boolean result; - - // default test - result = ValidationUtils.validateResourceInstanceName(resourceInstanceName); - } - - - @Test - public void testValidateUrlLength() throws Exception { - String url = ""; - boolean result; - - // default test - result = ValidationUtils.validateUrlLength(url); - } - - - @Test - public void testValidateArtifactNameLength() throws Exception { - String artifactName = ""; - boolean result; - - // default test - result = ValidationUtils.validateArtifactNameLength(artifactName); - } - - - @Test - public void testValidateComponentNamePattern() throws Exception { - String componentName = ""; - boolean result; - - // default test - result = ValidationUtils.validateComponentNamePattern(componentName); - } - - - @Test - public void testValidateComponentNameLength() throws Exception { - String componentName = ""; - boolean result; - - // default test - result = ValidationUtils.validateComponentNameLength(componentName); - } - - - @Test - public void testValidateIcon() throws Exception { - String icon = ""; - boolean result; - - // default test - result = ValidationUtils.validateIcon(icon); - } - - - @Test - public void testValidateIconLength() throws Exception { - String icon = ""; - boolean result; - - // default test - result = ValidationUtils.validateIconLength(icon); - } - - - @Test - public void testValidateProjectCode() throws Exception { - String projectCode = ""; - boolean result; - - // default test - result = ValidationUtils.validateProjectCode(projectCode); - } - - - @Test - public void testValidateProjectCodeLegth() throws Exception { - String projectCode = ""; - boolean result; - - // default test - result = ValidationUtils.validateProjectCodeLegth(projectCode); - } - - - @Test - public void testValidateContactId() throws Exception { - String contactId = ""; - boolean result; - - // default test - result = ValidationUtils.validateContactId(contactId); - } - - - @Test - public void testValidateCost() throws Exception { - String cost = ""; - boolean result; - - // default test - result = ValidationUtils.validateCost(cost); - } - - - @Test - public void testRemoveHtmlTags() throws Exception { - String str = ""; - String result; - - // default test - result = ValidationUtils.removeHtmlTags(str); - } - - - @Test - public void testRemoveAllTags() throws Exception { - String htmlText = ""; - String result; - - // default test - result = ValidationUtils.removeAllTags(htmlText); - } - - - @Test - public void testNormaliseWhitespace() throws Exception { - String str = ""; - String result; - - // default test - result = ValidationUtils.normaliseWhitespace(str); - } - - - @Test - public void testStripOctets() throws Exception { - String str = ""; - String result; - - // default test - result = ValidationUtils.stripOctets(str); - } - - - @Test - public void testRemoveNoneUtf8Chars() throws Exception { - String input = ""; - String result; - - // default test - result = ValidationUtils.removeNoneUtf8Chars(input); - } - - - @Test - public void testValidateIsEnglish() throws Exception { - String input = ""; - boolean result; - - // default test - result = ValidationUtils.validateIsEnglish(input); - } - - - @Test - public void testValidateIsAscii() throws Exception { - String input = ""; - boolean result; - - // default test - result = ValidationUtils.validateIsAscii(input); - } - - - @Test - public void testConvertHtmlTagsToEntities() throws Exception { - String input = ""; - String result; - - // default test - result = ValidationUtils.convertHtmlTagsToEntities(input); - } - - - - - - - - - @Test - public void testValidateTagListLength() throws Exception { - int tagListLength = 0; - boolean result; - - // default test - result = ValidationUtils.validateTagListLength(tagListLength); - } - - - @Test - public void testValidateDescriptionLength() throws Exception { - String description = ""; - boolean result; - - // default test - result = ValidationUtils.validateDescriptionLength(description); - } - - - @Test - public void testValidateStringNotEmpty() throws Exception { - String value = ""; - boolean result; - - // test 1 - value = null; - result = ValidationUtils.validateStringNotEmpty(value); - Assert.assertEquals(false, result); - - // test 2 - value = ""; - result = ValidationUtils.validateStringNotEmpty(value); - Assert.assertEquals(false, result); - } - - - @Test - public void testValidateListNotEmpty() throws Exception { - List<?> list = null; - boolean result; - - // test 1 - list = null; - result = ValidationUtils.validateListNotEmpty(list); - Assert.assertEquals(false, result); - } - - - @Test - public void testValidateVendorName() throws Exception { - String vendorName = ""; - boolean result; - - // default test - result = ValidationUtils.validateVendorName(vendorName); - } - - - @Test - public void testValidateVendorNameLength() throws Exception { - String vendorName = ""; - boolean result; - - // default test - result = ValidationUtils.validateVendorNameLength(vendorName); - } - - - @Test - public void testValidateResourceVendorModelNumberLength() throws Exception { - String resourceVendorModelNumber = ""; - boolean result; - - // default test - result = ValidationUtils.validateResourceVendorModelNumberLength(resourceVendorModelNumber); - } - - - @Test - public void testValidateVendorRelease() throws Exception { - String vendorRelease = ""; - boolean result; - - // default test - result = ValidationUtils.validateVendorRelease(vendorRelease); - } - - - @Test - public void testValidateVendorReleaseLength() throws Exception { - String vendorRelease = ""; - boolean result; - - // default test - result = ValidationUtils.validateVendorReleaseLength(vendorRelease); - } - - - @Test - public void testValidateServiceTypeLength() throws Exception { - String serviceType = ""; - boolean result; - - // default test - result = ValidationUtils.validateServiceTypeLength(serviceType); - } - - - @Test - public void testValidateServiceRoleLength() throws Exception { - String serviceRole = ""; - boolean result; - - // default test - result = ValidationUtils.validateServiceRoleLength(serviceRole); - } - - - @Test - public void testHasBeenCertified() throws Exception { - String version = ""; - boolean result; - - // default test - result = ValidationUtils.hasBeenCertified(version); - } - - - @Test - public void testNormaliseComponentName() throws Exception { - String name = ""; - String result; - - // default test - result = ValidationUtils.normaliseComponentName(name); - } - - - @Test - public void testNormalizeComponentInstanceName() throws Exception { - String name = ""; - String result; - - // default test - result = ValidationUtils.normalizeComponentInstanceName(name); - } - - - - - - @Test - public void testConvertToSystemName() throws Exception { - String name = ""; - String result; - - // default test - result = ValidationUtils.convertToSystemName(name); - } - - - @Test - public void testNormalizeFileName() throws Exception { - String filename = ""; - String result; - - // default test - result = ValidationUtils.normalizeFileName(filename); - } - - - - - - @Test - public void testValidateUrl() throws Exception { - String url = ""; - boolean result; - - // default test - result = ValidationUtils.validateUrl(url); - } - - - @Test - public void testCleanArtifactDisplayName() throws Exception { - String strIn = ""; - String result; - - // default test - result = ValidationUtils.cleanArtifactDisplayName(strIn); - } - - - @Test - public void testNormalizeArtifactLabel() throws Exception { - String strIn = ""; - String result; - - // default test - result = ValidationUtils.normalizeArtifactLabel(strIn); - } - - - @Test - public void testValidateAdditionalInformationKeyName() throws Exception { - String str = ""; - boolean result; - - // default test - result = ValidationUtils.validateAdditionalInformationKeyName(str); - } - - - - - - - - - @Test - public void testValidateConsumerName() throws Exception { - String consumerName = ""; - boolean result; - - // default test - result = ValidationUtils.validateConsumerName(consumerName); - } - - - @Test - public void testIsUTF8Str() throws Exception { - String str = ""; - boolean result; - - // default test - result = ValidationUtils.isUTF8Str(str); - } - - - @Test - public void testValidateConsumerPassSalt() throws Exception { - String consumerSalt = ""; - boolean result; - - // default test - result = ValidationUtils.validateConsumerPassSalt(consumerSalt); - } - - - @Test - public void testIsFloatNumber() throws Exception { - String number = ""; - boolean result; - - // default test - result = ValidationUtils.isFloatNumber(number); - } - - - @Test - public void testValidateCertifiedVersion() throws Exception { - String version = ""; - boolean result; - - // default test - result = ValidationUtils.validateCertifiedVersion(version); - } - - - @Test - public void testValidateMinorVersion() throws Exception { - String version = ""; - boolean result; - - // default test - result = ValidationUtils.validateMinorVersion(version); - } - - - @Test - public void testNormaliseProductName() throws Exception { - String name = ""; - String result; - - // default test - result = ValidationUtils.normaliseProductName(name); - } - - - - - - @Test - public void testRemoveHtmlTagsOnly() throws Exception { - String htmlText = ""; - String result; - - // default test - result = ValidationUtils.removeHtmlTagsOnly(htmlText); - } -}
\ No newline at end of file diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/util/ZipUtilTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/util/ZipUtilTest.java index 314208554d..b98fa08066 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/util/ZipUtilTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/util/ZipUtilTest.java @@ -1,12 +1,9 @@ package org.openecomp.sdc.common.util; -import java.util.Map; -import java.util.zip.ZipInputStream; - -import javax.annotation.Generated; - import org.junit.Test; +import java.util.Map; + public class ZipUtilTest { // private ZipUtil createTestSubject() { diff --git a/common-app-api/src/test/java/org/openecomp/sdc/exception/ResponseFormatTest.java b/common-app-api/src/test/java/org/openecomp/sdc/exception/ResponseFormatTest.java index ba6e14eff7..e1ec9eb040 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/exception/ResponseFormatTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/exception/ResponseFormatTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.exception; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.exception.ResponseFormat.RequestErrorWrapper; diff --git a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationTest.java index 4afafaefd4..516fbf7909 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationTest.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.fe.config; -import java.util.Date; -import java.util.List; - import org.junit.Test; import org.openecomp.sdc.fe.config.Configuration.FeMonitoringConfig; +import java.util.Date; +import java.util.List; + public class ConfigurationTest { |