Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
HAWKULAR-238 Fix hawkular-end-to-end-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed May 26, 2015
1 parent 2371bea commit 1f501f2
Show file tree
Hide file tree
Showing 5 changed files with 267 additions and 136 deletions.
105 changes: 100 additions & 5 deletions modules/end-to-end-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
limitations under the License.
-->
<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">
<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>
<groupId>org.hawkular</groupId>
<artifactId>hawkular</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>hawkular-end-to-end-tests</artifactId>
Expand All @@ -36,11 +36,14 @@
<dependency>
<groupId>org.hawkular.inventory</groupId>
<artifactId>inventory-api</artifactId>
<scope>test</scope>
</dependency>


<dependency>
<groupId>org.rhq.metrics</groupId>
<artifactId>rhq-metrics-api</artifactId>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<scope>test</scope>
</dependency>

<dependency>
Expand All @@ -58,9 +61,101 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- because integration tests are run by maven-failsafe-plugin -->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>itest</id>
<properties>
<hawkular.host>localhost</hawkular.host>
<hawkular.port>8080</hawkular.port>
<hawkular.path>/hawkular</hawkular.path>
<hawkular.base-uri>http://${hawkular.host}:${hawkular.port}${hawkular.path}</hawkular.base-uri>
<hawkular.management.port>9999</hawkular.management.port>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/*ITest*</include>
</includes>
<systemPropertyVariables>
<hawkular.host>${hawkular.host}</hawkular.host>
<hawkular.port>${hawkular.port}</hawkular.port>
<hawkular.base-uri>${hawkular.base-uri}</hawkular.base-uri>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- prepared for HAWKULAR-257 Run end to end tests by Travis
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<groupId>org.hawkular</groupId>
<artifactId>hawkular-dist</artifactId>
<version>${project.version}</version>
<skip>${skipTests}</skip>
<startupTimeout>240</startupTimeout>
</configuration>
<executions>
<execution>
<id>start-wildfly</id>
<phase>pre-integration-test</phase>
<configuration>
<javaOpts>
<javaOpt>-server</javaOpt>
<javaOpt>-Xms64m</javaOpt>
<javaOpt>-Xmx512m</javaOpt>
<javaOpt>-XX:MaxPermSize=256m</javaOpt>
<javaOpt>-Djava.net.preferIPv4Stack=true</javaOpt>
<javaOpt>-Djboss.modules.system.pkgs=org.jboss.byteman </javaOpt>
<javaOpt>-Djava.awt.headless=true </javaOpt>
<javaOpt>-Dkeycloak.import=/home/ppalaga/scratch/hawkular-master/wildFly/standalone/configuration/hawkular-realm.json</javaOpt>
</javaOpts>
</configuration>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-wildfly</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin> -->
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,31 @@ package org.hawkular.integration.test

import groovyx.net.http.ContentType
import groovyx.net.http.RESTClient

import org.junit.BeforeClass

class AbstractTestBase {

static baseURI = System.getProperty('hawkular.base-uri') ?: '127.0.0.1:8080/hawkular/'
static testUser = 'jdoe'
static testPasword = 'password'
static baseURI = 'http://localhost:8080'
//static baseURI = System.getProperty('hawkular.base-uri') ?: 'http://localhost:8080/hawkular'
static RESTClient client

@BeforeClass
static void initClient() {
client = new RESTClient("http://$baseURI", ContentType.JSON)
client = new RESTClient(baseURI, ContentType.JSON)

/* http://en.wikipedia.org/wiki/Basic_access_authentication#Client_side :
* The Authorization header is constructed as follows:
* * Username and password are combined into a string "username:password"
* * The resulting string is then encoded using the RFC2045-MIME variant of Base64,
* except not limited to 76 char/line[9]
* * The authorization method and a space i.e. "Basic " is then put before the encoded string.
*/
String encodedCredentials = Base64.getMimeEncoder().encodeToString("$testUser:$testPasword".getBytes("utf-8"))
client.defaultRequestHeaders.Authorization = "Basic "+ encodedCredentials

}

}

This file was deleted.

0 comments on commit 1f501f2

Please sign in to comment.