Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@
public class KieServerControllerClientProvider {

public static KieServerControllerClient getKieServerControllerClient(WorkbenchDeployment workbenchDeployment) {
return getKieServerControllerClient(workbenchDeployment, workbenchDeployment.getUsername(), workbenchDeployment.getPassword());
}

public static KieServerControllerClient getKieServerControllerClient(WorkbenchDeployment workbenchDeployment, String username, String password) {
KieServerControllerClient kieServerControllerClient = KieServerControllerClientFactory.newRestClient(workbenchDeployment.getUrl().toString() + "/rest/controller",
workbenchDeployment.getUsername(), workbenchDeployment.getPassword());
username, password);
return kieServerControllerClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,26 @@

public class WorkbenchClientProvider {

private static final Integer DEFAULT_TIMEOUT_IN_SEC = 120;
private static final Integer DEFAULT_TIMEOUT_IN_SEC = 600;

public static WorkbenchClient getWorkbenchClient(WorkbenchDeployment workbenchDeployment) {
return getWorkbenchClient(workbenchDeployment, workbenchDeployment.getUsername(), workbenchDeployment.getPassword());
}

public static WorkbenchClient getWorkbenchClient(WorkbenchDeployment workbenchDeployment, String username, String password) {
WorkbenchClient workbenchClient = RestWorkbenchClient.createWorkbenchClient(workbenchDeployment.getUrl().toString(),
workbenchDeployment.getUsername(), workbenchDeployment.getPassword(), DEFAULT_TIMEOUT_IN_SEC, DEFAULT_TIMEOUT_IN_SEC, DEFAULT_TIMEOUT_IN_SEC);
username, password, DEFAULT_TIMEOUT_IN_SEC, DEFAULT_TIMEOUT_IN_SEC, DEFAULT_TIMEOUT_IN_SEC);

return workbenchClient;
}

public static WorkbenchClient getAsyncWorkbenchClient(WorkbenchDeployment workbenchDeployment) {
return getAsyncWorkbenchClient(workbenchDeployment, workbenchDeployment.getUsername(), workbenchDeployment.getPassword());
}

public static WorkbenchClient getAsyncWorkbenchClient(WorkbenchDeployment workbenchDeployment, String username, String password) {
WorkbenchClient asyncWorkbenchClient = RestWorkbenchClient.createAsyncWorkbenchClient(workbenchDeployment.getUrl().toString(),
username, password);
return asyncWorkbenchClient;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected void deployKieDeployments() {
workbenchDeployment = new WorkbenchDeploymentImpl(project);
workbenchDeployment.setUsername(DeploymentConstants.getWorkbenchUser());
workbenchDeployment.setPassword(DeploymentConstants.getWorkbenchPassword());
workbenchDeployment.scale(1);
//workbenchDeployment.scale(1); - TODO remove this to tes HA scenarios

kieServerDeployment = new KieServerDeploymentImpl(project);
kieServerDeployment.setUsername(DeploymentConstants.getKieServerUser());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ protected void deployKieDeployments() {
logger.info("Processing template and creating resources from " + OpenShiftTemplate.CLUSTERED_WORKBENCH_KIE_SERVER_PERSISTENT.getTemplateUrl().toString());
envVariables.put(OpenShiftTemplateConstants.IMAGE_STREAM_NAMESPACE, project.getName());
envVariables.put(OpenShiftTemplateConstants.AMQ_IMAGE_STREAM_NAMESPACE, project.getName());
envVariables.put("AMQ_REPLICAS","1");
project.processTemplateAndCreateResources(OpenShiftTemplate.CLUSTERED_WORKBENCH_KIE_SERVER_PERSISTENT.getTemplateUrl(), envVariables);

workbenchDeployment = new WorkbenchDeploymentImpl(project);
workbenchDeployment.setUsername(DeploymentConstants.getWorkbenchUser());
workbenchDeployment.setPassword(DeploymentConstants.getWorkbenchPassword());
workbenchDeployment.scale(1);
//workbenchDeployment.scale(1); //- TODO remove this to tes HA scenarios

kieServerDeployment = new KieServerDeploymentImpl(project);
kieServerDeployment.setUsername(DeploymentConstants.getKieServerUser());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public String getServiceName() {
return serviceName;
}

@Override public void waitForScale() {
@Override
public void waitForScale() {
super.waitForScale();
if (!getInstances().isEmpty()) {
getInsecureUrl().ifPresent(RouterUtil::waitForRouter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
import java.util.HashMap;
import java.util.Map;

import cz.xtf.core.openshift.OpenShift;
import cz.xtf.core.openshift.OpenShifts;
import io.fabric8.kubernetes.api.model.KubernetesList;
import io.fabric8.kubernetes.client.KubernetesClientException;
import org.kie.cloud.api.deployment.SsoDeployment;
import org.kie.cloud.api.deployment.constants.DeploymentConstants;
import org.kie.cloud.openshift.constants.OpenShiftConstants;
Expand All @@ -32,10 +36,6 @@
import org.kie.cloud.openshift.util.sso.SsoApiFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cz.xtf.core.openshift.OpenShift;
import cz.xtf.core.openshift.OpenShifts;
import io.fabric8.kubernetes.api.model.KubernetesList;
import io.fabric8.kubernetes.client.KubernetesClientException;

public class SsoDeployer {

Expand Down Expand Up @@ -149,4 +149,14 @@ private static void createRolesAndUsers(String authUrl, String realm) {
ssoApi.createUser(DeploymentConstants.getWorkbenchMavenUser(),
DeploymentConstants.getWorkbenchMavenPassword());
}

public static void createUsers(SsoDeployment ssoDeployment, Map<String, String> users) {
String authUrl = ssoDeployment.getUrl().toString() + "/auth";
logger.info("Creating custom users in SSO at URL {} in Realm {}", authUrl, SSO_REALM);
SsoApi ssoApi = SsoApiFactory.getRestApi(authUrl, SSO_REALM);

users.forEach((String name, String pwd) -> {
ssoApi.createUser(name, pwd, Arrays.asList(ADMIN, KIE_SERVER, REST_ALL));
});
}
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</modules>

<properties>
<rhba.images.version.prefix>76</rhba.images.version.prefix>
<rhba.images.branch>master</rhba.images.branch>
<rhba.images.version.prefix>76</rhba.images.version.prefix> <!-- TODO revert change - set back to master -->
<rhba.images.branch>master</rhba.images.branch> <!-- TODO revert change - set back to master -->
<rhba.operator.branch>master</rhba.operator.branch>

<findbugs.failOnViolation>true</findbugs.failOnViolation>
Expand Down
3 changes: 2 additions & 1 deletion test-cloud/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<default.domain.suffix/>

<!-- Amq properties -->
<amq.image.streams>https://raw.githubusercontent.com/jboss-container-images/jboss-amq-7-broker-openshift-image/amq-broker-74-dev/amq-broker-7-image-streams.yaml</amq.image.streams>
<amq.image.streams>https://raw.githubusercontent.com/jboss-container-images/jboss-amq-7-broker-openshift-image/amq-broker-75-dev/amq-broker-7-image-streams.yaml</amq.image.streams>
<amq.username>yoda</amq.username>
<amq.password>usetheforce123@</amq.password>

Expand Down Expand Up @@ -114,6 +114,7 @@
<module>test-cloud-optaweb</module>
<module>test-cloud-performance</module>
<module>test-cloud-ha-cep</module>
<module>test-cloud-workbench-ha</module>
</modules>

<build>
Expand Down
19 changes: 4 additions & 15 deletions test-cloud/test-cloud-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,16 @@

<name>KIE :: Cloud :: Common Test</name>
<description>Module providing test utilities and parent test classes.</description>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-rest-client</artifactId>
<version>${version.org.uberfire}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.kie.cloud</groupId>
<artifactId>framework-cloud-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie.cloud</groupId>
<artifactId>framework-git</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down Expand Up @@ -87,10 +81,5 @@
<groupId>org.kie.cloud</groupId>
<artifactId>framework-cloud-common</artifactId>
</dependency>
<!-- UberFire rest client -->
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-rest-client</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* 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.kie.cloud.tests.common.provider.git;

import org.kie.cloud.git.GitProvider;
import org.kie.cloud.git.GitProviderService;

public class Git {
private static final GitProvider gitProvider = new GitProviderService().createGitProvider();

public static GitProvider getProvider() {
return gitProvider;
}
}
12 changes: 12 additions & 0 deletions test-cloud/test-cloud-workbench-ha/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
BC HA REST tests

example of execute cmd for tests:
mvn clean install -Dopenshift.master.url=https://master.openshiftdomain:8443 -Dopenshift.username=user -Dopenshift.passwordedhat -Dgit.provider=Gogs -Dgogs.url=http://gogs.project.openshiftdomain -Dgogs.username=root -Dgogs.password=redhat -Dmaven.repo.url=http://nexus.project.openshiftdomain/repository/maven-snapshots -Dmaven.repo.username=admin -Dmaven.repo.password=admin123 -Dkie.image.streams=file:///home/jschwan/ns/jbpm-dev-is.yaml -DfailIfNoTests=false -Popenshift -Pparallel -Dtemplate.database=postgresql -Dtemplate.project=jbpm -Dopenshift.namespace.prefix=jschwan-bcha -Ddefault.domain.suffix=.project.openshiftdomain -Dldap.url=ldap://master.openshiftdomain:30389 -Dit.test=SpaceFunctionalIntegrationTest

example of command to build Kie Cloud Tests (frameworks):
$ mvn clean install -DskipTests -Dkie.app.template.url=https://raw.githubusercontent.com/jboss-container-images/rhpam-7-openshift-image/7.6.x/templates



mvn clean install -Dopenshift.master.url=https://master.openshiftdomain:8443 -Dopenshift.username=user -Dopenshift.passwordedhat -Dgit.provider=Gogs -Dgogs.url=http://gogs.project.openshiftdomain -Dgogs.username=root -Dgogs.password=redhat -Dmaven.repo.url=http://nexus.project.openshiftdomain/repository/maven-snapshots -Dmaven.repo.username=admin -Dmaven.repo.password=admin123 -Dkie.image.streams=file:///home/jschwan/repositories/bxms-qe-tests/scripts/openshift-resources/image-streams/jbpm_dev_image_streams.yaml -DfailIfNoTests=false -Popenshift -Dtemplate.database=postgresql -Dtemplate.project=jbpm -Dopenshift.namespace.prefix=jschwan-bcha -Ddefault.domain.suffix=.project.openshiftdomain -Dldap.url=ldap://master.openshiftdomain:30389 -Dit.test=SpaceFunctionalIntegrationTest,SpaceProjectFunctionalIntegrationTest,ProjectFunctionalIntegrationTest

141 changes: 141 additions & 0 deletions test-cloud/test-cloud-workbench-ha/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>test-cloud</artifactId>
<groupId>org.kie.cloud</groupId>
<version>7.29.0-SNAPSHOT</version>
</parent>


<artifactId>test-cloud-workbench-ha</artifactId>

<name>KIE :: Cloud :: Workbench HA tests</name>
<description>Test suite for Workbench HA scenario deployed in a cloud. Test focused on REST api.</description>

<properties>
<skipTests>true</skipTests>
<kjars.build.settings.xml>${project.build.testOutputDirectory}/settings.xml</kjars.build.settings.xml>
</properties>

<dependencies>
<dependency>
<groupId>org.kie.cloud</groupId>
<artifactId>framework-cloud-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie.cloud</groupId>
<artifactId>test-cloud-common</artifactId>
</dependency>
<dependency>
<groupId>org.kie.cloud</groupId>
<artifactId>framework-cloud-common</artifactId>
</dependency>
<dependency>
<groupId>org.kie.cloud</groupId>
<artifactId>framework-git</artifactId>
</dependency>
<dependency>
<groupId>org.kie.cloud</groupId>
<artifactId>framework-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie.cloud</groupId>
<artifactId>framework-openshift</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

<!-- XTF dependencies -->
<dependency>
<groupId>cz.xtf</groupId>
<artifactId>http-client</artifactId>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>openshift</id>
<properties>
<skipTests>false</skipTests>
</properties>
</profile>
<profile>
<id>openshift-operator</id>
<properties>
<skipTests>false</skipTests>
</properties>
</profile>
<profile>
<id>openshift-apb</id>
<properties>
<skipTests>false</skipTests>
</properties>
</profile>
</profiles>

<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>false</filtering>
</testResource>
<testResource>
<directory>src/test/filtered-resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<!-- XTF use tmp folder as temp folder, need to be deleted too when rerunning tests. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/tmp</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<trimStackTrace>false</trimStackTrace>
<systemProperties>
<kjars.build.settings.xml>${kjars.build.settings.xml}</kjars.build.settings.xml>
<instance.logs>${project.build.directory}/instances</instance.logs>
<apb.build.logs>${project.build.directory}/apbBuilds</apb.build.logs>
<kie.operator.console.check.skip>true</kie.operator.console.check.skip>
</systemProperties>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>keytool-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Loading