Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make project JDK17 compatible #343

Merged
merged 6 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup JDK
uses: actions/[email protected]
with:
java-version: 8
java-version: 17
distribution: 'temurin'
cache: 'maven'

Expand All @@ -30,15 +30,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8' ]
module: [ 'hazelcast-hibernate53' ]
name: Build ${{ matrix.module }} with JDK ${{ matrix.java }}
name: Build ${{ matrix.module }}
steps:
- uses: actions/checkout@v3
- name: Setup JDK
uses: actions/[email protected]
with:
java-version: ${{ matrix.java }}
java-version: 17
distribution: 'temurin'
cache: 'maven'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build snapshot
name: Compatiblity Builds
on:
schedule:
- cron: '0 3 * * *'
Expand All @@ -8,9 +8,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '11' ]
hazelcast: [ '4.1.9','4.2.5' ,'5.0.3', '5.1.3', '5.2-SNAPSHOT' ]
hibernate: [ '5.3.28.Final', '5.4.33.Final','5.5.9.Final', '5.6.11.Final' ]
java: [ '17' ]
hazelcast: [ '4.1.9', '4.2.5', '5.0.3', '5.1.3', '5.2-SNAPSHOT' ]
hibernate: [ '5.3.28.Final', '5.4.33.Final', '5.5.9.Final', '5.6.11.Final' ]
name: Build against Hazelcast ${{ matrix.hazelcast }} and Hibernate ${{ matrix.hibernate }} with JDK ${{ matrix.java }}
steps:
- uses: actions/checkout@v3
Expand All @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11' ]
java: [ '8', '11', '17' ]
name: Build with JDK ${{ matrix.java }}
steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions hazelcast-hibernate53/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<javassist.version>3.29.1-GA</javassist.version>
<!-- needed for checkstyle/findbugs -->
<main.basedir>${project.parent.basedir}</main.basedir>
<jpms.module.name>com.hazelcast.hibernate53</jpms.module.name>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import java.util.Arrays;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import com.hazelcast.config.EvictionConfig;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.annotation.QuickTest;
import com.hazelcast.topic.ITopic;
import com.hazelcast.topic.Message;
import com.hazelcast.topic.MessageListener;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.annotation.QuickTest;
import org.hibernate.cache.cfg.spi.CollectionDataCachingConfig;
import org.hibernate.cache.cfg.spi.DomainDataRegionConfig;
import org.hibernate.cache.cfg.spi.EntityDataCachingConfig;
Expand All @@ -27,7 +27,17 @@
import java.util.UUID;
import java.util.function.Supplier;

import static org.mockito.Mockito.*;
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.isNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

@RunWith(HazelcastSerialClassRunner.class)
@Category(QuickTest.class)
Expand Down Expand Up @@ -153,7 +163,7 @@ public void testEvictionConfigIsNotDerivedFromMapConfig() {

verify(evictionConfig, atLeastOnce()).getMaxSize();
verify(evictionConfig, atLeastOnce()).getTimeToLive();
verifyZeroInteractions(mapConfig);
verifyNoInteractions(mapConfig);
}

// Verifies that the three-argument constructor still registers a listener with a topic if the HazelcastInstance
Expand All @@ -169,7 +179,7 @@ public void testThreeArgConstructorRegistersTopicListener() {
when(config.findMapConfig(eq(CACHE_NAME))).thenReturn(mapConfig);

ITopic<Object> topic = mock(ITopic.class);
when(topic.addMessageListener(isNotNull(MessageListener.class))).thenReturn(UUID.randomUUID());
when(topic.addMessageListener(isNotNull())).thenReturn(UUID.randomUUID());

HazelcastInstance instance = mock(HazelcastInstance.class);
when(instance.getConfig()).thenReturn(config);
Expand All @@ -179,7 +189,7 @@ public void testThreeArgConstructorRegistersTopicListener() {
verify(config).findMapConfig(eq(CACHE_NAME));
verify(instance).getConfig();
verify(instance).getTopic(eq(CACHE_NAME));
verify(topic).addMessageListener(isNotNull(MessageListener.class));
verify(topic).addMessageListener(isNotNull());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import java.util.UUID;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.eq;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
Expand Down Expand Up @@ -55,9 +55,6 @@ public void setup() {
when(mapConfig.getTimeToLiveSeconds()).thenReturn(5);
when(evictionConfig.getSize()).thenReturn(42);

// make the message appear that it is coming from a different member of the cluster
when(member.localMember()).thenReturn(false);

ArgumentCaptor<MessageListener> listener = ArgumentCaptor.forClass(MessageListener.class);
when(topic.addMessageListener(listener.capture())).thenReturn(UUID.randomUUID());
target = new TimestampsRegionCache(regionFactory, CACHE_NAME, instance);
Expand Down
10 changes: 7 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

<junit.version>4.13.2</junit.version>
<hamcrest.version>1.3</hamcrest.version>
<mockito.version>1.10.19</mockito.version>
<mockito.version>4.7.0</mockito.version>
<powermock.version>2.0.9</powermock.version>
<wiremock.version>2.27.2</wiremock.version>

Expand Down Expand Up @@ -226,6 +226,9 @@
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>${jpms.module.name}</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
Expand Down Expand Up @@ -294,7 +297,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -591,7 +594,8 @@
<configuration combine.self="override">
<parallel>none</parallel>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<argLine>-Xms128m -Xmx1G
<argLine>
-Xms128m -Xmx1G
-Dhazelcast.phone.home.enabled=false
-Dhazelcast.mancenter.enabled=false
-Dhazelcast.logging.type=none
Expand Down