From 5db7f639ec76d25a07703264a22b748d02768bc5 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Wed, 11 Oct 2006 20:20:11 +0000
Subject: [PATCH] Remove the unused fixture classes from the unit test framework.
---
/dev/null | 92 ----------------------------------------------
1 files changed, 0 insertions(+), 92 deletions(-)
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/ConfigurationFixture.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/ConfigurationFixture.java
deleted file mode 100644
index 22ca2ab..0000000
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/ConfigurationFixture.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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 2006 Sun Microsystems, Inc.
- */
-package org.opends.server;
-
-import static org.opends.server.TestCaseUtils.copyFile;
-import static org.opends.server.TestCaseUtils.createTemporaryDirectory;
-import static org.opends.server.TestCaseUtils.deleteDirectory;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.opends.server.config.ConfigFileHandler;
-import org.opends.server.core.DirectoryServer;
-
-/**
- *
- * This fixture makes sure that a directory server instance is available
- * with a configuration environment loaded from the source tree's
- * resource directory.
- * <p>
- * This fixture should be used by test cases which need a directory
- * server instance with a working configuration environment.
- */
-public final class ConfigurationFixture {
-
- /**
- * A factory used to obtain the configuration fixture instance.
- */
- @Deprecated
- public static final FixtureFactory<ConfigurationFixture> FACTORY;
-
- static {
- FACTORY = new SingletonFixtureFactory<ConfigurationFixture>(
- new Factory());
- }
-
- // The name of the temporary instance root directory.
- private File instanceRoot;
-
- /**
- * Internal factory implementation.
- */
- @Deprecated
- private static final class Factory implements
- FixtureFactory<ConfigurationFixture> {
-
- // The configuration fixture instance.
- private ConfigurationFixture instance = null;
-
- /**
- * {@inheritDoc}
- */
- @Deprecated
- public ConfigurationFixture setUp() throws Exception {
- // This fixture requires the initial directory server fixture.
- InitialDirectoryServerFixture.FACTORY.setUp();
-
- // Create temporary config file structure.
- File tempDirectory = createTemporaryDirectory("ds7test");
-
- // Create the configuration directory.
- File configDirectory = new File(tempDirectory, "config");
- configDirectory.mkdir();
-
- // All files to be copied are taken from the resource directory.
- File configResourceDirectory = new File("resource/config");
-
- // Copy over the configuration file.
- File configFile = new File(configDirectory, "config.ldif");
- copyFile(new File(configResourceDirectory, "config.ldif"), configFile);
-
- DirectoryServer directoryServer = DirectoryServer.getInstance();
- directoryServer.initializeConfiguration(ConfigFileHandler.class
- .getName(), configFile.getAbsolutePath());
-
- instance = new ConfigurationFixture(tempDirectory);
- return instance;
- }
-
- /**
- * {@inheritDoc}
- */
- @Deprecated
- public void tearDown() throws Exception {
- // Clean up configuration directories.
- try {
- deleteDirectory(instance.getInstanceRoot());
- } catch (IOException e) {
- // Ignore errors.
- }
-
- instance = null;
-
- // Make sure resource held by the directory server fixture are
- // released.
- InitialDirectoryServerFixture.FACTORY.tearDown();
- }
-
- }
-
- /**
- * Create a configuration fixture.
- *
- * @param instanceRoot
- * The name of the temporary instance root.
- */
- @Deprecated
- private ConfigurationFixture(File instanceRoot) {
- this.instanceRoot = instanceRoot;
- }
-
- /**
- * Get the temporary instance root.
- *
- * @return The temporary instance root.
- */
- @Deprecated
- public File getInstanceRoot() {
- return instanceRoot;
- }
-}
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/FixtureFactory.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/FixtureFactory.java
deleted file mode 100644
index 65b29c4..0000000
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/FixtureFactory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 2006 Sun Microsystems, Inc.
- */
-
-package org.opends.server;
-
-/**
- *
- * A factory interface for controlling construction and finalization of
- * fixtures.
- *
- * @param <T>
- * The type of fixture managed by this factory.
- */
-public interface FixtureFactory<T> {
- /**
- * Create and initialize the fixture instance.
- *
- * @return The fixture instance.
- * @throws Exception
- * If the fixture instance could not be initialized
- * successfully.
- */
- @Deprecated
- public T setUp() throws Exception;
-
- /**
- * Tear down the fixture instance, releasing any resources in the
- * process.
- *
- * @throws Exception
- * If the fixture instance could not be finalized.
- */
- @Deprecated
- public void tearDown() throws Exception;
-}
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/InitialDirectoryServerFixture.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/InitialDirectoryServerFixture.java
deleted file mode 100644
index e810982..0000000
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/InitialDirectoryServerFixture.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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 2006 Sun Microsystems, Inc.
- */
-package org.opends.server;
-
-import static org.opends.server.loggers.Debug.removeAllDebugLoggers;
-import static org.opends.server.loggers.Error.removeAllErrorLoggers;
-
-import org.opends.server.core.DirectoryServer;
-
-/**
- *
- * This fixture makes sure that a minimal directory server instance is
- * available. Only one initialization task is performed: the directory
- * server instance is created and has its
- * {@link org.opends.server.core.DirectoryServer#bootstrapClient()}
- * method invoked.
- */
-public final class InitialDirectoryServerFixture {
-
- /**
- * A factory used to obtain the initial directory server fixture
- * instance.
- */
- @Deprecated
- public static final FixtureFactory<InitialDirectoryServerFixture> FACTORY;
-
- static {
- FACTORY = new SingletonFixtureFactory<InitialDirectoryServerFixture>(
- new Factory());
- }
-
- /**
- * Internal factory implementation.
- */
- @Deprecated
- private static final class Factory implements
- FixtureFactory<InitialDirectoryServerFixture> {
- /**
- * {@inheritDoc}
- */
- @Deprecated
- public InitialDirectoryServerFixture setUp() throws Exception {
- // Make sure a new instance is created.
- //
- // This is effectively a no-op at the moment, but may do lazy
- // initialization at some point.
- DirectoryServer.getInstance();
-
- // Initialize minimal features such as key syntaxes.
- DirectoryServer.bootstrapClient();
-
- // Many things are dependent on JMX to register an alert
- // generator.
- DirectoryServer.initializeJMX();
-
- removeAllDebugLoggers(true);
- removeAllErrorLoggers(true);
-
- // Return a dummy fixture.
- return new InitialDirectoryServerFixture();
- }
-
- /**
- * {@inheritDoc}
- */
- @Deprecated
- public void tearDown() throws Exception {
- // No implementation required - no way to finalize the directory
- // server instance.
- }
-
- }
-
- /**
- * Create an initial directory server fixture.
- */
- private InitialDirectoryServerFixture() {
- // No implementation required.
- }
-}
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/SchemaFixture.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/SchemaFixture.java
deleted file mode 100644
index 9aac779..0000000
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/SchemaFixture.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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 2006 Sun Microsystems, Inc.
- */
-package org.opends.server;
-
-import static org.opends.server.TestCaseUtils.copyDirectory;
-
-import java.io.File;
-
-import org.opends.server.core.DirectoryServer;
-
-/**
- *
- * This fixture makes sure that a directory server instance is available
- * with the core schema files loaded from the source tree's resource
- * directory.
- * <p>
- * This fixture should be used by test cases which need a directory
- * server instance with core schema files loaded.
- */
-public final class SchemaFixture {
-
- /**
- * A factory used to obtain the schema fixture instance.
- */
- @Deprecated
- public static final FixtureFactory<SchemaFixture> FACTORY;
-
- static {
- FACTORY = new SingletonFixtureFactory<SchemaFixture>(new Factory());
- }
-
- /**
- * Internal factory implementation.
- */
- @Deprecated
- private static final class Factory implements
- FixtureFactory<SchemaFixture> {
-
- /**
- * {@inheritDoc}
- */
- @Deprecated
- public SchemaFixture setUp() throws Exception {
- // This fixture requires the configuration fixture.
- ConfigurationFixture fixture = ConfigurationFixture.FACTORY.setUp();
-
- // Copy over the schema files.
- File tempDirectory = fixture.getInstanceRoot();
- File configDirectory = new File(tempDirectory, "config");
- File schemaDirectory = new File(configDirectory, "schema");
- File resourceDirectory = new File("resource");
- copyDirectory(new File(resourceDirectory, "schema"), schemaDirectory);
-
- // Initialize and load the schema files.
- DirectoryServer.getInstance().initializeSchema();
-
- return new SchemaFixture();
- }
-
- /**
- * {@inheritDoc}
- */
- @Deprecated
- public void tearDown() throws Exception {
- // TODO: clean up the schema?
-
- // Make sure resource held by the configuration fixture are
- // released.
- ConfigurationFixture.FACTORY.tearDown();
- }
-
- }
-
- /**
- * Create a schema fixture.
- */
- @Deprecated
- private SchemaFixture() {
- // No implementation required.
- }
-}
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/SingletonFixtureFactory.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/SingletonFixtureFactory.java
deleted file mode 100644
index 4127ce3..0000000
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/SingletonFixtureFactory.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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 2006 Sun Microsystems, Inc.
- */
-
-package org.opends.server;
-
-/**
- *
- * A fixture factory that guarantees that at most only one instance of a
- * fixture is instantiated. The singleton factory uses reference
- * counting to guarantee that the fixture instance is torn down at the
- * correct time.
- *
- * @param <T> The type of fixture managed by this factory.
- */
-public final class SingletonFixtureFactory<T> implements FixtureFactory<T> {
- // The underlying fixture factory.
- private FixtureFactory<T> pimpl;
-
- // The underlying fixture instance.
- private T instance;
-
- // Reference count used to determine when tearDown can be performed.
- private int refCount;
-
- /**
- * Create a new singleton fixture factory.
- *
- * @param pimpl
- * The underlying fixture factory.
- */
- //@Deprecated
- public SingletonFixtureFactory(FixtureFactory<T> pimpl) {
- this.pimpl = pimpl;
- this.instance = null;
- this.refCount = 0;
- }
-
- /**
- * {@inheritDoc}
- */
- @Deprecated
- public T setUp() throws Exception {
- if (refCount == 0) {
- instance = pimpl.setUp();
- }
-
- refCount++;
- return instance;
- }
-
- /**
- * {@inheritDoc}
- */
- @Deprecated
- public void tearDown() throws Exception {
- if (refCount <= 0) {
- throw new IllegalStateException("SingletonFixtureFactory tearDown "
- + "called more often than setUp");
- }
-
- refCount--;
-
- if (refCount == 0) {
- pimpl.tearDown();
- instance = null;
- }
- }
-}
--
Gitblit v1.10.0