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());
}
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));
}
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);
}
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);
}
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());
}
Aggregations