"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "galvan-support/src/main/java/org/terracotta/testing/master/BasicHarnessEntry.java" between
terracotta-core-5.7.0.tar.gz and terracotta-core-5.7.1.tar.gz

About: Terracotta - Clustering technology for Java ("Network Attached Memory", "Distributed Cache"). Source code of the server (5.x) core components.

BasicHarnessEntry.java  (terracotta-core-5.7.0):BasicHarnessEntry.java  (terracotta-core-5.7.1)
skipping to change at line 21 skipping to change at line 21
* the specific language governing rights and limitations under the License. * the specific language governing rights and limitations under the License.
* *
* The Covered Software is Terracotta Core. * The Covered Software is Terracotta Core.
* *
* The Initial Developer of the Covered Software is * The Initial Developer of the Covered Software is
* Terracotta, Inc., a Software AG company * Terracotta, Inc., a Software AG company
* *
*/ */
package org.terracotta.testing.master; package org.terracotta.testing.master;
import com.tc.util.PortChooser;
import org.terracotta.testing.api.BasicTestClusterConfiguration; import org.terracotta.testing.api.BasicTestClusterConfiguration;
import org.terracotta.testing.common.Assert; import org.terracotta.testing.common.Assert;
import org.terracotta.testing.config.BasicClientArgumentBuilder; import org.terracotta.testing.config.BasicClientArgumentBuilder;
import org.terracotta.testing.config.ClientsConfiguration; import org.terracotta.testing.config.ClientsConfiguration;
import org.terracotta.testing.config.ClusterInfo; import org.terracotta.testing.config.ClusterInfo;
import org.terracotta.testing.config.StripeConfiguration; import org.terracotta.testing.config.StripeConfiguration;
import org.terracotta.testing.config.TcConfigBuilder; import org.terracotta.testing.config.TcConfigBuilder;
import org.terracotta.testing.logging.VerboseManager; import org.terracotta.testing.logging.VerboseManager;
import java.io.IOException; import java.io.IOException;
import java.io.UncheckedIOException; import java.io.UncheckedIOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.IntStream;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.stream.Collectors.toList;
import static org.terracotta.testing.config.ConfigConstants.DEFAULT_SERVER_HEAP_ MB; import static org.terracotta.testing.config.ConfigConstants.DEFAULT_SERVER_HEAP_ MB;
import org.terracotta.testing.config.DefaultStartupCommandBuilder; import org.terracotta.testing.config.DefaultStartupCommandBuilder;
import org.terracotta.testing.config.StartupCommandBuilder; import org.terracotta.testing.config.StartupCommandBuilder;
import org.terracotta.testing.support.PortTool;
import org.terracotta.utilities.test.net.PortManager;
/** /**
* The harness entry-point for the harness running {@link BasicTestClusterConfig uration} tests. * The harness entry-point for the harness running {@link BasicTestClusterConfig uration} tests.
*/ */
public class BasicHarnessEntry extends AbstractHarnessEntry<BasicTestClusterConf iguration> { public class BasicHarnessEntry extends AbstractHarnessEntry<BasicTestClusterConf iguration> {
// Run the one configuration. // Run the one configuration.
@Override @Override
protected void runOneConfiguration(VerboseManager verboseManager, DebugOptions debugOptions, CommonHarnessOptions harnessOptions, protected void runOneConfiguration(VerboseManager verboseManager, DebugOptions debugOptions, CommonHarnessOptions harnessOptions,
BasicTestClusterConfiguration runConfigurat ion) throws IOException, GalvanFailureException { BasicTestClusterConfiguration runConfigurat ion) throws IOException, GalvanFailureException {
int stripeSize = runConfiguration.serversInStripe; int stripeSize = runConfiguration.serversInStripe;
Assert.assertTrue(stripeSize > 0); Assert.assertTrue(stripeSize > 0);
List<String> serverNames = new ArrayList<>(); /*
List<Integer> serverPorts = new ArrayList<>(); * Debug ports, if requested, are reserved from a specified base port, first
List<Integer> serverGroupPorts = new ArrayList<>(); . This
* provides the best chance of allocating a consecutive list of ports withou
t interference
* from the server and group port reservations.
*/
PortManager portManager = PortManager.getInstance();
List<PortManager.PortRef> debugPortRefs = new ArrayList<>();
List<Integer> serverDebugPorts = new ArrayList<>(); List<Integer> serverDebugPorts = new ArrayList<>();
int basePort = new PortChooser().chooseRandomPorts(stripeSize * 2); PortTool.assignDebugPorts(portManager, debugOptions.serverDebugPortStart, st
int serverDebugPortStart = debugOptions.serverDebugPortStart; ripeSize, debugPortRefs, serverDebugPorts);
for (int i = 0; i < stripeSize; i++) {
serverNames.add("testServer" + i); List<PortManager.PortRef> serverPortRefs = portManager.reservePorts(stripeSi
serverPorts.add(basePort++); ze);
serverGroupPorts.add(basePort++); List<PortManager.PortRef> groupPortRefs = portManager.reservePorts(stripeSiz
serverDebugPorts.add(serverDebugPortStart == 0 ? 0 : serverDebugPortStart+ e);
+);
} List<Integer> serverPorts = serverPortRefs.stream().map(PortManager.PortRef:
:port).collect(toList());
List<Integer> serverGroupPorts = groupPortRefs.stream().map(PortManager.Port
Ref::port).collect(toList());
List<String> serverNames = IntStream.range(0, stripeSize).mapToObj(i -> "tes
tserver" + i).collect(toList());
String stripeName = "stripe1"; String stripeName = "stripe1";
Path stripeInstallationDir = harnessOptions.configTestDir.resolve(stripeName ); Path stripeInstallationDir = harnessOptions.configTestDir.resolve(stripeName );
Files.createDirectory(stripeInstallationDir); Files.createDirectory(stripeInstallationDir);
Path tcConfig = createTcConfig(serverNames, serverPorts, serverGroupPorts, s tripeInstallationDir, harnessOptions); Path tcConfig = createTcConfig(serverNames, serverPorts, serverGroupPorts, s tripeInstallationDir, harnessOptions);
VerboseManager stripeVerboseManager = verboseManager.createComponentManager( "[" + stripeName + "]"); VerboseManager stripeVerboseManager = verboseManager.createComponentManager( "[" + stripeName + "]");
StripeConfiguration stripeConfig = new StripeConfiguration(serverDebugPorts, serverPorts, serverGroupPorts, serverNames, StripeConfiguration stripeConfig = new StripeConfiguration(serverDebugPorts, serverPorts, serverGroupPorts, serverNames,
stripeName, DEFAULT_SERVER_HEAP_MB, "logback-ext.xml", harnessOptions.se rverProperties); stripeName, DEFAULT_SERVER_HEAP_MB, "logback-ext.xml", harnessOptions.se rverProperties);
skipping to change at line 119 skipping to change at line 127
harnessOptions.clientsToCreate, argBuilder, connectUri, 1, stripeSize, d ebugOptions.setupClientDebugPort, harnessOptions.clientsToCreate, argBuilder, connectUri, 1, stripeSize, d ebugOptions.setupClientDebugPort,
debugOptions.destroyClientDebugPort, debugOptions.testClientDebugPortSta rt, harnessOptions.failOnLog, clusterInfo); debugOptions.destroyClientDebugPort, debugOptions.testClientDebugPortSta rt, harnessOptions.failOnLog, clusterInfo);
VerboseManager clientsVerboseManager = verboseManager.createComponentManager ("[Clients]"); VerboseManager clientsVerboseManager = verboseManager.createComponentManager ("[Clients]");
new ClientSubProcessManager(interlock, stateManager, clientsVerboseManager, clientsConfiguration, processControl).start(); new ClientSubProcessManager(interlock, stateManager, clientsVerboseManager, clientsConfiguration, processControl).start();
// NOTE: waitForFinish() throws GalvanFailureException on failure. // NOTE: waitForFinish() throws GalvanFailureException on failure.
try { try {
stateManager.waitForFinish(); stateManager.waitForFinish();
} finally { } finally {
// No matter what happened, shut down the test. // No matter what happened, shut down the test.
interlock.forceShutdown(); try {
interlock.forceShutdown();
} finally {
serverPortRefs.forEach(PortManager.PortRef::close);
groupPortRefs.forEach(PortManager.PortRef::close);
debugPortRefs.stream().filter(Objects::nonNull).forEach(PortManager.Port
Ref::close);
}
} }
} }
private Path relativize(Path root, Path other) { private Path relativize(Path root, Path other) {
return root.toAbsolutePath().relativize(other.toAbsolutePath()); return root.toAbsolutePath().relativize(other.toAbsolutePath());
} }
private Path createTcConfig(List<String> serverNames, List<Integer> serverPort s, List<Integer> serverGroupPorts, private Path createTcConfig(List<String> serverNames, List<Integer> serverPort s, List<Integer> serverGroupPorts,
Path stripeInstallationDir, CommonHarnessOptions h arnessOpts) { Path stripeInstallationDir, CommonHarnessOptions h arnessOpts) {
TcConfigBuilder configBuilder = new TcConfigBuilder(serverNames, serverPorts , serverGroupPorts, harnessOpts.tcProperties, TcConfigBuilder configBuilder = new TcConfigBuilder(serverNames, serverPorts , serverGroupPorts, harnessOpts.tcProperties,
 End of changes. 7 change blocks. 
14 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)