aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html6
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts23
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.html2
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts32
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.html5
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.ts11
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensions.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt (renamed from ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterService.kt)19
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterUtils.kt (renamed from ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterUtils.kt)4
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt (renamed from ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterServiceTest.kt)79
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-cluster.yaml7
12 files changed, 104 insertions, 89 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html
index cdc73f1b9..e1b0f83d6 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.html
@@ -1,12 +1,12 @@
<div class="row template-mapping-action">
<div class="col">
<h6 [hidden]="edit" class="create-title">Create Template</h6>
- <button (click)="closeCreationForm()" [hidden]="!edit" class="btn btn-outline-secondary"><i
+ <button (click)="openListView()" [hidden]="!edit" class="btn btn-outline-secondary"><i
class="fa fa-chevron-left mr-2"></i>Template List</button>
</div>
<div class="col text-right">
- <button data-toggle="modal" [hidden]="!edit" (click)="initDelete()" data-target="#templateDeletionModal2"
+ <button data-toggle="modal" [hidden]="!edit" data-target="#templateDeletionModal2"
class="btn btn-outline-danger" title="Delete Template">Delete</button>
@@ -301,4 +301,4 @@
</div>
</div>
</div>
-</div>
+</div> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts
index f6bae0600..af7acc2d0 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-creation/templ-mapp-creation.component.ts
@@ -18,11 +18,11 @@ declare var $: any;
styleUrls: ['./templ-mapp-creation.component.css']
})
export class TemplMappCreationComponent implements OnInit, OnDestroy {
- @Output() showListViewParent = new EventEmitter<any>();
- @Output() openList = new EventEmitter<any>();
+ @Output() showListView = new EventEmitter<any>();
+ @Output() showCreationView = new EventEmitter<any>();
public uploadedFiles: FileSystemFileEntry[] = [];
- private fileNames: Set<string> = new Set();
- private jsonConvert = new JsonConvert();
+ fileNames: Set<string> = new Set();
+ jsonConvert = new JsonConvert();
public files: NgxFileDropEntry[] = [];
fileName: any;
templateInfo = new TemplateInfo();
@@ -179,8 +179,6 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy {
this.uploadedFiles.splice(index, 1);
}
- initDelete(file) {
- }
confirmDelete() {
// Delete from templates
this.sharedService.deleteFromList(this.fileName);
@@ -191,7 +189,7 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy {
this.packageCreationStore.state.templates.files.size > 0 ||
this.packageCreationStore.state.mapping.files.size > 0
) {
- this.closeCreationForm();
+ this.openListView();
}
}
@@ -267,11 +265,13 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy {
}
openListView() {
- this.showListViewParent.emit('tell parent to open create views');
+ console.log('open List view');
+ this.showListView.emit('tell parent to open create views');
}
- closeCreationForm() {
- this.openList.emit('close create form and open list');
+ openCreationView() {
+ console.log('close creation view');
+ this.showCreationView.emit('close create form and open list');
}
getMappingTableFromTemplate(e) {
@@ -337,7 +337,7 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy {
// }
this.fileName = '';
this.toastr.success('File is created', 'success');
- this.closeCreationForm();
+ this.openListView();
} else {
console.log('this file already exist');
this.toastr.error('File name already exist', 'Error');
@@ -351,6 +351,7 @@ export class TemplMappCreationComponent implements OnInit, OnDestroy {
selectSource(dict, e) {
const source = e.target.value;
let keyDepend = null;
+ this.dependancies.set(dict.name, null);
try {
keyDepend = dict.definition.sources[source].properties['key-dependencies'] || null;
} catch (e) { }
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.html
index e49b25a0c..3e377981e 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.html
@@ -1,4 +1,4 @@
-<a (click)="openCreationView()" class="create-template-mapping-button">
+<a (click)="createNewTemplate()" class="create-template-mapping-button">
<i class="fa fa-plus"></i> <span>Create Template</span>
</a>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts
index c790422c1..26740f3e1 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/templ-mapp-listing/templ-mapp-listing.component.ts
@@ -13,11 +13,11 @@ import { SharedService } from '../shared-service';
styleUrls: ['./templ-mapp-listing.component.css']
})
export class TemplMappListingComponent implements OnInit {
- @Output() showCreationViewParentNotification = new EventEmitter<any>();
- @Output() showFullView = new EventEmitter<any>();
- private templateAndMappingMap = new Map<string, TemplateAndMapping>();
- private templates: Template;
- private mapping: Mapping;
+ @Output() showCreationView = new EventEmitter<any>();
+ @Output() showListView = new EventEmitter<any>();
+ templateAndMappingMap = new Map<string, TemplateAndMapping>();
+ templates: Template;
+ mapping: Mapping;
isCreate = true;
currentFile: string;
edit = false;
@@ -40,6 +40,11 @@ export class TemplMappListingComponent implements OnInit {
}
this.packageCreationStore.state$.subscribe(cba => {
+ if (this.packageCreationStore.state.mapping.files.size > 0 || this.packageCreationStore.state.templates.files.size > 0) {
+ this.openListView();
+ } else {
+ this.openCreationView();
+ }
if (cba.templates) {
this.templates = cba.templates;
this.mapping = cba.mapping;
@@ -58,7 +63,6 @@ export class TemplMappListingComponent implements OnInit {
const isFromTemplate = false;
this.setIsMappingOrTemplate(key, templateAndMapping, isFromTemplate);
});
- console.log('hello there ');
console.log(this.templateAndMappingMap);
}
this.deleteFromList();
@@ -83,6 +87,7 @@ export class TemplMappListingComponent implements OnInit {
console.log('response from actionList');
console.log(res);
if (res) {
+ console.log('xccccccccccvvvvvv');
this.templateAndMappingMap.delete(res);
if (this.templateAndMappingMap.size <= 0) {
this.openCreationView();
@@ -91,14 +96,17 @@ export class TemplMappListingComponent implements OnInit {
});
}
+ createNewTemplate() {
+ this.openCreationView();
+ this.sharedService.disableEdit();
+ }
openCreationView() {
- this.showCreationViewParentNotification.emit('tell parent to open create views');
+ this.showCreationView.emit('tell parent to open create views');
console.log('disable edit mode');
- this.sharedService.disableEdit();
-
}
- FullView() {
- this.showFullView.emit('show full view');
+ openListView() {
+ console.log('open list view');
+ this.showListView.emit('show full view');
}
setSourceCodeEditor(key: string) {
@@ -125,7 +133,7 @@ export class TemplMappListingComponent implements OnInit {
templateInfo.type += 'mapping';
}
this.templateStore.changeTemplateInfo(templateInfo);
- this.FullView();
+ this.openCreationView();
this.sharedService.enableEdit();
});
}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.html
index f4f305ee9..48a503321 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.html
@@ -1,10 +1,9 @@
<div [hidden]="listView">
- <app-templ-mapp-listing [hidden]="!creationView" (showCreationViewParentNotification)="openCreationView($event)"
- (showFullView)="openListView($event)">
+ <app-templ-mapp-listing (showCreationView)="openCreationView()" (showListView)="openListView()">
</app-templ-mapp-listing>
</div>
<div [hidden]="creationView">
- <app-templ-mapp-creation (showListViewParent)="openListView($event)" (openList)="closeCreationView()">
+ <app-templ-mapp-creation (showListView)="openListView()" (showCreationView)="openCreationView()">
</app-templ-mapp-creation>
</div> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.ts
index af6ced092..470cf27a0 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/template-mapping.component.ts
@@ -27,9 +27,6 @@ export class TemplateMappingComponent implements OnInit {
this.listView = false;
console.log('URL contains Id');
this.sharedService.enableEdit();
- if (this.pakcageStore.state.mapping.files.size > 0 || this.pakcageStore.state.templates.files.size > 0) {
- this.openListView();
- }
} else {
console.log('Create mode');
this.pakcageStore.clear();
@@ -37,18 +34,16 @@ export class TemplateMappingComponent implements OnInit {
}
}
openCreationView() {
+ console.log('open creation view');
this.creationView = false;
this.listView = true;
}
openListView() {
- this.listView = false;
- this.creationView = false;
- }
-
- closeCreationView() {
+ console.log('open list view');
this.creationView = true;
this.listView = false;
+
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensions.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensions.kt
index 81fc0d709..0a58857f7 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensions.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensions.kt
@@ -29,10 +29,10 @@ import org.onap.ccsdk.cds.controllerblueprints.core.MDCContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
/**
- * Exposed Dependency Service by this Hazlecast Lib Module
+ * Exposed Dependency Service by this Hazelcast Lib Module
*/
fun BluePrintDependencyService.clusterService(): BluePrintClusterService =
- instance(HazlecastClusterService::class)
+ instance(HazelcastClusterService::class)
/** Optional Cluster Service, returns only if Cluster is enabled */
fun BluePrintDependencyService.optionalClusterService(): BluePrintClusterService? {
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterService.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt
index feb2a8e2a..d3c88d732 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterService.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt
@@ -45,9 +45,9 @@ import java.time.Duration
import java.util.concurrent.TimeUnit
@Service
-open class HazlecastClusterService : BluePrintClusterService {
+open class HazelcastClusterService : BluePrintClusterService {
- private val log = logger(HazlecastClusterService::class)
+ private val log = logger(HazelcastClusterService::class)
lateinit var hazelcast: HazelcastInstance
lateinit var cpSubsystemManagementService: CPSubsystemManagementService
var joinedClient = false
@@ -179,14 +179,14 @@ open class HazlecastClusterService : BluePrintClusterService {
override suspend fun shutDown(duration: Duration) {
if (::hazelcast.isInitialized && clusterJoined()) {
delay(duration.toMillis())
- HazlecastClusterUtils.terminate(hazelcast)
+ HazelcastClusterUtils.terminate(hazelcast)
}
}
/** Utils */
suspend fun promoteAsCPMember(hazelcastInstance: HazelcastInstance) {
if (!joinedClient && !joinedLite) {
- HazlecastClusterUtils.promoteAsCPMember(hazelcastInstance)
+ HazelcastClusterUtils.promoteAsCPMember(hazelcastInstance)
}
}
@@ -243,17 +243,18 @@ open class ClusterLockImpl(private val hazelcast: HazelcastInstance, private val
}
override suspend fun unLock() {
- // Added condition to avoid failures like - "Current thread is not owner of the lock!"
- if (distributedLock.isLockedByCurrentThread) {
- distributedLock.unlock()
- log.trace("Cluster unlock(${name()}) successfully..")
- }
+ distributedLock.unlock()
+ log.trace("Cluster unlock(${name()}) successfully..")
}
override fun isLocked(): Boolean {
return distributedLock.isLocked
}
+ override fun isLockedByCurrentThread(): Boolean {
+ return distributedLock.isLockedByCurrentThread
+ }
+
override suspend fun fenceLock(): String {
val fence = distributedLock.lockAndGetFence()
log.trace("Cluster lock($name) fence($fence) created..")
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterUtils.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterUtils.kt
index 70970f6da..e5f488a0e 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterUtils.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterUtils.kt
@@ -25,9 +25,9 @@ import org.onap.ccsdk.cds.controllerblueprints.core.logger
import java.util.UUID
import java.util.concurrent.TimeUnit
-object HazlecastClusterUtils {
+object HazelcastClusterUtils {
- private val log = logger(HazlecastClusterUtils::class)
+ private val log = logger(HazelcastClusterUtils::class)
/** Promote [hazelcastInstance] member to CP Member */
fun promoteAsCPMember(hazelcastInstance: HazelcastInstance) {
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt
index 9725553a5..2d957c289 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt
@@ -78,6 +78,7 @@ interface ClusterLock {
suspend fun tryFenceLock(timeout: Long): String
suspend fun unLock()
fun isLocked(): Boolean
+ fun isLockedByCurrentThread(): Boolean
fun close()
}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterServiceTest.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt
index 80cf41558..e214b6593 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt
@@ -20,13 +20,17 @@ import com.fasterxml.jackson.databind.JsonNode
import com.hazelcast.client.config.YamlClientConfigBuilder
import com.hazelcast.cluster.Member
import com.hazelcast.config.FileSystemYamlConfig
+import com.hazelcast.instance.impl.HazelcastInstanceFactory
import com.hazelcast.map.IMap
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.delay
+import kotlinx.coroutines.newSingleThreadContext
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
+import org.junit.After
+import org.junit.Before
import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BluePrintClusterService
import org.onap.ccsdk.cds.blueprintsprocessor.core.service.ClusterInfo
@@ -35,16 +39,21 @@ import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import java.io.Serializable
-import java.time.Duration
import java.util.Properties
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
-class HazlecastClusterServiceTest {
- private val log = logger(HazlecastClusterServiceTest::class)
+class HazelcastClusterServiceTest {
+ private val log = logger(HazelcastClusterServiceTest::class)
private val clusterSize = 3
+ @Before
+ @After
+ fun killAllHazelcastInstances() {
+ HazelcastInstanceFactory.terminateAll()
+ }
+
@Test
fun testClientFileSystemYamlConfig() {
System.setProperty(BluePrintConstants.PROPERTY_CLUSTER_ID, "test-cluster")
@@ -74,33 +83,23 @@ class HazlecastClusterServiceTest {
fun testClusterJoin() {
runBlocking {
val bluePrintClusterServiceOne =
- createCluster(arrayListOf(5679, 5680, 5681)).toMutableList()
- // delay(1000)
- // Join as Hazlecast Management Node
- // val bluePrintClusterServiceTwo = createCluster(arrayListOf(5682), true)
- // val bluePrintClusterServiceTwo = createCluster(arrayListOf(5682), false)
- // bluePrintClusterServiceOne.addAll(bluePrintClusterServiceTwo)
+ createCluster(arrayListOf(1, 2, 3)).toMutableList()
printReachableMembers(bluePrintClusterServiceOne)
testDistributedStore(bluePrintClusterServiceOne)
testDistributedLock(bluePrintClusterServiceOne)
-
- // executeScheduler(bluePrintClusterServiceOne[0])
- // delay(1000)
- // Shutdown
- shutdown(bluePrintClusterServiceOne)
}
}
private suspend fun createCluster(
- ports: List<Int>,
+ ids: List<Int>,
joinAsClient: Boolean? = false
): List<BluePrintClusterService> {
return withContext(Dispatchers.Default) {
- val deferred = ports.map { port ->
+ val deferred = ids.map { id ->
async(Dispatchers.IO) {
- val nodeId = "node-$port"
- log.info("********** Starting node($nodeId) on port($port)")
+ val nodeId = "node-$id"
+ log.info("********** Starting ($nodeId)")
val properties = Properties()
properties["hazelcast.logging.type"] = "slf4j"
val clusterInfo =
@@ -117,21 +116,15 @@ class HazlecastClusterServiceTest {
properties = properties
)
}
- val hazlecastClusterService = HazlecastClusterService()
- hazlecastClusterService.startCluster(clusterInfo)
- hazlecastClusterService
+ val hazelcastClusterService = HazelcastClusterService()
+ hazelcastClusterService.startCluster(clusterInfo)
+ hazelcastClusterService
}
}
deferred.awaitAll()
}
}
- private suspend fun shutdown(bluePrintClusterServices: List<BluePrintClusterService>) {
- bluePrintClusterServices.forEach { bluePrintClusterService ->
- bluePrintClusterService.shutDown(Duration.ofMillis(10))
- }
- }
-
private suspend fun testDistributedStore(bluePrintClusterServices: List<BluePrintClusterService>) {
/** Test Distributed store creation */
repeat(2) { storeId ->
@@ -159,13 +152,25 @@ class HazlecastClusterServiceTest {
val lockName = "sample-lock"
withContext(Dispatchers.IO) {
val deferred = async {
- executeLock(bluePrintClusterServices[0], "first", lockName)
+ newSingleThreadContext("first").use {
+ withContext(it) {
+ executeLock(bluePrintClusterServices[0], "first", lockName)
+ }
+ }
}
val deferred2 = async {
- executeLock(bluePrintClusterServices[1], "second", lockName)
+ newSingleThreadContext("second").use {
+ withContext(it) {
+ executeLock(bluePrintClusterServices[1], "second", lockName)
+ }
+ }
}
val deferred3 = async {
- executeLock(bluePrintClusterServices[2], "third", lockName)
+ newSingleThreadContext("third").use {
+ withContext(it) {
+ executeLock(bluePrintClusterServices[2], "third", lockName)
+ }
+ }
}
deferred.start()
deferred2.start()
@@ -195,12 +200,12 @@ class HazlecastClusterServiceTest {
private suspend fun executeScheduler(bluePrintClusterService: BluePrintClusterService) {
log.info("initialising ...")
- val hazlecastClusterService = bluePrintClusterService as HazlecastClusterService
+ val hazelcastClusterService = bluePrintClusterService as HazelcastClusterService
val memberNameMap = bluePrintClusterService.clusterMapStore<Member>("member-name-map") as IMap
assertEquals(3, memberNameMap.size, "failed to match member size")
memberNameMap.forEach { (key, value) -> log.info("nodeId($key), Member($value)") }
- val scheduler = hazlecastClusterService.clusterScheduler("cleanup")
+ val scheduler = hazelcastClusterService.clusterScheduler("cleanup")
// scheduler.scheduleOnAllMembers(SampleSchedulerTask(), 0, TimeUnit.SECONDS)
// scheduler.scheduleOnKeyOwnerAtFixedRate(SampleSchedulerTask(), "node-5680",0, 1, TimeUnit.SECONDS)
// scheduler.scheduleAtFixedRate(SampleSchedulerTask(), 0, 1, TimeUnit.SECONDS)
@@ -209,15 +214,15 @@ class HazlecastClusterServiceTest {
private suspend fun printReachableMembers(bluePrintClusterServices: List<BluePrintClusterService>) {
bluePrintClusterServices.forEach { bluePrintClusterService ->
- val hazlecastClusterService = bluePrintClusterService as HazlecastClusterService
- val hazelcast = hazlecastClusterService.hazelcast
+ val hazelcastClusterService = bluePrintClusterService as HazelcastClusterService
+ val hazelcast = hazelcastClusterService.hazelcast
val self = if (!bluePrintClusterService.isClient()) hazelcast.cluster.localMember else null
- val master = hazlecastClusterService.masterMember("system").memberAddress
- val members = hazlecastClusterService.allMembers().map { it.memberAddress }
+ val master = hazelcastClusterService.masterMember("system").memberAddress
+ val members = hazelcastClusterService.allMembers().map { it.memberAddress }
log.info("Cluster Members for($self): master($master) Members($members)")
}
- val applicationMembers = bluePrintClusterServices[0].applicationMembers("node-56")
+ val applicationMembers = bluePrintClusterServices[0].applicationMembers("node-")
assertEquals(clusterSize, applicationMembers.size, "failed to match applications member size")
log.info("Cluster applicationMembers ($applicationMembers)")
}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-cluster.yaml b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-cluster.yaml
index de6047a90..b4dc3454a 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-cluster.yaml
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-cluster.yaml
@@ -7,10 +7,15 @@ hazelcast:
session-time-to-live-seconds: 60
session-heartbeat-interval-seconds: 5
missing-cp-member-auto-removal-seconds: 120
+ metrics:
+ enabled: false
network:
join:
- multicast:
+ tcp-ip:
enabled: true
+ interface: 127.0.0.1
+ multicast:
+ enabled: false
# Specify 224.0.0.1 instead of default 224.2.2.3 since there's some issue
# on macOs with docker installed and multicast address different than 224.0.0.1
# https://stackoverflow.com/questions/46341715/hazelcast-multicast-does-not-work-because-of-vboxnet-which-is-used-by-docker-mac