import org.junit.After
import org.junit.Before
import org.junit.Test
-import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BlueprintClusterMessage
-import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BlueprintClusterService
+import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BluePrintClusterMessage
+import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BluePrintClusterService
import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BlueprintClusterMessageListener
import org.onap.ccsdk.cds.blueprintsprocessor.core.service.ClusterInfo
-import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
@Test
fun testClientFileSystemYamlConfig() {
- System.setProperty(BlueprintConstants.PROPERTY_CLUSTER_ID, "test-cluster")
- System.setProperty(BlueprintConstants.PROPERTY_CLUSTER_NODE_ID, "node-1234")
+ System.setProperty(BluePrintConstants.PROPERTY_CLUSTER_ID, "test-cluster")
+ System.setProperty(BluePrintConstants.PROPERTY_CLUSTER_NODE_ID, "node-1234")
System.setProperty(
"hazelcast.client.config",
normalizedFile("./src/test/resources/hazelcast/hazelcast-client.yaml").absolutePath
@Test
fun testServerFileSystemYamlConfig() {
- System.setProperty(BlueprintConstants.PROPERTY_CLUSTER_ID, "test-cluster")
- System.setProperty(BlueprintConstants.PROPERTY_CLUSTER_NODE_ID, "node-1234")
+ System.setProperty(BluePrintConstants.PROPERTY_CLUSTER_ID, "test-cluster")
+ System.setProperty(BluePrintConstants.PROPERTY_CLUSTER_NODE_ID, "node-1234")
val configFile = normalizedFile("./src/test/resources/hazelcast/hazelcast.yaml")
val config = FileSystemYamlConfig(configFile)
assertNotNull(config)
}
}
- private suspend fun testMessageReceived(bluePrintClusterServices: List<BlueprintClusterService>) {
+ private suspend fun testMessageReceived(bluePrintClusterServices: List<BluePrintClusterService>) {
val sender = bluePrintClusterServices[0] as HazelcastClusterService
val receiver = bluePrintClusterServices[1] as HazelcastClusterService
val messageSent = "hello world"
val uuid = receiver.addBlueprintClusterMessageListener(
BlueprintClusterTopic.BLUEPRINT_CLEAN_COMPILER_CACHE,
object : BlueprintClusterMessageListener<String> {
- override fun onMessage(message: BlueprintClusterMessage<String>?) {
+ override fun onMessage(message: BluePrintClusterMessage<String>?) {
log.info("Message received - ${message?.payload}")
isMessageReceived = messageSent == message?.payload
}
private suspend fun createCluster(
ids: List<Int>,
joinAsClient: Boolean? = false
- ): List<BlueprintClusterService> {
+ ): List<BluePrintClusterService> {
return withContext(Dispatchers.Default) {
val deferred = ids.map { id ->
}
}
- private suspend fun testDistributedStore(bluePrintClusterServices: List<BlueprintClusterService>) {
+ private suspend fun testDistributedStore(bluePrintClusterServices: List<BluePrintClusterService>) {
/** Test Distributed store creation */
repeat(2) { storeId ->
val store = bluePrintClusterServices[0].clusterMapStore<JsonNode>(
}
}
- private suspend fun testDistributedLock(bluePrintClusterServices: List<BlueprintClusterService>) {
+ private suspend fun testDistributedLock(bluePrintClusterServices: List<BluePrintClusterService>) {
val lockName = "sample-lock"
withContext(Dispatchers.IO) {
val deferred = async {
}
private suspend fun executeLock(
- bluePrintClusterService: BlueprintClusterService,
+ bluePrintClusterService: BluePrintClusterService,
lockId: String,
lockName: String
) {
distributedLock.close()
}
- private suspend fun executeScheduler(bluePrintClusterService: BlueprintClusterService) {
+ private suspend fun executeScheduler(bluePrintClusterService: BluePrintClusterService) {
log.info("initialising ...")
val hazelcastClusterService = bluePrintClusterService as HazelcastClusterService
// scheduler.scheduleOnAllMembersAtFixedRate(SampleSchedulerTask(), 0, 5, TimeUnit.SECONDS)
}
- private suspend fun printReachableMembers(bluePrintClusterServices: List<BlueprintClusterService>) {
+ private suspend fun printReachableMembers(bluePrintClusterServices: List<BluePrintClusterService>) {
bluePrintClusterServices.forEach { bluePrintClusterService ->
val hazelcastClusterService = bluePrintClusterService as HazelcastClusterService
val hazelcast = hazelcastClusterService.hazelcast