Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Waibel2014-02-20 07:27:35 -0500
committerFlorian Waibel2014-02-20 07:27:35 -0500
commit4d03b4f2f77d42697e6722bcc06753ed23c25e7d (patch)
tree6ed8cbc22bdd8119a2b9bc0045daa05aa40d38d3
parent1e7dfdc3e258052b309b522baf1494abc26c32b0 (diff)
downloadorg.eclipse.virgo.kernel-4d03b4f2f77d42697e6722bcc06753ed23c25e7d.tar.gz
org.eclipse.virgo.kernel-4d03b4f2f77d42697e6722bcc06753ed23c25e7d.tar.xz
org.eclipse.virgo.kernel-4d03b4f2f77d42697e6722bcc06753ed23c25e7d.zip
428093 Removes duplicate code (project has been copied to packaging repository) oev.kernel.smoketest
-rw-r--r--org.eclipse.virgo.kernel.smoketest/.classpath10
-rw-r--r--org.eclipse.virgo.kernel.smoketest/.project17
-rw-r--r--org.eclipse.virgo.kernel.smoketest/build.xml9
-rw-r--r--org.eclipse.virgo.kernel.smoketest/ivy.xml22
-rw-r--r--org.eclipse.virgo.kernel.smoketest/src/main/java/.gitignore0
-rw-r--r--org.eclipse.virgo.kernel.smoketest/src/main/resources/suppresswarning/.gitignore0
-rw-r--r--org.eclipse.virgo.kernel.smoketest/src/test/java/org/eclipse/virgo/kernel/smoketest/AbstractKernelTests.java300
-rw-r--r--org.eclipse.virgo.kernel.smoketest/src/test/java/org/eclipse/virgo/kernel/smoketest/KernelStartupAndShutdownTests.java33
-rw-r--r--org.eclipse.virgo.kernel.smoketest/src/test/resources/.gitignore0
9 files changed, 0 insertions, 391 deletions
diff --git a/org.eclipse.virgo.kernel.smoketest/.classpath b/org.eclipse.virgo.kernel.smoketest/.classpath
deleted file mode 100644
index f5a00fca..00000000
--- a/org.eclipse.virgo.kernel.smoketest/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
- <classpathentry kind="var" path="IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.7.0.D-20130521040431/org.eclipse.virgo.util.io-3.7.0.D-20130521040431.jar" sourcepath="/IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.5.0.D-20120615065828/org.eclipse.virgo.util.io-sources-3.5.0.D-20120615065828.jar"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/org.eclipse.virgo.kernel.smoketest/.project b/org.eclipse.virgo.kernel.smoketest/.project
deleted file mode 100644
index 3e467a68..00000000
--- a/org.eclipse.virgo.kernel.smoketest/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.virgo.kernel.smoketest</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.virgo.kernel.smoketest/build.xml b/org.eclipse.virgo.kernel.smoketest/build.xml
deleted file mode 100644
index d12096d2..00000000
--- a/org.eclipse.virgo.kernel.smoketest/build.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="org.eclipse.virgo.kernel.smoketest">
-
- <property file="${basedir}/../build.properties"/>
- <property file="${basedir}/../build.versions"/>
- <import file="${basedir}/../virgo-build/standard/default.xml"/>
- <import file="${basedir}/../build-kernel/test-package.xml"/>
-
-</project>
diff --git a/org.eclipse.virgo.kernel.smoketest/ivy.xml b/org.eclipse.virgo.kernel.smoketest/ivy.xml
deleted file mode 100644
index 98ca4fc4..00000000
--- a/org.eclipse.virgo.kernel.smoketest/ivy.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" version="2.0">
-
- <info organisation="${project.organisation}" module="${ant.project.name}" />
-
- <configurations>
- <include file="${virgo.build.dir}/common/default-ivy-configurations.xml" />
- </configurations>
-
- <publications>
- <artifact name="${ant.project.name}" />
- <artifact name="${ant.project.name}-sources" type="src" ext="jar" />
- </publications>
-
- <dependencies>
- <dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime" />
- <dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.io" rev="${org.eclipse.virgo.util}" conf="test->runtime"/>
-
- <override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
- </dependencies>
-
-</ivy-module>
diff --git a/org.eclipse.virgo.kernel.smoketest/src/main/java/.gitignore b/org.eclipse.virgo.kernel.smoketest/src/main/java/.gitignore
deleted file mode 100644
index e69de29b..00000000
--- a/org.eclipse.virgo.kernel.smoketest/src/main/java/.gitignore
+++ /dev/null
diff --git a/org.eclipse.virgo.kernel.smoketest/src/main/resources/suppresswarning/.gitignore b/org.eclipse.virgo.kernel.smoketest/src/main/resources/suppresswarning/.gitignore
deleted file mode 100644
index e69de29b..00000000
--- a/org.eclipse.virgo.kernel.smoketest/src/main/resources/suppresswarning/.gitignore
+++ /dev/null
diff --git a/org.eclipse.virgo.kernel.smoketest/src/test/java/org/eclipse/virgo/kernel/smoketest/AbstractKernelTests.java b/org.eclipse.virgo.kernel.smoketest/src/test/java/org/eclipse/virgo/kernel/smoketest/AbstractKernelTests.java
deleted file mode 100644
index c04b997c..00000000
--- a/org.eclipse.virgo.kernel.smoketest/src/test/java/org/eclipse/virgo/kernel/smoketest/AbstractKernelTests.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.smoketest;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.management.ManagementFactory;
-import java.lang.management.OperatingSystemMXBean;
-import java.rmi.ConnectIOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
-
-import org.eclipse.virgo.util.io.FileCopyUtils;
-import org.eclipse.virgo.util.io.NetUtils;
-
-public class AbstractKernelTests {
-
- private static MBeanServerConnection connection = null;
- private static String binDir = null;
- private static String configDir = null;
- private static String watchRepoDir = null;
- private static String srcDir = "src/test/resources";
- private static String srcFileName = "org.eclipse.virgo.repository.properties";
- private static String bundlesDir = "src/test/resources/bundles";
- private static String[] bundleNames = new String[] { "org.springframework.dmServer.testtool.incoho.domain-1.0.0.RELEASE.jar" };
-
- private static Process process = null;
- private static ProcessBuilder pb = null;
- private static File startup = null;
- private static String startupFileName = null;
- private static File shutdown = null;
- private static String shutdownFileName = null;
- private static File startupURI = null;
- private static File shutdownURI = null;
- private static OperatingSystemMXBean os = ManagementFactory
- .getOperatingSystemMXBean();
- public static final long HALF_SECOND = 500;
-
- public static final long TWO_MINUTES = 120 * 1000;
- public static final String STATUS_STARTED = "STARTED";
- public static final String STATUS_STARTING = "STARTING";
-
- protected static MBeanServerConnection getMBeanServerConnection()
- throws Exception {
- String severDir = null;
- Map<String, String[]> env = new HashMap<String, String[]>();
-
- File testExpanded = new File("./target/test-expanded/");
- for (File mainDir : testExpanded.listFiles()) {
- if (mainDir.isDirectory()) {
- severDir = new File(mainDir.toURI()).getCanonicalPath();
-
- }
- }
- String[] creds = { "admin", "admin" };
- env.put(JMXConnector.CREDENTIALS, creds);
-
- System.setProperty("javax.net.ssl.trustStore", severDir
- + "/configuration/keystore");
- System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
-
- JMXServiceURL url = new JMXServiceURL(
- "service:jmx:rmi:///jndi/rmi://localhost:9875/jmxrmi");
- connection = JMXConnectorFactory.connect(url, env)
- .getMBeanServerConnection();
- return connection;
- }
-
- protected static String getKernelStartUpStatus() throws Exception {
- String kernelStartupStatus = (String) getMBeanServerConnection()
- .getAttribute(
- new ObjectName(
- "org.eclipse.virgo.kernel:type=KernelStatus"),
- "Status");
- return kernelStartupStatus;
- }
-
- private static String getKernelBinDir() throws IOException {
- if (binDir == null) {
- File testExpanded = new File("./target/test-expanded/");
- for (File candidate : testExpanded.listFiles()) {
- if (candidate.isDirectory()) {
- binDir = new File(candidate, "bin").getCanonicalPath();
- break;
- }
- }
- }
- return binDir;
- }
-
- protected static String getKernelConfigDir() throws IOException {
- if (configDir == null) {
- File testExpanded = new File("./target/test-expanded/");
- for (File candidate : testExpanded.listFiles()) {
- if (candidate.isDirectory()) {
- configDir = new File(candidate, "config")
- .getCanonicalPath();
- break;
- }
- }
- }
- return configDir;
- }
-
- protected static void configureWatchRepoWithDefaultConfiguration(
- String destDir) {
- try {
- FileCopyUtils.copy(new File(srcDir, srcFileName), new File(destDir,
- srcFileName));
- } catch (IOException e) {
- e.printStackTrace();
- }
- createWatchedRepoDir();
- }
-
- protected static void addBundlesToWatchedRepository(String watchRepoDir) {
- for (String bundleName : bundleNames) {
- try {
- FileCopyUtils.copy(new File(bundlesDir, bundleName), new File(
- watchRepoDir, bundleName));
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- }
-
- protected static String getWatchedRepoDir() throws IOException {
- if (watchRepoDir == null) {
- File testExpanded = new File("./target/test-expanded/");
- for (File mainDir : testExpanded.listFiles()) {
- if (mainDir.isDirectory()) {
- File repositoryDir = new File(mainDir, "repository")
- .getCanonicalFile();
- if (repositoryDir.isDirectory()) {
- watchRepoDir = new File(repositoryDir, "watched-repo")
- .getCanonicalPath();
- break;
- }
-
- }
- }
- }
- return watchRepoDir;
- }
-
- protected static void createWatchedRepoDir() {
- File testExpanded = new File("./target/test-expanded/");
- for (File candidate : testExpanded.listFiles()) {
- if (candidate.isDirectory()) {
- File repoDir = new File(candidate, "repository");
- if (repoDir.mkdir()) {
- new File(repoDir, "watched-repo").mkdir();
- }
- }
- }
- }
-
- public static void waitForKernelStartFully() throws Exception {
- waitForKernelStartFully(TWO_MINUTES, HALF_SECOND);
- }
-
- public static void waitForKernelShutdownFully() throws Exception {
- waitForKernelShutdownFully(TWO_MINUTES, HALF_SECOND);
- }
-
- private static void waitForKernelStartFully(long duration, long interval) throws Exception {
- long startTime = System.currentTimeMillis();
- while (System.currentTimeMillis() - startTime < duration) {
- try {
- if (getKernelStartUpStatus().equals(STATUS_STARTED)) {
- return;
- } else if (getKernelStartUpStatus().equals(STATUS_STARTING)) {
- continue;
- }
- } catch (InstanceNotFoundException e) {
- continue;
- } catch (ConnectIOException e) {
- continue;
- } catch (IOException e) {
- continue;
- }
- Thread.sleep(interval);
- }
- }
-
- private static void waitForKernelShutdownFully(long duration, long interval) throws Exception {
- long startTime = System.currentTimeMillis();
- while (System.currentTimeMillis() - startTime < duration) {
- try {
- if (!getKernelStartUpStatus().equals(STATUS_STARTED)) {
- if (NetUtils.isPortAvailable(9875)) {
- return;
- }
- }
- } catch (InstanceNotFoundException e) {
- return;
- } catch (ConnectIOException e) {
- return;
- } catch (IOException e) {
- return;
- }
- Thread.sleep(interval);
- }
- }
-
- protected static class KernelStartUpThread implements Runnable {
- public KernelStartUpThread() {
- }
-
- public void run() {
- String[] args = null;
- try {
- if (os.getName().contains("Windows")) {
- startup = new File(getKernelBinDir(), "startup.bat");
- startupURI = new File(startup.toURI());
- startupFileName = startupURI.getCanonicalPath();
-
- } else {
- startup = new File(getKernelBinDir(), "startup.sh");
- startupURI = new File(startup.toURI());
- startupFileName = startupURI.getCanonicalPath();
- }
- args = new String[] { startupFileName };
- pb = new ProcessBuilder(args);
- pb.redirectErrorStream(true);
- Map<String, String> env = pb.environment();
- env.put("JAVA_HOME", System.getProperty("java.home"));
-
- process = pb.start();
-
- InputStream is = process.getInputStream();
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line;
- while ((line = br.readLine()) != null) {
- System.out.println(line);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- protected static class KernelShutdownThread implements Runnable {
- public KernelShutdownThread() {
- }
-
- public void run() {
- String[] args = null;
- try {
- if (os.getName().contains("Windows")) {
- shutdown = new File(getKernelBinDir(), "shutdown.bat");
- shutdownURI = new File(shutdown.toURI());
- shutdownFileName = shutdownURI.getCanonicalPath();
- } else {
- shutdown = new File(getKernelBinDir(), "shutdown.sh");
- shutdownURI = new File(shutdown.toURI());
- shutdownFileName = shutdownURI.getCanonicalPath();
- }
- args = new String[] { shutdownFileName };
- pb = new ProcessBuilder(args);
- pb.redirectErrorStream(true);
- Map<String, String> env = pb.environment();
- env.put("JAVA_HOME", System.getProperty("java.home"));
-
- process = pb.start();
-
- InputStream is = process.getInputStream();
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line;
- while ((line = br.readLine()) != null) {
- System.out.println(line);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.smoketest/src/test/java/org/eclipse/virgo/kernel/smoketest/KernelStartupAndShutdownTests.java b/org.eclipse.virgo.kernel.smoketest/src/test/java/org/eclipse/virgo/kernel/smoketest/KernelStartupAndShutdownTests.java
deleted file mode 100644
index 2797a028..00000000
--- a/org.eclipse.virgo.kernel.smoketest/src/test/java/org/eclipse/virgo/kernel/smoketest/KernelStartupAndShutdownTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.smoketest;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class KernelStartupAndShutdownTests extends AbstractKernelTests {
-
- @Test
- public void testKernelStartUpStatus() throws Exception {
- new Thread(new KernelStartUpThread()).start();
- AbstractKernelTests.waitForKernelStartFully();
- Thread.sleep(20000); // wait for startup to complete in case it fails
- assertEquals(STATUS_STARTED, getKernelStartUpStatus());
- }
-
- @Test
- public void testKernelShutdownStatus() throws Exception {
- new Thread(new KernelShutdownThread()).start();
- AbstractKernelTests.waitForKernelShutdownFully();
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.smoketest/src/test/resources/.gitignore b/org.eclipse.virgo.kernel.smoketest/src/test/resources/.gitignore
deleted file mode 100644
index e69de29b..00000000
--- a/org.eclipse.virgo.kernel.smoketest/src/test/resources/.gitignore
+++ /dev/null

Back to the top