Skip to content

Commit

Permalink
Use com.hazelcast:hazelcast:5.1.5 instead of com.hazelcast:hazelcast:…
Browse files Browse the repository at this point in the history
…5.2.1
  • Loading branch information
linghengqian committed Jan 10, 2023
1 parent 6f3eb79 commit 45cb593
Show file tree
Hide file tree
Showing 24 changed files with 31 additions and 86 deletions.
4 changes: 2 additions & 2 deletions metadata/com.hazelcast/hazelcast/index.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[
{
"latest": true,
"metadata-version": "5.2.1",
"metadata-version": "5.1.5",
"module": "com.hazelcast:hazelcast",
"tested-versions": [
"5.2.1"
"5.1.5"
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ dependencies {
testImplementation 'javax.cache:cache-api:1.1.1'
}

test {
jvmArgs = Arrays.asList("-Xmx4g")
}

graalvmNative {
agent {
defaultMode = "conditional"
Expand Down
2 changes: 2 additions & 0 deletions tests/src/com.hazelcast/hazelcast/5.1.5/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
library.version = 5.1.5
metadata.dir = com.hazelcast/hazelcast/5.1.5/
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
import javax.cache.Cache;
import javax.cache.CacheManager;
import javax.cache.Caching;
import javax.cache.configuration.CompleteConfiguration;
import javax.cache.configuration.MutableConfiguration;
import javax.cache.expiry.AccessedExpiryPolicy;
import javax.cache.expiry.Duration;
import javax.cache.spi.CachingProvider;
import java.util.Collection;
import java.util.List;
import java.util.Set;
Expand All @@ -62,6 +64,7 @@ static void beforeAll() {

@AfterAll
static void afterAll() {
HazelcastClient.shutdown(hazelcastInstance);
hazelcastInstance.shutdown();
}

Expand All @@ -71,7 +74,7 @@ void testAtomicLong() {
IAtomicLong counter = client.getCPSubsystem().getAtomicLong("counter");
counter.addAndGet(3);
assertThat(counter.get()).isEqualTo(3);
client.shutdown();

}

@Test
Expand All @@ -80,24 +83,21 @@ void testCustomSerializer() {
clientConfig.getSerializationConfig().addSerializerConfig(new SerializerConfig()
.setImplementation(new CustomSerializer())
.setTypeClass(CustomSerializable.class));
HazelcastInstance hz = HazelcastClient.newHazelcastClient(clientConfig);
hz.shutdown();
HazelcastClient.newHazelcastClient(clientConfig);
}

@Test
void testGlobalSerializer() {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSerializationConfig().setGlobalSerializerConfig(new GlobalSerializerConfig().setImplementation(new GlobalSerializer()));
HazelcastInstance hz = HazelcastClient.newHazelcastClient(clientConfig);
hz.shutdown();
HazelcastClient.newHazelcastClient(clientConfig);
}

@Test
void testIdentifiedDataSerializable() {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSerializationConfig().addDataSerializableFactory(SampleDataSerializableFactory.FACTORY_ID, new SampleDataSerializableFactory());
HazelcastInstance hz = HazelcastClient.newHazelcastClient(clientConfig);
hz.shutdown();
HazelcastClient.newHazelcastClient(clientConfig);
}

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -127,7 +127,6 @@ void testList() {
assertThat(list.remove(0)).isEqualTo("item1");
assertThat(list.size()).isEqualTo(1);
list.clear();
client.shutdown();
}

@Test
Expand All @@ -146,7 +145,6 @@ void testLock() {
} finally {
lock.unlock();
}
client.shutdown();
}

@Test
Expand All @@ -159,7 +157,6 @@ void testMap() {
map.replace("key", "value", "newValue");
assertThat(map.get("someKey")).isEqualTo("someValue");
assertThat(map.get("key")).isEqualTo("newValue");
client.shutdown();
}

@Test
Expand All @@ -172,15 +169,13 @@ void testMultiMap() {
assertThat(multiMap.get("my-key").toString()).contains("value2", "value1", "value3");
multiMap.remove("my-key", "value2");
assertThat(multiMap.get("my-key").toString()).contains("value1", "value3");
client.shutdown();
}

@Test
void testPortableSerializable() {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSerializationConfig().addPortableFactory(SamplePortableFactory.FACTORY_ID, new SamplePortableFactory());
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
client.shutdown();
HazelcastClient.newHazelcastClient(clientConfig);
}

@Test
Expand All @@ -198,7 +193,6 @@ void testQuery() {
Collection<User> result2 = users.values(and(equal("active", true), between("age", 18, 21)));
assertThat(result1).contains(rod, jane);
assertThat(result2).contains(rod, jane);
client.shutdown();
}

@Test
Expand All @@ -211,7 +205,6 @@ void testQueue() throws InterruptedException {
queue.poll(5, TimeUnit.SECONDS);
queue.put("yetAnotherItem");
assertThat(queue.take()).isEqualTo("yetAnotherItem");
client.shutdown();
}

@Test
Expand All @@ -220,7 +213,6 @@ void testReplicatedMap() {
ReplicatedMap<String, String> map = client.getReplicatedMap("my-replicated-map");
assertThat(map.put("key", "value")).isNull();
assertThat(map.get("key")).isEqualTo("value");
client.shutdown();
}

@Test
Expand All @@ -233,7 +225,6 @@ void testRingBuffer() throws InterruptedException {
assertThat(rb.readOne(sequence)).isEqualTo(100);
sequence++;
assertThat(rb.readOne(sequence)).isEqualTo(200);
client.shutdown();
}

@Test
Expand All @@ -245,7 +236,6 @@ void testSet() {
set.add("item3");
assertThat(set).contains("item1", "item2", "item3");
assertThat(set.size()).isEqualTo(3);
client.shutdown();
}

@Test
Expand All @@ -254,6 +244,22 @@ void testTopic() {
ITopic<Object> topic = client.getTopic("my-distributed-topic");
topic.addMessageListener(message -> assertThat(message.getMessageObject()).isEqualTo("Hello to distributed world"));
IntStream.range(0, 3).mapToObj(i -> "Hello to distributed world").forEach(topic::publish);
client.shutdown();
}

@Test
void testJCacheOrigin() {
CachingProvider cachingProvider = Caching.getCachingProvider(HazelcastCachingProvider.class.getName());
CacheManager cacheManager = cachingProvider.getCacheManager();
CompleteConfiguration<String, String> config = new MutableConfiguration<String, String>()
.setTypes(String.class, String.class)
.setStatisticsEnabled(true)
.setReadThrough(false)
.setManagementEnabled(true)
.setStoreByValue(false)
.setWriteThrough(false);
Cache<String, String> cache = cacheManager.createCache("example", config);
cache.put("world", "Hello World");
assertThat(cache.get("world")).isEqualTo("Hello World");
assertThat(cacheManager.getCache("example", String.class, String.class)).isNotNull();
}
}
2 changes: 0 additions & 2 deletions tests/src/com.hazelcast/hazelcast/5.2.1/gradle.properties

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions tests/src/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@
]
},
{
"test-project-path": "com.hazelcast/hazelcast/5.2.1",
"test-project-path": "com.hazelcast/hazelcast/5.1.5",
"libraries": [
{
"name": "com.hazelcast:hazelcast",
"versions": [
"5.2.1"
"5.1.5"
]
}
]
Expand Down

0 comments on commit 45cb593

Please sign in to comment.