Skip to content

Commit

Permalink
Terracotta-OSS#191 : Initial Galvan testing set up for tc platform
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonydahanne committed Dec 16, 2016
1 parent 694781f commit 3b9b045
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 1 deletion.
119 changes: 119 additions & 0 deletions management/testing/integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,125 @@
<version>${galvan.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.terracotta.management.testing</groupId>
<artifactId>sample-entity</artifactId>
<version>${parent.version}</version>
</dependency>

<!-- provided by voltron (client) -->
<dependency>
<groupId>org.terracotta</groupId>
<artifactId>entity-client-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.terracotta.management.dist</groupId>
<artifactId>management-server</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.terracotta</groupId>
<artifactId>offheap-resource</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.terracotta.management.dist</groupId>
<artifactId>management-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.terracotta.management.dist</groupId>
<artifactId>management-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>voltron-kit</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.terracotta.internal</groupId>
<artifactId>terracotta-kit</artifactId>
<version>${terracotta-core.version}</version>
<type>tar.gz</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/voltronKit</outputDirectory>
</configuration>
</execution>
<execution>
<id>unpack-sample-entity</id>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.terracotta.management.testing</groupId>
<artifactId>sample-entity</artifactId>
<version>${project.version}</version>
<classifier>plugin</classifier>
</artifactItem>
<artifactItem>
<groupId>org.terracotta.management.dist</groupId>
<artifactId>management-common</artifactId>
<version>${project.version}</version>
</artifactItem>
<artifactItem>
<groupId>org.terracotta.management.dist</groupId>
<artifactId>management-server</artifactId>
<version>${project.version}</version>
</artifactItem>
<artifactItem>
<groupId>org.terracotta</groupId>
<artifactId>offheap-resource</artifactId>
<version>${project.version}</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/voltronKit/${terracotta-core.version}/server/plugins/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<systemPropertyVariables>
<kitInstallationPath>${project.build.directory}/voltronKit/${terracotta-core.version}/</kitInstallationPath>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package org.terracotta.management.integration.tests;

import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.terracotta.management.entity.sample.client.CacheFactory;
import org.terracotta.management.registry.collect.StatisticConfiguration;
import org.terracotta.testing.rules.BasicExternalCluster;
import org.terracotta.testing.rules.Cluster;

import java.io.File;
import java.net.URI;
import java.util.concurrent.TimeUnit;

import static java.util.Collections.emptyList;

public class SimpleGalvanIT {

private static final String OFFHEAP_RESOURCE = "primary-server-resource";

private static final String RESOURCE_CONFIG =
"<config xmlns:ohr='http://www.terracotta.org/config/offheap-resource'>"
+ "<ohr:offheap-resources>"
+ "<ohr:resource name=\"" + OFFHEAP_RESOURCE + "\" unit=\"MB\">64</ohr:resource>"
+ "</ohr:offheap-resources>" +
"</config>\n";

@ClassRule
public static Cluster CLUSTER =
new BasicExternalCluster(new File("target/galvan"), 1, emptyList(), "", RESOURCE_CONFIG, "");

@BeforeClass
public static void waitForActive() throws Exception {
CLUSTER.getClusterControl().waitForActive();
}

@Rule
public final TestName testName = new TestName();

@Test
public void simpleTest_one_active() throws Exception {
URI uri = CLUSTER.getConnectionURI();

StatisticConfiguration statisticConfiguration = new StatisticConfiguration()
.setAverageWindowDuration(1, TimeUnit.MINUTES)
.setHistorySize(100)
.setHistoryInterval(1, TimeUnit.SECONDS)
.setTimeToDisable(5, TimeUnit.SECONDS);
CacheFactory cacheFactory = new CacheFactory(uri.toString() + "/pif", statisticConfiguration);
cacheFactory.init();
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sample.server.HelloWorldEntityServerService
org.terracotta.management.entity.sample.server.CacheEntityServerService

0 comments on commit 3b9b045

Please sign in to comment.