1559N/A/*
1559N/A * CDDL HEADER START
1559N/A *
1559N/A * The contents of this file are subject to the terms of the
1559N/A * Common Development and Distribution License, Version 1.0 only
1559N/A * (the "License"). You may not use this file except in compliance
1559N/A * with the License.
1559N/A *
1559N/A * You can obtain a copy of the license at
1559N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE
1559N/A * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
1559N/A * See the License for the specific language governing permissions
1559N/A * and limitations under the License.
1559N/A *
1559N/A * When distributing Covered Code, include this CDDL HEADER in each
1559N/A * file and include the License file at
1559N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1559N/A * add the following below this CDDL HEADER, with the fields enclosed
1559N/A * by brackets "[]" replaced with your own identifying information:
1559N/A * Portions Copyright [yyyy] [name of copyright owner]
1559N/A *
1559N/A * CDDL HEADER END
1559N/A *
1559N/A *
3215N/A * Copyright 2008 Sun Microsystems, Inc.
1559N/A */
1559N/A
1559N/Apackage org.opends.quicksetup;
1559N/A
1559N/Aimport org.testng.annotations.*;
1561N/Aimport static org.testng.Assert.*;
1561N/A
1561N/Aimport java.io.File;
1561N/Aimport java.io.IOException;
1559N/A
1559N/A/**
1559N/A * Installation Tester.
1559N/A */
2342N/A@Test(groups = {"slow"}, sequential=true)
1561N/Apublic class InstallationTest extends QuickSetupTestCase {
1570N/A
1561N/A Installation installation;
1561N/A
1561N/A @BeforeClass
1561N/A public void setUp() throws Exception {
1647N/A installation = TestUtilities.getInstallation();
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests to make sure installation is valid.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testValidateRootDirectory() {
1647N/A Installation.validateRootDirectory(TestUtilities.getQuickSetupTestServerRootDir());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests that installation root directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetRootDirectory() {
1561N/A assertNotNull(installation.getRootDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests that the installation root directory can be set.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testSetRootDirectory() {
1561N/A File root = installation.getRootDirectory();
1561N/A installation.setRootDirectory(root);
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests that the installation root is valid.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testIsValid() {
3824N/A assertTrue(installation.isValid(installation.getRootDirectory()));
3824N/A assertTrue(installation.isValid(installation.getInstanceDirectory()));
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests that an installation directory missing required directories
1561N/A * is considered invalid.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testIsValid2() {
3824N/A assertTrue(installation.isValid(installation.getRootDirectory()));
3824N/A assertTrue(installation.isValid(installation.getInstanceDirectory()));
1561N/A File x = new File(installation.getRootDirectory(), "x");
1561N/A for (String reqDirName : Installation.REQUIRED_DIRECTORIES) {
1561N/A File reqDir = new File(installation.getRootDirectory(), reqDirName);
1561N/A try {
1561N/A assertTrue(reqDir.renameTo(x));
3824N/A assertFalse(installation.isValid(installation.getRootDirectory()));
3824N/A assertFalse(installation.isValid(installation.getInstanceDirectory()));
1561N/A assertNotNull(installation.getInvalidityReason());
1561N/A } finally {
1561N/A x.renameTo(reqDir);
1561N/A }
1561N/A }
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the configuration is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetCurrentConfiguration() {
1561N/A assertNotNull(installation.getCurrentConfiguration());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the base configuration is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetBaseConfiguration() throws ApplicationException {
1561N/A assertNotNull(installation.getBaseConfiguration());
1561N/A }
1559N/A
1561N/A /**
1561N/A * Tests the status is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetStatus() {
1561N/A assertNotNull(installation.getStatus());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the lib directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetLibrariesDirectory() {
1561N/A assertExistentFile(installation.getLibrariesDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the schema concat file is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetSchemaConcatFile() {
1561N/A assertNonexistentFile(installation.getSchemaConcatFile());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the base schema file is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetBaseSchemaFile() throws ApplicationException {
1561N/A assertExistentFile(installation.getBaseSchemaFile());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the base config file is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetBaseConfigurationFile() throws ApplicationException {
1561N/A assertExistentFile(installation.getBaseConfigurationFile());
1561N/A }
1559N/A
1561N/A /**
1561N/A * Tests the SVN rev number is discernable.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetSvnRev() throws ApplicationException {
1561N/A assertNotNull(installation.getSvnRev());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the config file is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetCurrentConfigurationFile() {
1561N/A assertExistentFile(installation.getCurrentConfigurationFile());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the bin/bat directory is available and platform appropriate.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetBinariesDirectory() {
1561N/A File binariesDir;
1561N/A assertExistentFile(binariesDir = installation.getBinariesDirectory());
1561N/A if (File.separator.equals("\\")) {
1561N/A assertTrue(binariesDir.getName().endsWith(
1561N/A Installation.WINDOWS_BINARIES_PATH_RELATIVE));
1561N/A } else {
1561N/A assertTrue(binariesDir.getName().endsWith(
1561N/A Installation.UNIX_BINARIES_PATH_RELATIVE));
1559N/A }
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the db directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetDatabasesDirectory() {
1561N/A assertExistentFile(installation.getDatabasesDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the backup directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetBackupDirectory() {
1561N/A assertExistentFile(installation.getBackupDirectory());
1561N/A }
1559N/A
1561N/A /**
1561N/A * Tests the config directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetConfigurationDirectory() {
1561N/A assertExistentFile(installation.getConfigurationDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the logs directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetLogsDirectory() {
1561N/A assertExistentFile(installation.getLogsDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the locks directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetLocksDirectory() {
1561N/A assertExistentFile(installation.getLocksDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the tmp directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetTemporaryDirectory() {
1561N/A assertNonexistentFile(installation.getTemporaryDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the history directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetHistoryDirectory() {
1567N/A assertNonexistentFile(installation.getHistoryDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests a historical backup directory can be created.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testCreateHistoryBackupDirectory() throws IOException {
1561N/A assertExistentFile(installation.createHistoryBackupDirectory());
1561N/A assertExistentFile(installation.getHistoryDirectory());
1561N/A assertTrue(installation.getHistoryDirectory().exists());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the history log file is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetHistoryLogFile() {
1561N/A assertNonexistentFile(installation.getHistoryLogFile());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the config upgrade directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetConfigurationUpgradeDirectory() {
1561N/A assertExistentFile(installation.getConfigurationUpgradeDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the tmp/upgrade directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetTemporaryUpgradeDirectory() {
1561N/A assertNonexistentFile(installation.getTemporaryUpgradeDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests getting a command file works.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetCommandFile() {
1561N/A assertExistentFile(installation.getCommandFile(
1561N/A Installation.UNIX_START_FILE_NAME));
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the start server command is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetServerStartCommandFile() {
1561N/A assertExistentFile(installation.getServerStartCommandFile());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the stop server command is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetServerStopCommandFile() {
1561N/A assertExistentFile(installation.getServerStopCommandFile());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the ldif directory is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetLdifDirectory() {
1561N/A assertExistentFile(installation.getLdifDirectory());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the quicksetup jar is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetQuicksetupJarFile() {
1561N/A assertExistentFile(installation.getQuicksetupJarFile());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the OpenDS jar is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetOpenDSJarFile() {
1561N/A assertExistentFile(installation.getOpenDSJarFile());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the uninstall file is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetUninstallBatFile() {
1561N/A assertExistentFile(installation.getUninstallBatFile());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the status panel command file is available.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetStatusPanelCommandFile() {
3853N/A assertExistentFile(installation.getControlPanelCommandFile());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the build information is discernable.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetBuildInformation() throws ApplicationException {
1561N/A assertNotNull(installation.getBuildInformation());
1561N/A }
1561N/A
1561N/A /**
1561N/A * Tests the build information is discernable.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testGetBuildInformation1() throws ApplicationException {
1561N/A assertNotNull(installation.getBuildInformation(true));
1561N/A assertNotNull(installation.getBuildInformation(false));
1561N/A }
1561N/A
1561N/A /**
1561N/A * Test string representation is possible.
1561N/A */
1986N/A @Test(enabled = false)
1561N/A public void testToString() {
1561N/A assertNotNull(installation.toString());
1561N/A }
1561N/A
1561N/A private void assertExistentFile(File f) {
1561N/A assertNotNull(f);
1561N/A assertTrue(f.exists());
1561N/A }
1561N/A
1561N/A private void assertNonexistentFile(File f) {
1561N/A assertNotNull(f);
1561N/A }
1559N/A
1559N/A}