Search in sources :

Example 6 with Version

use of com.hazelcast.version.Version in project hazelcast by hazelcast.

the class DefaultNodeExtensionTest method test_clusterVersionListener_invokedWithOverriddenPropertyValue_whenClusterVersionIsNull.

@Test
public void test_clusterVersionListener_invokedWithOverriddenPropertyValue_whenClusterVersionIsNull() throws UnknownHostException, NoSuchFieldException, IllegalAccessException {
    // override initial cluster version
    System.setProperty(GroupProperty.INIT_CLUSTER_VERSION.getName(), "2.1.7");
    final CountDownLatch latch = new CountDownLatch(1);
    final AtomicBoolean failed = new AtomicBoolean(false);
    ClusterVersionListener listener = new ClusterVersionListener() {

        @Override
        public void onClusterVersionChange(Version newVersion) {
            if (!newVersion.equals(Version.of("2.1.7"))) {
                failed.set(true);
            }
            latch.countDown();
        }
    };
    makeClusterVersionUnknownAndVerifyListener(latch, failed, listener);
    System.clearProperty(GroupProperty.INIT_CLUSTER_VERSION.getName());
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Version(com.hazelcast.version.Version) MemberVersion(com.hazelcast.version.MemberVersion) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterVersionListener(com.hazelcast.internal.cluster.ClusterVersionListener) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 7 with Version

use of com.hazelcast.version.Version in project hazelcast by hazelcast.

the class DefaultNodeExtensionTest method test_nodeVersionNotCompatibleWith_otherMajorVersion.

@Test
public void test_nodeVersionNotCompatibleWith_otherMajorVersion() {
    MemberVersion currentVersion = getNode(hazelcastInstance).getVersion();
    Version majorPlusOne = Version.of(currentVersion.getMajor() + 1, currentVersion.getMinor());
    assertFalse(nodeExtension.isNodeVersionCompatibleWith(majorPlusOne));
}
Also used : Version(com.hazelcast.version.Version) MemberVersion(com.hazelcast.version.MemberVersion) MemberVersion(com.hazelcast.version.MemberVersion) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 8 with Version

use of com.hazelcast.version.Version in project hazelcast by hazelcast.

the class DefaultNodeExtensionTest method test_clusterVersionListener_invokedOnRegistration.

@Test
public void test_clusterVersionListener_invokedOnRegistration() throws UnknownHostException {
    final CountDownLatch latch = new CountDownLatch(1);
    ClusterVersionListener listener = new ClusterVersionListener() {

        @Override
        public void onClusterVersionChange(Version newVersion) {
            latch.countDown();
        }
    };
    assertTrue(nodeExtension.registerListener(listener));
    assertOpenEventually(latch);
}
Also used : Version(com.hazelcast.version.Version) MemberVersion(com.hazelcast.version.MemberVersion) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterVersionListener(com.hazelcast.internal.cluster.ClusterVersionListener) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 9 with Version

use of com.hazelcast.version.Version in project hazelcast by hazelcast.

the class ClusterVersionChangeTest method test_clusterVersionUpgradeFails_whenNodeMinorVersionPlusOne.

@Test
public void test_clusterVersionUpgradeFails_whenNodeMinorVersionPlusOne() {
    Version newVersion = Version.of(codebaseVersion.getMajor(), codebaseVersion.getMinor() + 1);
    expectedException.expect(VersionMismatchException.class);
    cluster.changeClusterVersion(newVersion);
}
Also used : MemberVersion(com.hazelcast.version.MemberVersion) Version(com.hazelcast.version.Version) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 10 with Version

use of com.hazelcast.version.Version in project hazelcast by hazelcast.

the class ClusterVersionInitTest method test_clusterVersion_isEventuallySet_whenSingleNodeMulticastJoinerCluster.

@Test
public void test_clusterVersion_isEventuallySet_whenSingleNodeMulticastJoinerCluster() {
    Config config = new Config();
    config.getGroupConfig().setName(randomName());
    config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(true);
    setupInstance(config);
    assertEqualsEventually(new Callable<Version>() {

        @Override
        public Version call() throws Exception {
            return cluster.getClusterVersion();
        }
    }, codebaseVersion.asVersion());
}
Also used : MemberVersion(com.hazelcast.version.MemberVersion) Version(com.hazelcast.version.Version) Config(com.hazelcast.config.Config) ExpectedException(org.junit.rules.ExpectedException) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

Version (com.hazelcast.version.Version)20 ParallelTest (com.hazelcast.test.annotation.ParallelTest)17 QuickTest (com.hazelcast.test.annotation.QuickTest)17 Test (org.junit.Test)17 MemberVersion (com.hazelcast.version.MemberVersion)16 Config (com.hazelcast.config.Config)5 ExpectedException (org.junit.rules.ExpectedException)5 ClusterState (com.hazelcast.cluster.ClusterState)3 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 ClusterVersionListener (com.hazelcast.internal.cluster.ClusterVersionListener)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 CacheStatisticsImpl (com.hazelcast.cache.impl.CacheStatisticsImpl)1 GroupConfig (com.hazelcast.config.GroupConfig)1 BackupTaskStatus (com.hazelcast.hotrestart.BackupTaskStatus)1 MemberImpl (com.hazelcast.instance.MemberImpl)1 Node (com.hazelcast.instance.Node)1 ClusterService (com.hazelcast.internal.cluster.ClusterService)1 MemberInfo (com.hazelcast.internal.cluster.MemberInfo)1 AuthenticationFailureOperation (com.hazelcast.internal.cluster.impl.operations.AuthenticationFailureOperation)1 AuthorizationOperation (com.hazelcast.internal.cluster.impl.operations.AuthorizationOperation)1