From 167c1e756c2435bdaacac7e127e7cb40aa76cfd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Chicchiricc=C3=B2?= Date: Mon, 30 Dec 2024 14:17:10 +0100 Subject: [PATCH] Restoring Windows compatibility --- .../jpa/inner/ConnInstanceTest.java | 27 ++++--------------- .../neo4j/inner/ConnInstanceTest.java | 27 ++++--------------- 2 files changed, 10 insertions(+), 44 deletions(-) diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java index 159b4a0c4f..18476fdf94 100644 --- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java +++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java @@ -24,7 +24,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -88,27 +87,16 @@ public void findById() { } @Test - public void save() throws ClassNotFoundException { + public void save() { ConnInstance connInstance = entityFactory.newEntity(ConnInstance.class); - - connInstance.setLocation(Path.of(System.getProperty("java.io.tmpdir")).toUri().toString()); - - // set connector version + connInstance.setLocation("file:" + System.getProperty("java.io.tmpdir")); connInstance.setVersion("1.0"); - - // set connector name connInstance.setConnectorName("WebService"); - - // set bundle name connInstance.setBundleName("org.apache.syncope.core.persistence.test.util"); - connInstance.setDisplayName("New"); - connInstance.setConnRequestTimeout(60); - // set the connector configuration using PropertyTO - List conf = new ArrayList<>(); - + // set the connector configuration ConnConfPropSchema endpointSchema = new ConnConfPropSchema(); endpointSchema.setName("endpoint"); endpointSchema.setType(String.class.getName()); @@ -125,10 +113,9 @@ public void save() throws ClassNotFoundException { servicename.setSchema(servicenameSchema); endpoint.getValues().add("Provisioning"); + List conf = new ArrayList<>(); conf.add(endpoint); conf.add(servicename); - - // set connector configuration connInstance.setConf(conf); assertFalse(connInstance.getConf().isEmpty()); @@ -147,11 +134,7 @@ public void save() throws ClassNotFoundException { assertEquals(60, actual.getConnRequestTimeout().intValue()); - conf = connInstance.getConf(); - assertFalse(conf.isEmpty()); - - assertNotNull(conf); - assertEquals(2, conf.size()); + assertEquals(2, connInstance.getConf().size()); } @Test diff --git a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/ConnInstanceTest.java b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/ConnInstanceTest.java index 91b2c16b1f..d9f5414726 100644 --- a/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/ConnInstanceTest.java +++ b/core/persistence-neo4j/src/test/java/org/apache/syncope/core/persistence/neo4j/inner/ConnInstanceTest.java @@ -24,7 +24,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -88,27 +87,16 @@ public void findById() { } @Test - public void save() throws ClassNotFoundException { + public void save() { ConnInstance connInstance = entityFactory.newEntity(ConnInstance.class); - - connInstance.setLocation(Path.of(System.getProperty("java.io.tmpdir")).toUri().toString()); - - // set connector version + connInstance.setLocation("file:" + System.getProperty("java.io.tmpdir")); connInstance.setVersion("1.0"); - - // set connector name connInstance.setConnectorName("WebService"); - - // set bundle name connInstance.setBundleName("org.apache.syncope.core.persistence.test.util"); - connInstance.setDisplayName("New"); - connInstance.setConnRequestTimeout(60); - // set the connector configuration using PropertyTO - List conf = new ArrayList<>(); - + // set the connector configuration ConnConfPropSchema endpointSchema = new ConnConfPropSchema(); endpointSchema.setName("endpoint"); endpointSchema.setType(String.class.getName()); @@ -125,10 +113,9 @@ public void save() throws ClassNotFoundException { servicename.setSchema(servicenameSchema); endpoint.getValues().add("Provisioning"); + List conf = new ArrayList<>(); conf.add(endpoint); conf.add(servicename); - - // set connector configuration connInstance.setConf(conf); assertFalse(connInstance.getConf().isEmpty()); @@ -147,11 +134,7 @@ public void save() throws ClassNotFoundException { assertEquals(60, actual.getConnRequestTimeout().intValue()); - conf = connInstance.getConf(); - assertFalse(conf.isEmpty()); - - assertNotNull(conf); - assertEquals(2, conf.size()); + assertEquals(2, connInstance.getConf().size()); } @Test