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

[f9JEXqx3] Clean up some docker deprecated config and java deprecated functions values #624

Merged
merged 1 commit into from
May 17, 2024
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
2 changes: 1 addition & 1 deletion core/src/test/java/apoc/index/SchemaIndexTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static void setUp() {
.map(i -> i % 100)
.sorted()
.distinct()
.mapToObj(Long::new)
.mapToObj(Long::valueOf)
.collect(Collectors.toList());
try (Transaction tx = db.beginTx()) {
tx.schema().awaitIndexesOnline(2, TimeUnit.SECONDS);
Expand Down
19 changes: 8 additions & 11 deletions core/src/test/java/apoc/number/NumbersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,19 @@ public void testFormat() {

@Test
public void testParseInt() {
testCall(
db,
"RETURN apoc.number.parseInt('12,345') AS value",
row -> assertEquals(new Long(12345), row.get("value")));
testCall(db, "RETURN apoc.number.parseInt('12,345') AS value", row -> assertEquals(12345L, row.get("value")));
testCall(
db,
"RETURN apoc.number.parseInt('12.345', '' ,'it') AS value",
row -> assertEquals(new Long(12345), row.get("value")));
row -> assertEquals(12345L, row.get("value")));
testCall(
db,
"RETURN apoc.number.parseInt('12,345', '#,##0.00;(#,##0.00)') AS value",
row -> assertEquals(new Long(12345), row.get("value")));
row -> assertEquals(12345L, row.get("value")));
testCall(
db,
"RETURN apoc.number.parseInt('12.345', '#,##0.00;(#,##0.00)', 'it') AS value",
row -> assertEquals(new Long(12345), row.get("value")));
row -> assertEquals(12345L, row.get("value")));
testCall(db, "RETURN apoc.number.parseInt('aaa') AS value", row -> assertEquals(null, row.get("value")));
testCall(db, "RETURN apoc.number.parseInt(null) AS value", row -> assertNull(row.get("value")));
}
Expand All @@ -119,19 +116,19 @@ public void testParseFloat() {
testCall(
db,
"RETURN apoc.number.parseFloat('12,345.67') AS value",
row -> assertEquals(new Double(12345.67), row.get("value")));
row -> assertEquals(12345.67, row.get("value")));
testCall(
db,
"RETURN apoc.number.parseFloat('12.345,67', '', 'it') AS value",
row -> assertEquals(new Double(12345.67), row.get("value")));
row -> assertEquals(12345.67, row.get("value")));
testCall(
db,
"RETURN apoc.number.parseFloat('12,345.67', '#,##0.00;(#,##0.00)') AS value",
row -> assertEquals(new Double(12345.67), row.get("value")));
row -> assertEquals(12345.67, row.get("value")));
testCall(
db,
"RETURN apoc.number.parseFloat('12.345,67', '#,##0.00;(#,##0.00)', 'it') AS value",
row -> assertEquals(new Double(12345.67), row.get("value")));
row -> assertEquals(12345.67, row.get("value")));
testCall(db, "RETURN apoc.number.parseFloat('aaa') AS value", row -> assertEquals(null, row.get("value")));
testCall(db, "RETURN apoc.number.parseFloat(null) AS value", row -> assertNull(row.get("value")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private static boolean dbIsWriter(String dbName, Session session, String boltAdd
}

private static String getBoltAddress(Neo4jContainerExtension instance) {
return instance.getEnvMap().get("NEO4J_dbms_connector_bolt_advertised__address");
return instance.getEnvMap().get("NEO4J_server_bolt_advertised__address");
}

private static Session getSessionForDb(Neo4jContainerExtension instance, String dbName) {
Expand Down
4 changes: 2 additions & 2 deletions test-utils/src/main/java/apoc/util/TestContainerUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ private static Neo4jContainerExtension createNeo4jContainer(
.withEnv("NEO4J_ACCEPT_LICENSE_AGREEMENT", "yes")
.withEnv("apoc.export.file.enabled", "true")
.withEnv("apoc.import.file.enabled", "true")
.withNeo4jConfig("dbms.memory.heap.max_size", "512M")
.withNeo4jConfig("dbms.memory.pagecache.size", "256M")
.withNeo4jConfig("server.memory.heap.max_size", "512M")
.withNeo4jConfig("server.memory.pagecache.size", "256M")
.withNeo4jConfig("dbms.security.procedures.unrestricted", "apoc.*")
.withNeo4jConfig("dbms.logs.http.enabled", "true")
.withNeo4jConfig("dbms.logs.debug.level", "DEBUG")
Expand Down
26 changes: 14 additions & 12 deletions test-utils/src/main/java/apoc/util/TestcontainersCausalCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ public class TestcontainersCausalCluster {
private static final int DEFAULT_BOLT_PORT = 7687;

public enum ClusterInstanceType {
CORE(DEFAULT_BOLT_PORT),
READ_REPLICA(DEFAULT_BOLT_PORT + 1000);
CORE(DEFAULT_BOLT_PORT, "PRIMARY"),
READ_REPLICA(DEFAULT_BOLT_PORT + 1000, "SECONDARY");

private final int port;
private final String mode;

ClusterInstanceType(int port) {
ClusterInstanceType(int port, String mode) {
this.port = port;
this.mode = mode;
}
}

Expand Down Expand Up @@ -118,9 +120,9 @@ public static TestcontainersCausalCluster create(
// but by default from 5.x onwards not every database is allocated in every instance
// so the endpoint would return 404 and we would not complete container startup
.withNeo4jConfig("initial.dbms.default_primaries_count", Integer.toString(numberOfCoreMembers))
.withNeo4jConfig("dbms.default_advertised_address", member.getValue())
.withNeo4jConfig("server.default_advertised_address", member.getValue())
.withNeo4jConfig(
"dbms.connector.bolt.advertised_address",
"server.bolt.advertised_address",
String.format(
"%s:%d",
proxy.getContainerIpAddress(),
Expand All @@ -137,7 +139,7 @@ public static TestcontainersCausalCluster create(
envSettings)
.withNeo4jConfig("dbms.default_advertised_address", member.getValue())
.withNeo4jConfig(
"dbms.connector.bolt.advertised_address",
"server.bolt.advertised_address",
String.format(
"%s:%d",
proxy.getContainerIpAddress(),
Expand Down Expand Up @@ -174,16 +176,16 @@ private static Neo4jContainerExtension createInstance(
.withNetwork(network)
.withNetworkAliases(name)
.withCreateContainerCmdModifier(cmd -> cmd.withHostName(name))
.withNeo4jConfig("dbms.mode", instanceType.toString())
.withNeo4jConfig("dbms.default_listen_address", "0.0.0.0")
.withNeo4jConfig("causal_clustering.leadership_balancing", "NO_BALANCING")
.withNeo4jConfig("causal_clustering.initial_discovery_members", initialDiscoveryMembers)
.withNeo4jConfig("initial.server.mode_constraint", instanceType.mode)
.withNeo4jConfig("server.default_listen_address", "0.0.0.0")
.withNeo4jConfig("dbms.cluster.raft.leader_transfer.balancing_strategy", "NO_BALANCING")
.withNeo4jConfig("dbms.cluster.discovery.endpoints", initialDiscoveryMembers)
.withStartupTimeout(Duration.ofMinutes(MINUTES_TO_WAIT));
if (withRoutingEnabled(envSettings)) {
container
.withEnv("NEO4J_dbms_routing_listen__address", "0.0.0.0:7618")
.withEnv("NEO4J_server_routing_listen__address", "0.0.0.0:7618")
.withEnv("NEO4J_dbms_routing_default__router", "SERVER")
.withEnv("NEO4J_dbms_routing_advertised__address", name + ":7618");
.withEnv("NEO4J_server_routing_advertised__address", name + ":7618");
} else {
container.withoutDriver();
}
Expand Down
Loading