Skip to content
Snippets Groups Projects
Commit a505dd0b authored by David Diederich's avatar David Diederich
Browse files

Add IBM Integration Tests to the pipeline

Squashed commits from trusted-ibm to avoid clutter in the repository
parent c0b440b6
No related branches found
No related tags found
1 merge request!7Add IBM Integration Tests to the pipeline
Pipeline #2351 passed
Showing
with 69 additions and 360 deletions
...@@ -28,3 +28,7 @@ analyze: ...@@ -28,3 +28,7 @@ analyze:
type: mvn type: mvn
target: provider/indexer-gcp/pom.xml target: provider/indexer-gcp/pom.xml
path: . path: .
- name: indexer-ibm
type: mvn
target: provider/indexer-ibm/pom.xml
path: .
...@@ -14,6 +14,9 @@ variables: ...@@ -14,6 +14,9 @@ variables:
GCP_DOMAIN: cloud.slb-ds.com GCP_DOMAIN: cloud.slb-ds.com
GCP_STORAGE_URL: https://osdu-indexer-dot-opendes.appspot.com/api/storage/v2/ GCP_STORAGE_URL: https://osdu-indexer-dot-opendes.appspot.com/api/storage/v2/
IBM_BUILD_SUBDIR: provider/indexer-ibm
IBM_INT_TEST_SUBDIR: testing/indexer-test-ibm
AZURE_SERVICE: indexer AZURE_SERVICE: indexer
AZURE_BUILD_SUBDIR: provider/indexer-azure AZURE_BUILD_SUBDIR: provider/indexer-azure
AZURE_TEST_SUBDIR: testing/indexer-test-azure AZURE_TEST_SUBDIR: testing/indexer-test-azure
...@@ -34,6 +37,9 @@ include: ...@@ -34,6 +37,9 @@ include:
- project: "osdu/platform/ci-cd-pipelines" - project: "osdu/platform/ci-cd-pipelines"
file: "cloud-providers/aws.yml" file: "cloud-providers/aws.yml"
- project: "osdu/platform/ci-cd-pipelines"
file: "cloud-providers/ibm.yml"
- project: "osdu/platform/ci-cd-pipelines" - project: "osdu/platform/ci-cd-pipelines"
file: "publishing/pages.yml" file: "publishing/pages.yml"
......
...@@ -11,6 +11,7 @@ The following software have components provided under the terms of this license: ...@@ -11,6 +11,7 @@ The following software have components provided under the terms of this license:
- Cobertura code coverage (from http://cobertura.sourceforge.net) - Cobertura code coverage (from http://cobertura.sourceforge.net)
- Plexus :: Default Container (from ) - Plexus :: Default Container (from )
- Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils) - Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils)
- StAX (from http://stax.codehaus.org/)
- oro (from ) - oro (from )
======================================================================== ========================================================================
...@@ -18,6 +19,8 @@ Apache-2.0 ...@@ -18,6 +19,8 @@ Apache-2.0
======================================================================== ========================================================================
The following software have components provided under the terms of this license: The following software have components provided under the terms of this license:
- AMQP 1.0 JMS Spring Boot AutoConfiguration (from https://repo1.maven.org/maven2/org/amqphub/spring/amqp-10-jms-spring-boot-autoconfigure)
- AMQP 1.0 JMS Spring Boot Starter (from https://repo1.maven.org/maven2/org/amqphub/spring/amqp-10-jms-spring-boot-starter)
- ASM Analysis (from ) - ASM Analysis (from )
- ASM Commons (from ) - ASM Commons (from )
- ASM Core (from ) - ASM Core (from )
...@@ -171,6 +174,7 @@ The following software have components provided under the terms of this license: ...@@ -171,6 +174,7 @@ The following software have components provided under the terms of this license:
- Apache Commons Text (from http://commons.apache.org/proper/commons-text/) - Apache Commons Text (from http://commons.apache.org/proper/commons-text/)
- Apache Commons Validator (from http://commons.apache.org/proper/commons-validator/) - Apache Commons Validator (from http://commons.apache.org/proper/commons-validator/)
- Apache Commons Validator (from http://commons.apache.org/proper/commons-validator/) - Apache Commons Validator (from http://commons.apache.org/proper/commons-validator/)
- Apache Geronimo JMS Spec 2.0 (from http://geronimo.apache.org/maven/${siteId}/${version})
- Apache HttpAsyncClient (from http://hc.apache.org/httpcomponents-asyncclient) - Apache HttpAsyncClient (from http://hc.apache.org/httpcomponents-asyncclient)
- Apache HttpClient (from http://hc.apache.org/httpcomponents-client) - Apache HttpClient (from http://hc.apache.org/httpcomponents-client)
- Apache HttpCore (from http://hc.apache.org/httpcomponents-core-ga) - Apache HttpCore (from http://hc.apache.org/httpcomponents-core-ga)
...@@ -203,6 +207,7 @@ The following software have components provided under the terms of this license: ...@@ -203,6 +207,7 @@ The following software have components provided under the terms of this license:
- Commons Digester (from http://commons.apache.org/digester/) - Commons Digester (from http://commons.apache.org/digester/)
- Commons Digester (from http://commons.apache.org/digester/) - Commons Digester (from http://commons.apache.org/digester/)
- Commons IO (from http://commons.apache.org/io/) - Commons IO (from http://commons.apache.org/io/)
- Commons IO (from http://commons.apache.org/io/)
- Commons Lang (from http://commons.apache.org/lang/) - Commons Lang (from http://commons.apache.org/lang/)
- Converter: Jackson (from ) - Converter: Jackson (from )
- Data Mapper for Jackson (from http://jackson.codehaus.org) - Data Mapper for Jackson (from http://jackson.codehaus.org)
...@@ -270,6 +275,7 @@ The following software have components provided under the terms of this license: ...@@ -270,6 +275,7 @@ The following software have components provided under the terms of this license:
- Java Servlet API (from http://servlet-spec.java.net) - Java Servlet API (from http://servlet-spec.java.net)
- Java UUID Generator (from http://wiki.fasterxml.com/JugHome) - Java UUID Generator (from http://wiki.fasterxml.com/JugHome)
- Javassist (from http://www.javassist.org/) - Javassist (from http://www.javassist.org/)
- Javassist (from http://www.javassist.org/)
- Jetty Server (from ) - Jetty Server (from )
- Jetty Utilities (from ) - Jetty Utilities (from )
- Joda-Time (from http://www.joda.org/joda-time/) - Joda-Time (from http://www.joda.org/joda-time/)
...@@ -311,9 +317,9 @@ The following software have components provided under the terms of this license: ...@@ -311,9 +317,9 @@ The following software have components provided under the terms of this license:
- Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Logback Appender (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Logback Appender (from https://github.com/Microsoft/ApplicationInsights-Java)
- Mockito (from http://www.mockito.org)
- Mockito (from http://mockito.org) - Mockito (from http://mockito.org)
- Mockito (from http://mockito.org) - Mockito (from http://mockito.org)
- Mockito (from http://www.mockito.org)
- Mojo's Maven plugin for Cobertura (from http://mojo.codehaus.org/cobertura-maven-plugin/) - Mojo's Maven plugin for Cobertura (from http://mojo.codehaus.org/cobertura-maven-plugin/)
- Netty Reactive Streams Implementation (from ) - Netty Reactive Streams Implementation (from )
- Netty/Buffer (from http://netty.io/) - Netty/Buffer (from http://netty.io/)
...@@ -337,8 +343,11 @@ The following software have components provided under the terms of this license: ...@@ -337,8 +343,11 @@ The following software have components provided under the terms of this license:
- OAuth2 for Spring Security (from ) - OAuth2 for Spring Security (from )
- Objenesis (from http://objenesis.org) - Objenesis (from http://objenesis.org)
- OkHttp (from ) - OkHttp (from )
- OkHttp (from )
- OkHttp Logging Interceptor (from ) - OkHttp Logging Interceptor (from )
- OkHttp URLConnection (from ) - OkHttp URLConnection (from )
- OkHttp URLConnection (from )
- Okio (from )
- Okio (from ) - Okio (from )
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
...@@ -352,9 +361,11 @@ The following software have components provided under the terms of this license: ...@@ -352,9 +361,11 @@ The following software have components provided under the terms of this license:
- Plexus Velocity Component (from ) - Plexus Velocity Component (from )
- PowerMock (from http://www.powermock.org) - PowerMock (from http://www.powermock.org)
- Protocol Buffer extensions to the Google HTTP Client Library for Java. (from ) - Protocol Buffer extensions to the Google HTTP Client Library for Java. (from )
- QpidJMS Client (from )
- Reactive Streams Netty driver (from https://github.com/reactor/reactor-netty) - Reactive Streams Netty driver (from https://github.com/reactor/reactor-netty)
- Retrofit (from ) - Retrofit (from )
- Servlet Specification 2.5 API (from ) - Servlet Specification 2.5 API (from )
- Simple XML (from http://simple.sourceforge.net)
- SnakeYAML (from http://www.snakeyaml.org) - SnakeYAML (from http://www.snakeyaml.org)
- Spatial4J (from http://www.locationtech.org/projects/locationtech.spatial4j) - Spatial4J (from http://www.locationtech.org/projects/locationtech.spatial4j)
- Spring AOP (from https://github.com/spring-projects/spring-framework) - Spring AOP (from https://github.com/spring-projects/spring-framework)
...@@ -383,6 +394,8 @@ The following software have components provided under the terms of this license: ...@@ -383,6 +394,8 @@ The following software have components provided under the terms of this license:
- Spring Core (from https://github.com/spring-projects/spring-framework) - Spring Core (from https://github.com/spring-projects/spring-framework)
- Spring Data Core (from ) - Spring Data Core (from )
- Spring Expression Language (SpEL) (from https://github.com/spring-projects/spring-framework) - Spring Expression Language (SpEL) (from https://github.com/spring-projects/spring-framework)
- Spring JMS (from https://github.com/spring-projects/spring-framework)
- Spring Messaging (from https://github.com/spring-projects/spring-framework)
- Spring Plugin - Core (from ) - Spring Plugin - Core (from )
- Spring Plugin - Metadata Extension (from ) - Spring Plugin - Metadata Extension (from )
- Spring Security JWT Library (from http://github.com/spring-projects/spring-security-oauth) - Spring Security JWT Library (from http://github.com/spring-projects/spring-security-oauth)
...@@ -390,6 +403,8 @@ The following software have components provided under the terms of this license: ...@@ -390,6 +403,8 @@ The following software have components provided under the terms of this license:
- Spring Transaction (from https://github.com/spring-projects/spring-framework) - Spring Transaction (from https://github.com/spring-projects/spring-framework)
- Spring Web (from https://github.com/spring-projects/spring-framework) - Spring Web (from https://github.com/spring-projects/spring-framework)
- Spring Web MVC (from https://github.com/spring-projects/spring-framework) - Spring Web MVC (from https://github.com/spring-projects/spring-framework)
- StAX (from http://stax.codehaus.org/)
- StAX API (from http://stax.codehaus.org/)
- T-Digest (from https://github.com/tdunning/t-digest) - T-Digest (from https://github.com/tdunning/t-digest)
- Woodstox (from https://github.com/FasterXML/woodstox) - Woodstox (from https://github.com/FasterXML/woodstox)
- Xerces2-j (from https://xerces.apache.org/xerces2-j/) - Xerces2-j (from https://xerces.apache.org/xerces2-j/)
...@@ -419,6 +434,8 @@ The following software have components provided under the terms of this license: ...@@ -419,6 +434,8 @@ The following software have components provided under the terms of this license:
- ion-java (from https://github.com/amznlabs/ion-java/) - ion-java (from https://github.com/amznlabs/ion-java/)
- jackson-databind (from http://github.com/FasterXML/jackson) - jackson-databind (from http://github.com/FasterXML/jackson)
- jackson-databind (from http://github.com/FasterXML/jackson) - jackson-databind (from http://github.com/FasterXML/jackson)
- java-cloudant (from https://cloudant.com)
- java-cloudant (from https://cloudant.com)
- javatuples (from http://www.javatuples.org) - javatuples (from http://www.javatuples.org)
- javax.inject (from http://code.google.com/p/atinject/) - javax.inject (from http://code.google.com/p/atinject/)
- javax.ws.rs-api (from http://jax-rs-spec.java.net) - javax.ws.rs-api (from http://jax-rs-spec.java.net)
...@@ -438,6 +455,7 @@ The following software have components provided under the terms of this license: ...@@ -438,6 +455,7 @@ The following software have components provided under the terms of this license:
- lettuce (from http://github.com/mp911de/lettuce/wiki) - lettuce (from http://github.com/mp911de/lettuce/wiki)
- micrometer-core (from https://github.com/micrometer-metrics/micrometer) - micrometer-core (from https://github.com/micrometer-metrics/micrometer)
- micrometer-registry-azure-monitor (from https://github.com/micrometer-metrics/micrometer) - micrometer-registry-azure-monitor (from https://github.com/micrometer-metrics/micrometer)
- minio (from https://github.com/minio/minio-java)
- org.xmlunit:xmlunit-core (from http://www.xmlunit.org/) - org.xmlunit:xmlunit-core (from http://www.xmlunit.org/)
- oro (from ) - oro (from )
- parent-join (from https://github.com/elastic/elasticsearch) - parent-join (from https://github.com/elastic/elasticsearch)
...@@ -451,6 +469,7 @@ The following software have components provided under the terms of this license: ...@@ -451,6 +469,7 @@ The following software have components provided under the terms of this license:
- powermock-reflect (from ) - powermock-reflect (from )
- proto-google-cloud-datastore-v1 (from https://github.com/googleapis/api-client-staging) - proto-google-cloud-datastore-v1 (from https://github.com/googleapis/api-client-staging)
- proton-j (from ) - proton-j (from )
- proton-j (from )
- rank-eval (from https://github.com/elastic/elasticsearch) - rank-eval (from https://github.com/elastic/elasticsearch)
- rest (from https://github.com/elastic/elasticsearch) - rest (from https://github.com/elastic/elasticsearch)
- rest-high-level (from https://github.com/elastic/elasticsearch) - rest-high-level (from https://github.com/elastic/elasticsearch)
...@@ -462,6 +481,7 @@ The following software have components provided under the terms of this license: ...@@ -462,6 +481,7 @@ The following software have components provided under the terms of this license:
- spring-security-oauth2-client (from http://spring.io/spring-security) - spring-security-oauth2-client (from http://spring.io/spring-security)
- spring-security-oauth2-core (from http://spring.io/spring-security) - spring-security-oauth2-core (from http://spring.io/spring-security)
- spring-security-oauth2-jose (from http://spring.io/spring-security) - spring-security-oauth2-jose (from http://spring.io/spring-security)
- spring-security-oauth2-resource-server (from http://spring.io/spring-security)
- spring-security-test (from http://spring.io/spring-security) - spring-security-test (from http://spring.io/spring-security)
- spring-security-web (from http://spring.io/spring-security) - spring-security-web (from http://spring.io/spring-security)
- springfox-core (from https://github.com/springfox/springfox) - springfox-core (from https://github.com/springfox/springfox)
...@@ -495,6 +515,7 @@ The following software have components provided under the terms of this license: ...@@ -495,6 +515,7 @@ The following software have components provided under the terms of this license:
- Lucene Common Analyzers (from ) - Lucene Common Analyzers (from )
- Plexus :: Default Container (from ) - Plexus :: Default Container (from )
- Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils) - Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils)
- StAX (from http://stax.codehaus.org/)
- jersey-ext-bean-validation (from ) - jersey-ext-bean-validation (from )
- jersey-spring4 (from ) - jersey-spring4 (from )
- oro (from ) - oro (from )
...@@ -564,6 +585,7 @@ CC-BY-3.0 ...@@ -564,6 +585,7 @@ CC-BY-3.0
======================================================================== ========================================================================
The following software have components provided under the terms of this license: The following software have components provided under the terms of this license:
- "Java Concurrency in Practice" book annotations (from http://jcip.net/)
- FindBugs-jsr305 (from http://findbugs.sourceforge.net/) - FindBugs-jsr305 (from http://findbugs.sourceforge.net/)
======================================================================== ========================================================================
...@@ -765,6 +787,7 @@ The following software have components provided under the terms of this license: ...@@ -765,6 +787,7 @@ The following software have components provided under the terms of this license:
- Java Native Access (from https://github.com/java-native-access/jna) - Java Native Access (from https://github.com/java-native-access/jna)
- Java Native Access Platform (from https://github.com/java-native-access/jna) - Java Native Access Platform (from https://github.com/java-native-access/jna)
- Javassist (from http://www.javassist.org/) - Javassist (from http://www.javassist.org/)
- Javassist (from http://www.javassist.org/)
- Logback Classic Module (from ) - Logback Classic Module (from )
- Logback Core Module (from ) - Logback Core Module (from )
- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
...@@ -772,6 +795,7 @@ The following software have components provided under the terms of this license: ...@@ -772,6 +795,7 @@ The following software have components provided under the terms of this license:
- Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Logback Appender (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Logback Appender (from https://github.com/Microsoft/ApplicationInsights-Java)
- SpotBugs Annotations (from https://spotbugs.github.io/)
- java-getopt (from ) - java-getopt (from )
======================================================================== ========================================================================
...@@ -781,7 +805,9 @@ The following software have components provided under the terms of this license: ...@@ -781,7 +805,9 @@ The following software have components provided under the terms of this license:
- Java Native Access (from https://github.com/java-native-access/jna) - Java Native Access (from https://github.com/java-native-access/jna)
- Java Native Access Platform (from https://github.com/java-native-access/jna) - Java Native Access Platform (from https://github.com/java-native-access/jna)
- Javassist (from http://www.javassist.org/)
- SnakeYAML (from http://www.snakeyaml.org) - SnakeYAML (from http://www.snakeyaml.org)
- SpotBugs Annotations (from https://spotbugs.github.io/)
======================================================================== ========================================================================
LGPL-3.0-only LGPL-3.0-only
...@@ -853,12 +879,14 @@ The following software have components provided under the terms of this license: ...@@ -853,12 +879,14 @@ The following software have components provided under the terms of this license:
- Cobertura code coverage (from http://cobertura.sourceforge.net) - Cobertura code coverage (from http://cobertura.sourceforge.net)
- Javassist (from http://www.javassist.org/) - Javassist (from http://www.javassist.org/)
- Javassist (from http://www.javassist.org/)
======================================================================== ========================================================================
MPL-2.0 MPL-2.0
======================================================================== ========================================================================
The following software have components provided under the terms of this license: The following software have components provided under the terms of this license:
- Javassist (from http://www.javassist.org/)
- Javassist (from http://www.javassist.org/) - Javassist (from http://www.javassist.org/)
======================================================================== ========================================================================
......
...@@ -32,6 +32,19 @@ ...@@ -32,6 +32,19 @@
<description>Indexer Service IBM</description> <description>Indexer Service IBM</description>
<packaging>jar</packaging> <packaging>jar</packaging>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<build.profile.id>local</build.profile.id>
<profileActive>local</profileActive>
</properties>
</profile>
</profiles>
<dependencies> <dependencies>
<!-- OSDU core service dependencies --> <!-- OSDU core service dependencies -->
...@@ -44,7 +57,7 @@ ...@@ -44,7 +57,7 @@
<dependency> <dependency>
<groupId>org.opengroup.osdu</groupId> <groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-lib-ibm</artifactId> <artifactId>os-core-lib-ibm</artifactId>
<version>0.0.13-SNAPSHOT</version> <version>0.0.14-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -69,7 +82,6 @@ ...@@ -69,7 +82,6 @@
<dependency> <dependency>
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId> <artifactId>spring-data-commons</artifactId>
<version>2.2.0.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -108,7 +120,6 @@ ...@@ -108,7 +120,6 @@
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.powermock/powermock-api-mockito2 --> <!-- https://mvnrepository.com/artifact/org.powermock/powermock-api-mockito2 -->
...@@ -132,12 +143,6 @@ ...@@ -132,12 +143,6 @@
<version>3.0.0</version> <version>3.0.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- <dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<scope>test</scope>
</dependency> -->
</dependencies> </dependencies>
...@@ -180,7 +185,6 @@ ...@@ -180,7 +185,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration> <configuration>
<useSystemClassLoader>false</useSystemClassLoader> <useSystemClassLoader>false</useSystemClassLoader>
<threadCount>1</threadCount> <threadCount>1</threadCount>
......
...@@ -43,7 +43,9 @@ ibm.tenant.db.url=${ibm.db.url} ...@@ -43,7 +43,9 @@ ibm.tenant.db.url=${ibm.db.url}
ibm.tenant.db.user=${ibm.db.user} ibm.tenant.db.user=${ibm.db.user}
ibm.tenant.db.password=${ibm.db.password} ibm.tenant.db.password=${ibm.db.password}
ibm.rabbitmq.uri=REPLACE_ME amqphub.amqp10jms.remote-url=REPLACE_ME
amqphub.amqp10jms.username=admin
amqphub.amqp10jms.password=admin
ibm.keycloak.endpoint_url=keycloak-host.com ibm.keycloak.endpoint_url=keycloak-host.com
ibm.keycloak.realm=OSDU ibm.keycloak.realm=OSDU
......
...@@ -260,7 +260,7 @@ public class ElasticUtils { ...@@ -260,7 +260,7 @@ public class ElasticUtils {
private RestHighLevelClient createClient(String username, String password, String host) { private RestHighLevelClient createClient(String username, String password, String host) {
RestHighLevelClient restHighLevelClient; RestHighLevelClient restHighLevelClient;
int port = Config.PORT; int port = Config.getPort();
try { try {
String rawString = String.format("%s:%s", username, password); String rawString = String.format("%s:%s", username, password);
......
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
<artifactId>indexer-test-core</artifactId> <artifactId>indexer-test-core</artifactId>
<version>0.0.2-SNAPSHOT</version> <version>0.0.2-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-lib-ibm</artifactId>
<version>0.0.14-SNAPSHOT</version>
</dependency>
<!-- Cucumber --> <!-- Cucumber -->
<dependency> <dependency>
...@@ -146,63 +152,4 @@ ...@@ -146,63 +152,4 @@
</snapshotRepository> </snapshotRepository>
</distributionManagement> </distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/index</include>
</includes>
</configuration>
</execution>
</executions>
<configuration>
<trimStackTrace>false</trimStackTrace>
<systemPropertyVariables>
<KEYCLOAK_URL>keycloak-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f207556f0-0000.us-south.containers.appdomain.cloud</KEYCLOAK_URL>
<KEYCLOAK_REALM>OSDU</KEYCLOAK_REALM>
<KEYCLOAK_CLIENT_ID>osdu-login</KEYCLOAK_CLIENT_ID>
<AUTH_USER_ACCESS>osdu-user</AUTH_USER_ACCESS>
<AUTH_USER_ACCESS_PASSWORD>CHANGE_ME</AUTH_USER_ACCESS_PASSWORD>
<ENTITLEMENTS_DOMAIN>ibm.com</ENTITLEMENTS_DOMAIN>
<OTHER_RELEVANT_DATA_COUNTRIES>US</OTHER_RELEVANT_DATA_COUNTRIES>
<!-- must be a valid, existing tag -->
<LEGAL_TAG>opendes-public-usa-dataset</LEGAL_TAG>
<!-- tenant1 MUSTG be opendes to work -->
<DEFAULT_DATA_PARTITION_ID_TENANT1>opendes</DEFAULT_DATA_PARTITION_ID_TENANT1>
<DEFAULT_DATA_PARTITION_ID_TENANT2>tenant2</DEFAULT_DATA_PARTITION_ID_TENANT2>
<!-- test against OpenShift -->
<STORAGE_HOST>https://storage.osdu-r2-dev-a1c3eaf78a86806e299f5f3f207556f0-0000.us-south.containers.appdomain.cloud/api/storage/v2/</STORAGE_HOST>
<!-- test locally -->
<!--
<STORAGE_HOST>http://localhost:8082/api/storage/v2/</STORAGE_HOST>
-->
<ELASTIC_HOST>CHANGE_ME.us-south.containers.appdomain.cloud</ELASTIC_HOST>
<ELASTIC_USER_NAME>CHANGE_ME</ELASTIC_USER_NAME>
<ELASTIC_PASSWORD>CHANGE_ME</ELASTIC_PASSWORD>
<ELASTIC_PORT>443</ELASTIC_PORT>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>
package org.opengroup.osdu.step_definitions.index.record; package org.opengroup.osdu.step_definitions.index.record;
import org.opengroup.osdu.common.RecordSteps; import org.opengroup.osdu.common.RecordSteps;
import org.opengroup.osdu.util.ElasticUtilsIBM;
import org.opengroup.osdu.util.IBMHTTPClient; import org.opengroup.osdu.util.IBMHTTPClient;
import cucumber.api.DataTable; import cucumber.api.DataTable;
...@@ -16,7 +15,7 @@ import lombok.extern.java.Log; ...@@ -16,7 +15,7 @@ import lombok.extern.java.Log;
public class Steps extends RecordSteps { public class Steps extends RecordSteps {
public Steps() { public Steps() {
super(new IBMHTTPClient(), new ElasticUtilsIBM()); super(new IBMHTTPClient());
} }
@Before @Before
......
// Copyright 2020 IBM Corp. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.util;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.Base64;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.apache.http.message.BasicHeader;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestClientBuilder.HttpClientConfigCallback;
import org.elasticsearch.client.RestHighLevelClient;
import lombok.extern.java.Log;
/**
* All util methods to use elastic apis for tests
* It should be used only in the Setup or TearDown phase of the test
*/
@Log
public class ElasticUtilsIBM extends ElasticUtils {
private static final int REST_CLIENT_CONNECT_TIMEOUT = 5000;
private static final int REST_CLIENT_SOCKET_TIMEOUT = 60000;
private static final int REST_CLIENT_RETRY_TIMEOUT = 60000;
public ElasticUtilsIBM() {
super();
}
protected RestHighLevelClient createClient(String username, String password, String host) {
RestHighLevelClient restHighLevelClient;
int port = Config.getPort();
try {
String rawString = String.format("%s:%s", username, password);
RestClientBuilder builder = RestClient.builder(new HttpHost(host, port, "https"));
builder.setRequestConfigCallback(requestConfigBuilder -> requestConfigBuilder.setConnectTimeout(REST_CLIENT_CONNECT_TIMEOUT)
.setSocketTimeout(REST_CLIENT_SOCKET_TIMEOUT));
builder.setMaxRetryTimeoutMillis(REST_CLIENT_RETRY_TIMEOUT);
Header[] defaultHeaders = new Header[]{
new BasicHeader("client.transport.nodes_sampler_interval", "30s"),
new BasicHeader("client.transport.ping_timeout", "30s"),
new BasicHeader("client.transport.sniff", "false"),
new BasicHeader("request.headers.X-Found-Cluster", Config.getElasticHost()),
new BasicHeader("cluster.name", Config.getElasticHost()),
new BasicHeader("xpack.security.transport.ssl.enabled", Boolean.toString(true)),
new BasicHeader("Authorization", String.format("Basic %s", Base64.getEncoder().encodeToString(rawString.getBytes()))),
};
SSLContext sslContext = SSLContext.getInstance("SSL");
// set up a TrustManager that trusts everything
sslContext.init(null, new TrustManager[]{new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}}, new SecureRandom());
builder.setHttpClientConfigCallback(new HttpClientConfigCallback() {
public HttpAsyncClientBuilder customizeHttpClient(
HttpAsyncClientBuilder httpClientBuilder) {
return httpClientBuilder
.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER)
.setSSLContext(sslContext);
}
})
.setDefaultHeaders(defaultHeaders);
restHighLevelClient = new RestHighLevelClient(builder);
} catch (Exception e) {
throw new AssertionError("Setup elastic error");
}
return restHighLevelClient;
}
}
\ No newline at end of file
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
package org.opengroup.osdu.util; package org.opengroup.osdu.util;
import lombok.ToString; import org.opengroup.osdu.core.ibm.util.IdentityClient;
import lombok.extern.java.Log;
import com.google.common.base.Strings; import com.google.common.base.Strings;
@Log import lombok.ToString;
@ToString @ToString
public class IBMHTTPClient extends HTTPClient { public class IBMHTTPClient extends HTTPClient {
private static String token = null; private static String token = null;
...@@ -28,7 +28,7 @@ public class IBMHTTPClient extends HTTPClient { ...@@ -28,7 +28,7 @@ public class IBMHTTPClient extends HTTPClient {
public synchronized String getAccessToken() { public synchronized String getAccessToken() {
if(Strings.isNullOrEmpty(token)) { if(Strings.isNullOrEmpty(token)) {
try { try {
token = "Bearer " + IdentityUtilIBM.getAccessToken(); token = "Bearer " + IdentityClient.getTokenForUserWithAccess();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
// Copyright 2020 IBM Corp. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.util;
import java.io.IOException;
public class IdentityUtilIBM {
public static String getAccessToken(){
try {
String user = System.getProperty("AUTH_USER_ACCESS");
String pass = System.getProperty("AUTH_USER_ACCESS_PASSWORD");
return KeyCloakProvider.getToken(user, pass);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
// Copyright 2020 IBM Corp. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.util;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
public class KeyCloakProvider {
private static String url;
private static String realm;
private static String client_id;
private static String grant_type = "password";
static {
disableSslVerification();
url = System.getProperty("KEYCLOAK_URL");
realm = System.getProperty("KEYCLOAK_REALM");
client_id = System.getProperty("KEYCLOAK_CLIENT_ID");
}
private static void disableSslVerification() {
try
{
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}
};
// Install the all-trusting trust manager
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
// Create all-trusting host name verifier
HostnameVerifier allHostsValid = new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
// Install the all-trusting host verifier
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
}
}
public static String getToken(String user, String pwd) throws IOException {
String token_endpoint = String.format("https://%s/auth/realms/%s/protocol/openid-connect/token", url, realm);
URL url = new URL(token_endpoint);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
Map<String, String> parameters = new HashMap<>();
parameters.put("grant_type", grant_type);
parameters.put("client_id", client_id);
parameters.put("username", user);
parameters.put("password", pwd);
con.setDoOutput(true);
DataOutputStream out = new DataOutputStream(con.getOutputStream());
out.writeBytes(getParamsString(parameters));
out.flush();
out.close();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
con.disconnect();
Gson gson = new Gson();
JsonObject jobj = gson.fromJson(content.toString(), JsonObject.class);
String token = jobj.get("access_token").getAsString();
return token;
}
private static String getParamsString(Map<String, String> params)
throws UnsupportedEncodingException {
StringBuilder result = new StringBuilder();
for (Map.Entry<String, String> entry : params.entrySet()) {
result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
result.append("=");
result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
result.append("&");
}
String resultString = result.toString();
return resultString.length() > 0
? resultString.substring(0, resultString.length() - 1)
: resultString;
}
}
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<module>indexer-test-aws</module> <module>indexer-test-aws</module>
<module>indexer-test-azure</module> <module>indexer-test-azure</module>
<module>indexer-test-gcp</module> <module>indexer-test-gcp</module>
<module>indexer-test-ibm</module>
</modules> </modules>
<repositories> <repositories>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment