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

Spring code samples refresh + overall refresh of deps #702

Merged
Merged
Show file tree
Hide file tree
Changes from 7 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
11 changes: 11 additions & 0 deletions .run/Template JUnit.run.xml
JackPGreen marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="true" type="JUnit" factoryName="JUnit">
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Djava.net.preferIPv4Stack=true" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,13 @@ private Config createMemberConfig(String storeName, String memberRealmAllowedSan
.setProperty("hazelcast.phone.home.enabled", "false");
JoinConfig joinConfig = config.getNetworkConfig().getJoin();
joinConfig.getTcpIpConfig().setEnabled(true).addMember("127.0.0.1");
config.getNetworkConfig().setSSLConfig(new SSLConfig()).getSSLConfig().setEnabled(true)
.setProperty("mutualAuthentication", "REQUIRED") //
.setProperty("keyStore", "src/" + storeName + ".p12") //
.setProperty("keyStorePassword", "123456") //
.setProperty("trustStore", "src/ca.p12") //
.setProperty("trustStorePassword", "123456");
SSLConfig sslConf = config.getNetworkConfig().setSSLConfig(new SSLConfig()).getSSLConfig();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason: my local JDK got confused with types there, it's safer to extract a variable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JDK or IDE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JDK (built via maven)

sslConf.setEnabled(true)
.setProperty("mutualAuthentication", "REQUIRED") //
.setProperty("keyStore", "src/" + storeName + ".p12") //
.setProperty("keyStorePassword", "123456") //
.setProperty("trustStore", "src/ca.p12") //
.setProperty("trustStorePassword", "123456");
SecurityConfig securityConfig = config.getSecurityConfig().setEnabled(true);
securityConfig.setMemberRealmConfig("memberRealm",
new RealmConfig().setJaasAuthenticationConfig(new JaasAuthenticationConfig().addLoginModuleConfig(
Expand Down
33 changes: 30 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,27 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
<argLine>-Djava.net.preferIPv4Stack=true</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.5.2</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<phase>integration-test</phase>
</execution>
</executions>
<configuration>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
<argLine>-Djava.net.preferIPv4Stack=true</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -195,19 +216,25 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.0</version>
<version>5.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.10.0</version>
<version>5.11.4</version>
TomaszGaweda marked this conversation as resolved.
Show resolved Hide resolved
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.0</version>
<version>5.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>1.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
3 changes: 2 additions & 1 deletion serialization/hazelcast-airlines/grid-node/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
<version>0.1-SNAPSHOT</version>
</dependency>


TomaszGaweda marked this conversation as resolved.
Show resolved Hide resolved
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell</artifactId>
<artifactId>spring-shell-starter</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hazelcast.samples.serialization.hazelcast.airlines;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.shell.Bootstrap;

/**
* <p>Use Spring Boot and Spring Shell to build a Hazelcast
Expand All @@ -19,9 +19,9 @@ public class Application {
*
* @param args From command line
*/
public static void main(String[] args) throws Exception {
public static void main(String[] args) {
System.setProperty("hazelcast.logging.type", "slf4j");
Bootstrap.main(args);
SpringApplication.run(Application.class, args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import com.hazelcast.samples.serialization.hazelcast.airlines.util.Constants;
import com.hazelcast.samples.serialization.hazelcast.airlines.util.FlightBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.shell.core.CommandMarker;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;
import org.springframework.shell.command.annotation.Command;
import org.springframework.shell.command.annotation.Option;
import org.springframework.stereotype.Component;

import java.util.Arrays;
Expand All @@ -28,7 +27,7 @@
* </p>
*/
@Component
public class CLI implements CommandMarker {
public class CLI {

@Autowired
private HazelcastInstance hazelcastInstance;
Expand Down Expand Up @@ -59,12 +58,12 @@ public class CLI implements CommandMarker {
* @param name Who to book the seat for
* @return The seat booked
*/
@CliCommand(value = "BOOK",
help = "BOOK A SEAT ON A FLIGHT")
@Command(command = "BOOK",
description = "BOOK A SEAT ON A FLIGHT")
public String loading(
@CliOption(key = {"CODE"}, mandatory = true, help = "THE FLIGHT TO BOOK ONTO")
@Option(label = "CODE", required = true, description = "THE FLIGHT TO BOOK ONTO")
String code,
@CliOption(key = {"NAME"}, mandatory = true, help = "WHO TO BOOK ONTO THE FLIGHT")
@Option(label = "NAME", required = true, description = "WHO TO BOOK ONTO THE FLIGHT")
String name
) {
IMap<MyKey, AbstractFlight> flightsMap = this.hazelcastInstance.getMap(Constants.IMAP_FLIGHTS);
Expand Down Expand Up @@ -96,10 +95,10 @@ public String loading(
* @param code The flight code, Date is hardcoded
* @return Flight if found
*/
@CliCommand(value = "GET",
help = "RETRIEVE A FLIGHT")
@Command(command = "GET",
description = "RETRIEVE A FLIGHT")
public String get(
@CliOption(key = {"CODE"}, mandatory = true) String code
@Option(label = "CODE", required = true) String code
) {
IMap<MyKey, AbstractFlight> flightsMap = this.hazelcastInstance.getMap(Constants.IMAP_FLIGHTS);

Expand All @@ -119,12 +118,12 @@ public String get(
* <p>List the stored flights, keys are {@link java.lang.Comparable} so sort before printing.
* </p>
*/
@CliCommand(value = "KEYS",
help = "DISPLAY THE STORED FLIGHTS")
@Command(command = "KEYS",
description = "DISPLAY THE STORED FLIGHTS")
public String keys() {
IMap<MyKey, AbstractFlight> flightsMap = this.hazelcastInstance.getMap(Constants.IMAP_FLIGHTS);

Set<MyKey> keys = flightsMap.keySet().stream().collect(Collectors.toCollection(TreeSet::new));
Set<MyKey> keys = new TreeSet<>(flightsMap.keySet());

keys.forEach(key -> System.out.println(" -> " + key));

Expand All @@ -143,10 +142,10 @@ public String keys() {
* @param code The flight code, Date is hardcoded
* @return How many passengers
*/
@CliCommand(value = "LOADING",
help = "HOW MANY SEATS ARE IN USE ON A FLIGHT")
@Command(command = "LOADING",
description = "HOW MANY SEATS ARE IN USE ON A FLIGHT")
public String loading(
@CliOption(key = {"CODE"}, mandatory = true) String code
@Option(label = "CODE", required = true) String code
) {
IMap<MyKey, AbstractFlight> flightsMap = this.hazelcastInstance.getMap(Constants.IMAP_FLIGHTS);

Expand All @@ -168,8 +167,8 @@ public String loading(
* <p>Load test data into the cluster.
* </p>
*/
@CliCommand(value = "TESTDATA",
help = "INJECT TEST DATA INTO THE CLUSTER")
@Command(command = "TESTDATA",
description = "INJECT TEST DATA INTO THE CLUSTER")
public String testData() {
IMap<MyKey, AbstractFlight> hazelcastMap = this.hazelcastInstance.getMap(Constants.IMAP_FLIGHTS);
StringBuilder sb = new StringBuilder();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
logging.level.root=OFF
spring.main.banner-mode=off
spring.main.web-application-type=none
spring.shell.interactive.enabled=true
TomaszGaweda marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 16 additions & 3 deletions serialization/hazelcast-airlines/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<main.basedir>${project.parent.parent.basedir}</main.basedir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<hazelcast.version>4.0</hazelcast.version>
<hazelcast.version>5.5.0</hazelcast.version>
<kryo.version>4.0.0</kryo.version>
<spring-shell.version>1.2.0.RELEASE</spring-shell.version>
<spring-shell.version>3.4.0</spring-shell.version>
</properties>

<modules>
Expand Down Expand Up @@ -52,14 +52,27 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.platform</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell</artifactId>
<artifactId>spring-shell-dependencies</artifactId>
<version>${spring-shell.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
Expand Down
6 changes: 6 additions & 0 deletions serialization/hazelcast-airlines/the-code/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.11.4</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.hazelcast.samples.serialization.hazelcast.airlines.util.FlightBuilder;
import com.hazelcast.samples.serialization.hazelcast.airlines.util.MyDataSerializableFactory;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.AbstractMap.SimpleEntry;
import java.util.Map.Entry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.hazelcast.samples.serialization.hazelcast.airlines.util.FlightBuilder;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.hazelcast.samples.serialization.hazelcast.airlines.util.FlightBuilder;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.hazelcast.internal.serialization.SerializationService;
import com.hazelcast.samples.serialization.hazelcast.airlines.util.FlightBuilder;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.hazelcast.samples.serialization.hazelcast.airlines.util.FlightBuilder;
import com.hazelcast.samples.serialization.hazelcast.airlines.util.MyDataSerializableFactory;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.hazelcast.internal.serialization.SerializationService;
import com.hazelcast.samples.serialization.hazelcast.airlines.util.FlightBuilder;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;

Expand Down
26 changes: 23 additions & 3 deletions spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,24 @@
<version>0.1-SNAPSHOT</version>
</parent>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<properties>
<!-- needed for checkstyle/findbugs -->
<main.basedir>${project.parent.basedir}</main.basedir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<spring.boot.version>3.4.2</spring.boot.version>
</properties>

<modules>
Expand All @@ -49,16 +63,22 @@
</modules>

<dependencies>
<dependency>
<groupId>com.hazelcast.samples</groupId>
<artifactId>helper</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<version>${hazelcast.version}</version>
</dependency>

<!-- needed for spring test -->
<dependency>
<groupId>com.hazelcast.samples</groupId>
<artifactId>helper</artifactId>
<version>${project.version}</version>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.3.4</version>
</dependency>
</dependencies>
</project>
Loading
Loading