diff options
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons')
9 files changed, 38 insertions, 73 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/nats-lib/pom.xml index f4e7f4d98..f28a7132e 100644 --- a/ms/blueprintsprocessor/modules/commons/nats-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/nats-lib/pom.xml @@ -14,7 +14,6 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> 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/HazlecastClusterService.kt index 6be3334bb..a58c077fa 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/HazlecastClusterService.kt @@ -243,8 +243,11 @@ open class ClusterLockImpl(private val hazelcast: HazelcastInstance, private val } override suspend fun unLock() { - distributedLock.unlock() - log.trace("Cluster unlock(${name()}) successfully..") + // 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..") + } } override fun isLocked(): Boolean { 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/HazlecastClusterServiceTest.kt index b298eacae..80cf41558 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/HazlecastClusterServiceTest.kt @@ -113,7 +113,7 @@ class HazlecastClusterServiceTest { } else { ClusterInfo( id = "test-cluster", nodeId = nodeId, joinAsClient = false, - configFile = "./src/test/resources/hazelcast/hazelcast-$port.yaml", + configFile = "./src/test/resources/hazelcast/hazelcast-cluster.yaml", properties = properties ) } @@ -162,7 +162,7 @@ class HazlecastClusterServiceTest { executeLock(bluePrintClusterServices[0], "first", lockName) } val deferred2 = async { - executeLock(bluePrintClusterServices[0], "second", lockName) + executeLock(bluePrintClusterServices[1], "second", lockName) } val deferred3 = async { executeLock(bluePrintClusterServices[2], "third", lockName) diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5679.yaml b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5679.yaml deleted file mode 100644 index e7ac273ed..000000000 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5679.yaml +++ /dev/null @@ -1,21 +0,0 @@ -hazelcast: - cluster-name: ${CLUSTER_ID} - instance-name: node-5679 - lite-member: - enabled: false - cp-subsystem: - cp-member-count: 3 - group-size: 3 - session-time-to-live-seconds: 60 - session-heartbeat-interval-seconds: 5 - missing-cp-member-auto-removal-seconds: 120 -# network: -# join: -# multicast: -# enabled: false -# kubernetes: -# enabled: true -# namespace: MY-KUBERNETES-NAMESPACE -# service-name: MY-SERVICE-NAME -# service-label-name: MY-SERVICE-LABEL-NAME -# service-label-value: MY-SERVICE-LABEL-VALUE
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5680.yaml b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5680.yaml deleted file mode 100644 index cb493d169..000000000 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5680.yaml +++ /dev/null @@ -1,21 +0,0 @@ -hazelcast: - cluster-name: ${CLUSTER_ID} - instance-name: node-5680 - lite-member: - enabled: false - cp-subsystem: - cp-member-count: 3 - group-size: 3 - session-time-to-live-seconds: 60 - session-heartbeat-interval-seconds: 5 - missing-cp-member-auto-removal-seconds: 120 -# network: -# join: -# multicast: -# enabled: false -# kubernetes: -# enabled: true -# namespace: MY-KUBERNETES-NAMESPACE -# service-name: MY-SERVICE-NAME -# service-label-name: MY-SERVICE-LABEL-NAME -# service-label-value: MY-SERVICE-LABEL-VALUE
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5681.yaml b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5681.yaml deleted file mode 100644 index e60b0c506..000000000 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5681.yaml +++ /dev/null @@ -1,21 +0,0 @@ -hazelcast: - cluster-name: ${CLUSTER_ID} - instance-name: node-5681 - lite-member: - enabled: false - cp-subsystem: - cp-member-count: 3 - group-size: 3 - session-time-to-live-seconds: 60 - session-heartbeat-interval-seconds: 5 - missing-cp-member-auto-removal-seconds: 120 -# network: -# join: -# multicast: -# enabled: false -# kubernetes: -# enabled: true -# namespace: MY-KUBERNETES-NAMESPACE -# service-name: MY-SERVICE-NAME -# service-label-name: MY-SERVICE-LABEL-NAME -# service-label-value: MY-SERVICE-LABEL-VALUE
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5682.yaml b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5682.yaml index 3cb10a08b..859ea3328 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5682.yaml +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5682.yaml @@ -9,10 +9,11 @@ hazelcast: session-time-to-live-seconds: 60 session-heartbeat-interval-seconds: 5 missing-cp-member-auto-removal-seconds: 120 -# network: -# join: -# multicast: -# enabled: false + network: + join: + multicast: + enabled: true + multicast-group: 224.0.0.1 # kubernetes: # enabled: true # namespace: MY-KUBERNETES-NAMESPACE 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 new file mode 100644 index 000000000..de6047a90 --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-cluster.yaml @@ -0,0 +1,23 @@ +hazelcast: + lite-member: + enabled: false + cp-subsystem: + cp-member-count: 3 + group-size: 3 + session-time-to-live-seconds: 60 + session-heartbeat-interval-seconds: 5 + missing-cp-member-auto-removal-seconds: 120 + network: + join: + multicast: + enabled: true + # 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 + multicast-group: 224.0.0.1 + # kubernetes: + # enabled: true + # namespace: MY-KUBERNETES-NAMESPACE + # service-name: MY-SERVICE-NAME + # service-label-name: MY-SERVICE-LABEL-NAME + # service-label-value: MY-SERVICE-LABEL-VALUE diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt index 540b3d9ad..bfc0a5cd4 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt @@ -20,6 +20,7 @@ import org.apache.http.message.BasicHeader import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties import org.springframework.http.HttpHeaders import org.springframework.http.MediaType +import java.net.URI import java.nio.charset.Charset import java.util.Base64 @@ -43,7 +44,8 @@ class BasicAuthRestClientService( } override fun host(uri: String): String { - return restClientProperties.url + uri + val uri: URI = URI.create(restClientProperties.url + uri) + return uri.resolve(uri).toString() } override fun convertToBasicHeaders(headers: Map<String, String>): |