aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/application/src/test
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2020-09-22 12:16:46 -0400
committerSingal, Kapil (ks220y) <ks220y@att.com>2020-09-22 13:49:05 -0400
commit1072867dfac0df993cbd3e44bcc11a5cac7465fd (patch)
tree4a821659cf3b50cf946cbb535d528be8508e9fff /ms/blueprintsprocessor/application/src/test
parentd97021cd756d63402545fdc2e14ac7611c3da118 (diff)
Enabling Code Formatter
Code Formatter was turned off due to java 11 migation Issue-ID: CCSDK-2852 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com> Change-Id: I3d02ed3cc7a93d7551fe25356512cfe8db1517d8
Diffstat (limited to 'ms/blueprintsprocessor/application/src/test')
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt1
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt8
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ErrorCatalogTestConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt10
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/error/ErrorCatalogServiceTest.kt71
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt1
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/ExtendedTemporaryFolder.kt16
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt1
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/TestSecuritySettings.kt2
9 files changed, 78 insertions, 34 deletions
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
index 7f38608c9..41e997b88 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
@@ -55,6 +55,7 @@ abstract class BaseUatTest {
}
companion object {
+
const val UAT_BLUEPRINTS_BASE_DIR = "../../../components/model-catalog/blueprint-model/uat-blueprints"
}
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
index ff7cd78c0..4a8da536f 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
@@ -58,9 +58,11 @@ class BlueprintsAcceptanceTest(
@Parameterized.Parameters(name = "{index} {0}")
@JvmStatic
fun scanUatEmpoweredBlueprints(): List<Array<Any>> {
- return (File(UAT_BLUEPRINTS_BASE_DIR)
- .listFiles { file -> file.isDirectory && File(file, UAT_SPECIFICATION_FILE).isFile }
- ?: throw RuntimeException("Failed to scan $UAT_BLUEPRINTS_BASE_DIR"))
+ return (
+ File(UAT_BLUEPRINTS_BASE_DIR)
+ .listFiles { file -> file.isDirectory && File(file, UAT_SPECIFICATION_FILE).isFile }
+ ?: throw RuntimeException("Failed to scan $UAT_BLUEPRINTS_BASE_DIR")
+ )
.map { file ->
arrayOf(
file.nameWithoutExtension,
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ErrorCatalogTestConfiguration.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ErrorCatalogTestConfiguration.kt
index c9d55c18a..33e795728 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ErrorCatalogTestConfiguration.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ErrorCatalogTestConfiguration.kt
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.error.catalog"]
+ basePackages = ["org.onap.ccsdk.cds.error.catalog"]
)
@EnableAutoConfiguration
open class ErrorCatalogTestConfiguration
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
index 4e7d4ce40..fe2d539e3 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
@@ -74,6 +74,7 @@ fun String.prefixIfNot(prefix: String) =
class UatServicesTest : BaseUatTest() {
companion object {
+
private const val BLUEPRINT_NAME = "pnf_config"
private val BLUEPRINT_BASE_DIR = Paths.get(UAT_BLUEPRINTS_BASE_DIR, BLUEPRINT_NAME)
private val UAT_PATH = BLUEPRINT_BASE_DIR.resolve(UAT_SPECIFICATION_FILE)
@@ -223,11 +224,14 @@ class UatServicesTest : BaseUatTest() {
for (response in expectation.responses) {
val responseDefinitionBuilder: ResponseDefinitionBuilder = aResponse()
- .withStatus(response.status)
+ .withStatus(response.status)
if (response.body != null) {
responseDefinitionBuilder.withBody(mapper.writeValueAsBytes(response.body))
- .withHeaders(HttpHeaders(
- response.headers.entries.map { e -> HttpHeader(e.key, e.value) }))
+ .withHeaders(
+ HttpHeaders(
+ response.headers.entries.map { e -> HttpHeader(e.key, e.value) }
+ )
+ )
}
// TODO: MockServer verification for multiple responses should be done using Wiremock scenarios
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/error/ErrorCatalogServiceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/error/ErrorCatalogServiceTest.kt
index 4f7ef0ec2..f00eb9d5f 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/error/ErrorCatalogServiceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/error/ErrorCatalogServiceTest.kt
@@ -35,10 +35,11 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [ErrorCatalogTestConfiguration::class]
+ classes = [ErrorCatalogTestConfiguration::class]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ErrorCatalogServiceTest {
+
@Autowired
lateinit var errorCatalogService: ErrorCatalogService
@@ -52,46 +53,74 @@ class ErrorCatalogServiceTest {
@BeforeTest
fun setup() {
errorType = ErrorCatalogCodes.GENERIC_FAILURE
- errorCatalogHttp = ErrorCatalog(errorType, domain, 500,
- "Contact CDS administrator team.", "Internal error in Blueprint Processor run time.")
- errorCatalogGrpc = ErrorCatalog(errorType, domain, 2,
- "Contact CDS administrator team.", "Internal error in Blueprint Processor run time.")
+ errorCatalogHttp = ErrorCatalog(
+ errorType, domain, 500,
+ "Contact CDS administrator team.", "Internal error in Blueprint Processor run time."
+ )
+ errorCatalogGrpc = ErrorCatalog(
+ errorType, domain, 2,
+ "Contact CDS administrator team.", "Internal error in Blueprint Processor run time."
+ )
- errorPayloadHttp = ErrorPayload(500, ErrorCatalogCodes.GENERIC_FAILURE,
- "Cause: Internal error in Blueprint Processor run time. \n Action : Contact CDS administrator team.",
- errorMessage = ErrorMessage("org.onap.ccsdk.cds.blueprintsprocessor",
- "Internal error in Blueprint Processor run time.", ""))
- errorPayloadGrpc = ErrorPayload(2, ErrorCatalogCodes.GENERIC_FAILURE,
- "Cause: Internal error in Blueprint Processor run time. \n Action : Contact CDS administrator team.",
- errorMessage = ErrorMessage("org.onap.ccsdk.cds.blueprintsprocessor",
- "Internal error in Blueprint Processor run time.", ""))
+ errorPayloadHttp = ErrorPayload(
+ 500, ErrorCatalogCodes.GENERIC_FAILURE,
+ "Cause: Internal error in Blueprint Processor run time. \n Action : Contact CDS administrator team.",
+ errorMessage = ErrorMessage(
+ "org.onap.ccsdk.cds.blueprintsprocessor",
+ "Internal error in Blueprint Processor run time.", ""
+ )
+ )
+ errorPayloadGrpc = ErrorPayload(
+ 2, ErrorCatalogCodes.GENERIC_FAILURE,
+ "Cause: Internal error in Blueprint Processor run time. \n Action : Contact CDS administrator team.",
+ errorMessage = ErrorMessage(
+ "org.onap.ccsdk.cds.blueprintsprocessor",
+ "Internal error in Blueprint Processor run time.", ""
+ )
+ )
}
@Test
fun errorPayloadHttp() {
- val errorPayload = errorCatalogService.errorPayload(httpProcessorException(errorType, domain,
- "Internal error in Blueprint Processor run time."))
+ val errorPayload = errorCatalogService.errorPayload(
+ httpProcessorException(
+ errorType, domain,
+ "Internal error in Blueprint Processor run time."
+ )
+ )
assertTrue { errorPayload.isEqualTo(errorPayloadHttp) }
}
@Test
fun errorPayloadGrpc() {
- val errorPayload = errorCatalogService.errorPayload(grpcProcessorException(errorType, domain,
- "Internal error in Blueprint Processor run time."))
+ val errorPayload = errorCatalogService.errorPayload(
+ grpcProcessorException(
+ errorType, domain,
+ "Internal error in Blueprint Processor run time."
+ )
+ )
assertTrue { errorPayload.isEqualTo(errorPayloadGrpc) }
}
@Test
fun getErrorCatalogHttp() {
- val errorCatalog = errorCatalogService.getErrorCatalog(httpProcessorException(errorType, domain,
- "Internal error in Blueprint Processor run time."))
+ val errorCatalog = errorCatalogService.getErrorCatalog(
+ httpProcessorException(
+ errorType, domain,
+ "Internal error in Blueprint Processor run time."
+ )
+ )
assertTrue { errorCatalog == errorCatalogHttp }
}
@Test
fun getErrorCatalogGrpc() {
- val errorCatalog = errorCatalogService.getErrorCatalog(grpcProcessorException(errorType, domain,
- "Internal error in Blueprint Processor run time."))
+ val errorCatalog = errorCatalogService.getErrorCatalog(
+ grpcProcessorException(
+ errorType, domain,
+ "Internal error in Blueprint Processor run time."
+ )
+ )
assertTrue { errorCatalog == errorCatalogGrpc }
}
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
index cad235450..e5d924d36 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
@@ -24,6 +24,7 @@ import ch.qos.logback.core.sift.AbstractDiscriminator
import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.MDC_COLOR_KEY
class SmartColorDiscriminator : AbstractDiscriminator<ILoggingEvent>() {
+
var defaultValue: String = "white"
override fun getKey(): String {
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/ExtendedTemporaryFolder.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/ExtendedTemporaryFolder.kt
index 9090361fb..dd31c0e8f 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/ExtendedTemporaryFolder.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/ExtendedTemporaryFolder.kt
@@ -29,6 +29,7 @@ import java.nio.file.attribute.BasicFileAttributes
import javax.annotation.PreDestroy
class ExtendedTemporaryFolder {
+
private val tempFolder = createTempDir("uat")
@PreDestroy
@@ -49,12 +50,15 @@ class ExtendedTemporaryFolder {
* Delete all files under the root temporary folder recursively. The folders are preserved.
*/
fun deleteAllFiles() {
- Files.walkFileTree(tempFolder.toPath(), object : SimpleFileVisitor<Path>() {
- @Throws(IOException::class)
- override fun visitFile(file: Path?, attrs: BasicFileAttributes?): FileVisitResult {
- file?.toFile()?.delete()
- return FileVisitResult.CONTINUE
+ Files.walkFileTree(
+ tempFolder.toPath(),
+ object : SimpleFileVisitor<Path>() {
+ @Throws(IOException::class)
+ override fun visitFile(file: Path?, attrs: BasicFileAttributes?): FileVisitResult {
+ file?.toFile()?.delete()
+ return FileVisitResult.CONTINUE
+ }
}
- })
+ )
}
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt
index e6198b1ba..a4320e654 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt
@@ -38,6 +38,7 @@ class MarkedSlf4jNotifier(private val marker: Marker) : Notifier {
}
companion object {
+
private val log = LoggerFactory.getLogger("uat.WireMock")
}
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/TestSecuritySettings.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/TestSecuritySettings.kt
index 888ab8dcd..eec36c88d 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/TestSecuritySettings.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/TestSecuritySettings.kt
@@ -26,6 +26,7 @@ import org.springframework.util.Base64Utils
class TestSecuritySettings {
companion object {
+
private const val authUsername = "walter.white"
private const val authPassword = "Heisenberg"
@@ -34,6 +35,7 @@ class TestSecuritySettings {
}
class ServerContextInitializer : ApplicationContextInitializer<ConfigurableApplicationContext> {
+
override fun initialize(context: ConfigurableApplicationContext) {
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(
context,