From 24a0ab0253afdd03765e2c72f62228e8851c3cbb Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Thu, 14 Jun 2007 17:47:18 +0000
Subject: [PATCH] first quicksetup test
---
opends/build.xml | 49 ++++-
opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/QuickSetupTestCase.java | 49 +++++
opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java | 306 ++++++++++++++++++++++++++++++++++
opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/Utils.java | 84 +++++++++
4 files changed, 479 insertions(+), 9 deletions(-)
diff --git a/opends/build.xml b/opends/build.xml
index 43f9fc9..6d6aede 100644
--- a/opends/build.xml
+++ b/opends/build.xml
@@ -236,6 +236,10 @@
<pathelement location="${classes.dir}" />
</path>
+ <path id="quickSetup.classpath">
+ <pathelement location="${quicksetup.classes.dir}" />
+ </path>
+
<tstamp>
<format property="timestamp" pattern="yyyyMMddHHmmss'Z'"
timezone="UTC" />
@@ -454,7 +458,7 @@
- <target name="weave" if="weave.enabled" depends="compile, prepweave">
+ <target name="weave" if="weave.enabled" depends="compilestatuspanel, prepweave">
<echo message=" Weaving the source code with automatic AspectJ debug logging."/>
<echo message=" Build with -DWEAVE_ENABLED=false to turn this off."/>
<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
@@ -477,7 +481,7 @@
<!-- Compile the Quick Setup source files. -->
- <target name="compilequicksetup" depends="buildtools,weave"
+ <target name="compilequicksetup" depends="buildtools,compile"
description="Compile the Quick Setup source files.">
<mkdir dir="${quicksetup.classes.dir}" />
<javac srcdir="${ads.src.dir}" destdir="${quicksetup.classes.dir}"
@@ -813,6 +817,7 @@
<zipfileset dir="${package.dir}" includes="OpenDS-${VERSION_NUMBER_STRING}/setup,OpenDS-${VERSION_NUMBER_STRING}/uninstall,OpenDS-${VERSION_NUMBER_STRING}/upgrade"
filemode="755" dirmode="755" />
</zip>
+ <property name="package.built" value="true"/>
</target>
@@ -994,15 +999,36 @@
</not>
</condition>
+ <!-- do not run tests dependent upon creation of the .zip file -->
<condition property="test.packages" value="org.opends.server.*">
- <not>
- <or>
- <isset property="test.packages" />
- <isset property="test.classes" />
- <isset property="test.methods" />
- </or>
- </not>
+ <and>
+ <not>
+ <or>
+ <isset property="test.packages" />
+ <isset property="test.classes" />
+ <isset property="test.methods" />
+ </or>
+ </not>
+ <not>
+ <equals arg1="${package.built}" arg2="true" />
+ </not>
+ </and>
</condition>
+
+ <!-- run tests dependent upon creation of the .zip file -->
+ <condition property="test.packages" value="org.opends.server.*,org.opends.quicksetup.*">
+ <and>
+ <not>
+ <or>
+ <isset property="test.packages" />
+ <isset property="test.classes" />
+ <isset property="test.methods" />
+ </or>
+ </not>
+ <equals arg1="${package.built}" arg2="true" />
+ </and>
+ </condition>
+
<condition property="test.classes" value="">
<not>
@@ -1296,6 +1322,11 @@
<include name="*.jar" />
</fileset>
+ <!-- Needed by quicksetup tests -->
+ <fileset dir="${build.dir}/build-tools">
+ <include name="build-tools.jar" />
+ </fileset>
+
<fileset dir="${testng.lib.dir}">
<include name="*.jar" />
</fileset>
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java
new file mode 100644
index 0000000..09d7356
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java
@@ -0,0 +1,306 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup;
+
+import org.testng.annotations.*;
+
+/**
+ * Installation Tester.
+ *
+ */
+@Test(groups = { "slow" })
+public class InstallationTest extends QuickSetupTestCase
+{
+ Installation installation;
+
+ @BeforeClass
+ public void setUp() throws Exception {
+ Utils.extractServer();
+ installation = new Installation(Utils.getQuickSetupTestServerRootDir());
+ }
+
+ @Test
+ public void testValidateRootDirectory()
+ {
+ Installation.validateRootDirectory(Utils.getQuickSetupTestServerRootDir());
+ }
+
+//
+// @Test
+// public void testGetRootDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetRootDirectory not implemented.";
+// }
+//
+// @Test
+// public void testSetRootDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testSetRootDirectory not implemented.";
+// }
+//
+// @Test
+// public void testIsValid()
+// {
+// //TODO: Test goes here...
+// assert false : "testIsValid not implemented.";
+// }
+//
+// @Test
+// public void testGetInvalidityReason()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetInvalidityReason not implemented.";
+// }
+//
+// @Test
+// public void testGetCurrentConfiguration()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetCurrentConfiguration not implemented.";
+// }
+//
+// @Test
+// public void testGetBaseConfiguration()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetBaseConfiguration not implemented.";
+// }
+//
+// @Test
+// public void testGetStatus()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetStatus not implemented.";
+// }
+//
+// @Test
+// public void testGetLibrariesDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetLibrariesDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetSchemaConcatFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetSchemaConcatFile not implemented.";
+// }
+//
+// @Test
+// public void testGetBaseSchemaFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetBaseSchemaFile not implemented.";
+// }
+//
+// @Test
+// public void testGetBaseConfigurationFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetBaseConfigurationFile not implemented.";
+// }
+//
+// @Test
+// public void testGetSvnRev()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetSvnRev not implemented.";
+// }
+//
+// @Test
+// public void testGetCurrentConfigurationFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetCurrentConfigurationFile not implemented.";
+// }
+//
+// @Test
+// public void testGetBinariesDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetBinariesDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetDatabasesDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetDatabasesDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetBackupDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetBackupDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetConfigurationDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetConfigurationDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetLogsDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetLogsDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetLocksDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetLocksDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetTemporaryDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetTemporaryDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetHistoryDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetHistoryDirectory not implemented.";
+// }
+//
+// @Test
+// public void testCreateHistoryBackupDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testCreateHistoryBackupDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetHistoryLogFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetHistoryLogFile not implemented.";
+// }
+//
+// @Test
+// public void testGetConfigurationUpgradeDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetConfigurationUpgradeDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetTemporaryUpgradeDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetTemporaryUpgradeDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetCommandFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetCommandFile not implemented.";
+// }
+//
+// @Test
+// public void testGetServerStartCommandFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetServerStartCommandFile not implemented.";
+// }
+//
+// @Test
+// public void testGetServerStopCommandFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetServerStopCommandFile not implemented.";
+// }
+//
+// @Test
+// public void testGetLdifDirectory()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetLdifDirectory not implemented.";
+// }
+//
+// @Test
+// public void testGetQuicksetupJarFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetQuicksetupJarFile not implemented.";
+// }
+//
+// @Test
+// public void testGetOpenDSJarFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetOpenDSJarFile not implemented.";
+// }
+//
+// @Test
+// public void testGetUninstallBatFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetUninstallBatFile not implemented.";
+// }
+//
+// @Test
+// public void testGetStatusPanelCommandFile()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetStatusPanelCommandFile not implemented.";
+// }
+//
+// @Test
+// public void testGetBuildInformation()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetBuildInformation not implemented.";
+// }
+//
+// @Test
+// public void testGetBuildInformation1()
+// {
+// //TODO: Test goes here...
+// assert false : "testGetBuildInformation1 not implemented.";
+// }
+//
+// @Test
+// public void testToString()
+// {
+// //TODO: Test goes here...
+// assert false : "testToString not implemented.";
+// }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/QuickSetupTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/QuickSetupTestCase.java
new file mode 100644
index 0000000..6c9e7a2
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/QuickSetupTestCase.java
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup;
+
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.AfterSuite;
+import org.opends.server.TestCaseUtils;
+
+/**
+ *
+ */
+public class QuickSetupTestCase {
+
+ @BeforeSuite
+ public final void suppressOutput() {
+ TestCaseUtils.suppressOutput();
+ }
+
+ @AfterSuite
+ public final void shutdownServer() {
+ TestCaseUtils.unsupressOutput();
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/Utils.java b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/Utils.java
new file mode 100644
index 0000000..4529be4
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/Utils.java
@@ -0,0 +1,84 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup;
+
+import org.opends.quicksetup.util.ZipExtractor;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.PrintStream;
+import java.io.ByteArrayOutputStream;
+
+/**
+ *
+ */
+public class Utils {
+
+ /**
+ * The name of the system property that specifies the server build root.
+ */
+ public static final String PROPERTY_BUILD_ROOT =
+ "org.opends.server.BuildRoot";
+
+ static public void extractServer()
+ throws FileNotFoundException, ApplicationException {
+ ZipExtractor extractor = new ZipExtractor(getInstallPackageFile());
+ extractor.extract(getQuickSetupTestServerRootDir());
+ }
+
+ static public File getInstallPackageFile() throws FileNotFoundException {
+ File installPackageFile = null;
+ String buildRoot = System.getProperty(PROPERTY_BUILD_ROOT);
+ File buildDir = new File(buildRoot, "build");
+ File packageDir = new File(buildDir, "package");
+ if (!packageDir.exists()) {
+ throw new FileNotFoundException("Package directory " + packageDir +
+ " does not exist");
+ }
+ String[] files = packageDir.list();
+ if (files != null) {
+ for (String fileName : files) {
+ if (fileName.endsWith(".zip")) {
+ installPackageFile = new File(packageDir, fileName);
+ break;
+ }
+ }
+ } else {
+ throw new FileNotFoundException("No files in " + packageDir);
+ }
+ return installPackageFile;
+ }
+
+ static public File getQuickSetupTestServerRootDir() {
+ String buildRoot = System.getProperty(PROPERTY_BUILD_ROOT);
+ File buildDir = new File(buildRoot, "build");
+ File unitRootDir = new File(buildDir, "unit-tests");
+ return new File(unitRootDir, "quicksetup");
+ }
+
+}
--
Gitblit v1.10.0