From f7c75c83bcb2ec819c06131db5723b7319e4a030 Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Tue, 9 Apr 2024 18:48:23 +0200 Subject: [PATCH] bug5990: made com.sap.sse.landscape.aws.test an eclipse-test-plugin --- java/com.sap.sse.landscape.aws.test/pom.xml | 2 +- .../com/sap/sse/landscape/aws/ConnectivityTest.java | 2 ++ .../src/com/sap/sse/landscape/aws/MongoTests.java | 2 ++ .../sap/sse/landscape/aws/MongoUriParserTest.java | 12 ++++++------ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/java/com.sap.sse.landscape.aws.test/pom.xml b/java/com.sap.sse.landscape.aws.test/pom.xml index fa315a84f15..07e3947ecc3 100755 --- a/java/com.sap.sse.landscape.aws.test/pom.xml +++ b/java/com.sap.sse.landscape.aws.test/pom.xml @@ -8,7 +8,7 @@ 1.0.0-SNAPSHOT com.sap.sse.landscape.aws.test - eclipse-plugin + eclipse-test-plugin diff --git a/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/ConnectivityTest.java b/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/ConnectivityTest.java index 97e6a6d3c69..79fa959b2ec 100755 --- a/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/ConnectivityTest.java +++ b/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/ConnectivityTest.java @@ -24,6 +24,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import com.jcraft.jsch.ChannelSftp; @@ -87,6 +88,7 @@ import software.amazon.awssdk.services.sts.model.Credentials; * @author Axel Uhl (D043530) * */ +@Ignore("Needs AWS key ID, key secret and session token in system properties") public class ConnectivityTest> { private static final Logger logger = Logger.getLogger(ConnectivityTest.class.getName()); private static final Optional optionalTimeout = Optional.of(Duration.ONE_MINUTE.times(10)); diff --git a/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/MongoTests.java b/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/MongoTests.java index 3024a5a7d12..2ad1ed255ca 100755 --- a/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/MongoTests.java +++ b/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/MongoTests.java @@ -13,6 +13,7 @@ import java.util.Random; import org.bson.Document; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.mockito.Mockito; @@ -26,6 +27,7 @@ import com.sap.sse.landscape.mongodb.impl.MongoProcessImpl; import com.sap.sse.landscape.mongodb.impl.MongoProcessInReplicaSetImpl; import com.sap.sse.landscape.mongodb.impl.MongoReplicaSetImpl; +@Ignore("Needs a specific MongoDB replica set named 'rs0' in the environment") public class MongoTests { private static final Optional optionalTimeout = Optional.of(Duration.ONE_MINUTE.times(5)); diff --git a/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/MongoUriParserTest.java b/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/MongoUriParserTest.java index 7ed87077afc..358af4a7446 100755 --- a/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/MongoUriParserTest.java +++ b/java/com.sap.sse.landscape.aws.test/src/com/sap/sse/landscape/aws/MongoUriParserTest.java @@ -25,7 +25,7 @@ import com.sap.sse.landscape.mongodb.MongoProcessInReplicaSet; import com.sap.sse.landscape.mongodb.MongoReplicaSet; public class MongoUriParserTest { - private static final String WWW_EXAMPLE_COM = "www.example.com"; + private static final String WWW_EXAMPLE_COM = "127.0.0.2"; private MongoUriParser parser; @SuppressWarnings("unchecked") @@ -36,7 +36,7 @@ public class MongoUriParserTest { final AwsInstance host1 = mock(AwsInstance.class); when(host1.getPublicAddress()).thenReturn(wwwExampleCom); when(host1.getPrivateAddress()).thenReturn(wwwExampleCom); - when(landscape.getHostByPublicIpAddress(ArgumentMatchers.any(Region.class), ArgumentMatchers.contains(wwwExampleCom.getHostAddress()), ArgumentMatchers.any(HostSupplier.class))).thenReturn(host1); + when(landscape.getHostByPrivateIpAddress(ArgumentMatchers.any(Region.class), ArgumentMatchers.contains(wwwExampleCom.getHostAddress()), ArgumentMatchers.any(HostSupplier.class))).thenReturn(host1); final InetAddress loopback = InetAddress.getLoopbackAddress(); final AwsInstance host2 = mock(AwsInstance.class); when(host2.getPrivateAddress()).thenReturn(loopback); @@ -46,25 +46,25 @@ public class MongoUriParserTest { @Test public void testSimpleSingleNodeUri() throws URISyntaxException, UnknownHostException { - final String hostname = WWW_EXAMPLE_COM; + final String hostname = "127.0.0.1"; final String dbName = "myDb"; final Database database = parser.parseMongoUri("mongodb://"+hostname+"/"+dbName); assertFalse(database.getEndpoint().isReplicaSet()); final MongoProcess mongoProcess = database.getEndpoint().asMongoProcess(); - assertEquals(InetAddress.getByName(WWW_EXAMPLE_COM).getHostAddress(), mongoProcess.getHostname()); + assertEquals(hostname, mongoProcess.getHostname()); assertEquals(27017, mongoProcess.getPort()); assertEquals(dbName, database.getName()); } @Test public void testSimpleSingleNodeUriWithExplicitPort() throws URISyntaxException, UnknownHostException { - final String hostname = WWW_EXAMPLE_COM; + final String hostname = "127.0.0.1"; final int port = 10202; final String dbName = "myDb"; final Database database = parser.parseMongoUri("mongodb://"+hostname+":"+port+"/"+dbName); assertFalse(database.getEndpoint().isReplicaSet()); final MongoProcess mongoProcess = database.getEndpoint().asMongoProcess(); - assertEquals(InetAddress.getByName(WWW_EXAMPLE_COM).getHostAddress(), mongoProcess.getHostname()); + assertEquals(InetAddress.getByName(hostname).getHostAddress(), mongoProcess.getHostname()); assertEquals(port, mongoProcess.getPort()); assertEquals(dbName, database.getName()); }