Skip to content

Commit 7180982

Browse files
author
Myron Scott
authored
Merge pull request #1279 from myronkscott/kit_cleanup
Kit cleanup
2 parents c639da5 + 006c41a commit 7180982

File tree

24 files changed

+294
-227
lines changed

24 files changed

+294
-227
lines changed

common/src/main/java/com/tc/util/ManagedServiceLoader.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ protected Class<?> loadClass(String className, String location, ClassLoader load
260260
try {
261261
ClassLoader l2 = new URLClassLoader(new URL[] {new URL(location)}, loader);
262262
return Class.forName(className, true, l2);
263+
} catch (NoClassDefFoundError e) {
264+
LOG.warn("Loading implementation failed for " + className +". Check entity classpath and packaging", e);
263265
} catch (ClassNotFoundException c) {
264266
LOG.warn("No implementations found for " + className, c);
265267
} catch (MalformedURLException m) {

default-configuration/src/main/java/org/terracotta/config/provider/DefaultConfigurationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private Path getConfiguration(String[] args) throws Exception {
224224
return defaultUserHomeConfigurationPath;
225225
}
226226

227-
return Directories.getDefaultConfigFile();
227+
return Directories.getInstallationRoot().resolve("conf/tc-config.xml");
228228
}
229229

230230
private static Options createOptions() {

default-configuration/src/test/java/org/terracotta/config/provider/DefaultConfigurationProviderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public void testWithDefaultConfigurationInUserDirectory() throws Exception {
278278
public void testWithDefaultConfigurationInInstallationDirectory() throws Exception {
279279
Path temporaryDirectory = temporaryFolder.newFolder("conf").toPath();
280280
System.setProperty(Directories.TC_INSTALL_ROOT_PROPERTY_NAME, temporaryDirectory.getParent().toString());
281-
Files.copy(this.getClass().getResourceAsStream("/simple-tc-config.xml"), Directories.getDefaultConfigFile());
281+
Files.copy(this.getClass().getResourceAsStream("/simple-tc-config.xml"), Directories.getInstallationRoot().resolve("conf/tc-config.xml"));
282282

283283
provider.initialize(Collections.<String>emptyList());
284284

examples/extended-server/pom.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<groupId>org.terracotta.internal</groupId>
7+
<artifactId>build-parent</artifactId>
8+
<version>5.9-SNAPSHOT</version>
9+
<relativePath>../../build-parent</relativePath>
10+
</parent>
11+
<modelVersion>4.0.0</modelVersion>
12+
13+
<groupId>org.terracotta</groupId>
14+
<artifactId>extended-server</artifactId>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.terracotta.internal</groupId>
19+
<artifactId>tc-server</artifactId>
20+
<version>${project.version}</version>
21+
</dependency>
22+
</dependencies>
23+
<build>
24+
<plugins>
25+
<plugin>
26+
<groupId>org.apache.maven.plugins</groupId>
27+
<artifactId>maven-jar-plugin</artifactId>
28+
<configuration>
29+
<archive>
30+
<manifest>
31+
<addClasspath>true</addClasspath>
32+
</manifest>
33+
</archive>
34+
</configuration>
35+
</plugin>
36+
</plugins>
37+
</build>
38+
</project>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
*
3+
* The contents of this file are subject to the Terracotta Public License Version
4+
* 2.0 (the "License"); You may not use this file except in compliance with the
5+
* License. You may obtain a copy of the License at
6+
*
7+
* http://terracotta.org/legal/terracotta-public-license.
8+
*
9+
* Software distributed under the License is distributed on an "AS IS" basis,
10+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
11+
* the specific language governing rights and limitations under the License.
12+
*
13+
* The Covered Software is Terracotta Core.
14+
*
15+
* The Initial Developer of the Covered Software is
16+
* Terracotta, Inc., a Software AG company
17+
*
18+
*/
19+
package org.terracotta.internal;
20+
21+
import com.tc.productinfo.BaseBuildInfo;
22+
import java.io.IOException;
23+
24+
/**
25+
*
26+
*/
27+
public class ExtendedServer extends BaseBuildInfo {
28+
29+
public ExtendedServer() throws IOException {
30+
super(ExtendedServer.class.getResourceAsStream("/build-data.txt"));
31+
}
32+
33+
@Override
34+
public String getVersionMessage() {
35+
return "Extended Server Example";
36+
}
37+
38+
@Override
39+
public String getMonkier() {
40+
return "Extended Server Example";
41+
}
42+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#
2+
# Copyright (c) 2011-2021 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
3+
# Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.
4+
#
5+
org.terracotta.internal.ExtendedServer
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<configuration debug="true">
4+
5+
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
6+
<encoder>
7+
<pattern>%d %p - %m%n</pattern>
8+
<charset>utf8</charset>
9+
</encoder>
10+
</appender>
11+
12+
<root level="DEBUG">
13+
<appender-ref ref="CONSOLE"/>
14+
</root>
15+
16+
</configuration>

examples/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
<modules>
1818
<module>concurrent-map-entity</module>
19+
<module>extended-server</module>
1920
</modules>
2021

2122
<dependencies>

galvan-support/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ limitations under the License.
166166
<version>${project.version}</version>
167167
<classifier>jar-with-dependencies</classifier>
168168
<outputDirectory>${kitUnzipLocation}/terracotta-${project.version}/server/plugins/lib/</outputDirectory>
169-
169+
</artifactItem>
170+
<artifactItem>
171+
<groupId>org.terracotta</groupId>
172+
<artifactId>extended-server</artifactId>
173+
<version>${project.version}</version>
174+
<outputDirectory>${kitUnzipLocation}/terracotta-${project.version}/server/lib/</outputDirectory>
170175
</artifactItem>
171176
</artifactItems>
172177
</configuration>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
*
3+
* The contents of this file are subject to the Terracotta Public License Version
4+
* 2.0 (the "License"); You may not use this file except in compliance with the
5+
* License. You may obtain a copy of the License at
6+
*
7+
* http://terracotta.org/legal/terracotta-public-license.
8+
*
9+
* Software distributed under the License is distributed on an "AS IS" basis,
10+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
11+
* the specific language governing rights and limitations under the License.
12+
*
13+
* The Covered Software is Terracotta Core.
14+
*
15+
* The Initial Developer of the Covered Software is
16+
* Terracotta, Inc., a Software AG company
17+
*
18+
*/
19+
package org.terracotta.functional;
20+
21+
import java.net.InetSocketAddress;
22+
import java.util.Properties;
23+
import org.junit.Assert;
24+
25+
import org.junit.Rule;
26+
import org.junit.Test;
27+
import org.terracotta.connection.DiagnosticsFactory;
28+
import org.terracotta.testing.rules.BasicExternalClusterBuilder;
29+
import org.terracotta.testing.rules.Cluster;
30+
31+
/**
32+
*
33+
*/
34+
public class ExtendedServerIT {
35+
static {
36+
System.setProperty("tc.server-jar", "extended-server");
37+
}
38+
39+
@Rule
40+
public final Cluster CLUSTER = BasicExternalClusterBuilder.newCluster(1).withClientReconnectWindowTime(30)
41+
.build();
42+
43+
@Test
44+
public void testConnection() throws Exception {
45+
String[] clusterHostPorts = CLUSTER.getClusterHostPorts();
46+
for (String hostPort: clusterHostPorts) {
47+
String[] hp = hostPort.split("[:]");
48+
InetSocketAddress inet = InetSocketAddress.createUnresolved(hp[0], Integer.parseInt(hp[1]));
49+
try (com.terracotta.diagnostic.Diagnostics d = (com.terracotta.diagnostic.Diagnostics)DiagnosticsFactory.connect(inet, new Properties())) {
50+
Assert.assertTrue(d.get("Server", "Version").startsWith("Extended Server Example"));
51+
System.out.println(d.list("Server"));
52+
}
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)