mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-17 11:19:15 +00:00
bug5990: made com.sap.sse.landscape.aws.test an eclipse-test-plugin
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.sap.sse.landscape.aws.test</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
<!-- Enable the following if there is a valid AWS SDK key available in the test execution environment:
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
-->
|
||||
|
||||
+2
@@ -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<ProcessT extends AwsApplicationProcess<String, SailingAnalyticsMetrics, ProcessT>> {
|
||||
private static final Logger logger = Logger.getLogger(ConnectivityTest.class.getName());
|
||||
private static final Optional<Duration> optionalTimeout = Optional.of(Duration.ONE_MINUTE.times(10));
|
||||
|
||||
@@ -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<Duration> optionalTimeout = Optional.of(Duration.ONE_MINUTE.times(5));
|
||||
|
||||
|
||||
+6
-6
@@ -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<String> parser;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -36,7 +36,7 @@ public class MongoUriParserTest {
|
||||
final AwsInstance<String> 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<String> 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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user