| | |
| | | * the classes found directly under the package com.sun.opends.sdk.tools. |
| | | */ |
| | | |
| | | @Test(groups = { "precommit", "tools", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "tools", "sdk" }) |
| | | public abstract class ToolsTestCase extends OpenDJTestCase |
| | | { |
| | | } |
| | |
| | | * classes found directly under the package com.sun.opends.sdk.ldap. |
| | | */ |
| | | |
| | | @Test(groups = { "precommit", "ldap", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "ldap", "sdk" }) |
| | | public abstract class LDAPTestCase extends OpenDJTestCase |
| | | { |
| | | } |
| | |
| | | * An abstract class that all util unit tests should extend. Util represents the |
| | | * classes found directly under the package org.opends.sdk.util. |
| | | */ |
| | | @Test(groups = { "precommit", "util", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "util", "sdk" }) |
| | | public abstract class UtilTestCase extends OpenDJTestCase |
| | | { |
| | | } |
| | |
| | | import java.util.Arrays; |
| | | |
| | | import org.testng.Assert; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | |
| | |
| | | */ |
| | | public abstract class ByteSequenceTestCase extends SdkTestCase |
| | | { |
| | | /** |
| | | * ByteSequence data provider that gets the ByteSequence implementation from |
| | | * the abstract method. |
| | | * |
| | | * @return The array of ByteStrings and the bytes it should contain. |
| | | */ |
| | | @DataProvider(name = "byteSequenceProvider") |
| | | public Object[][] concreteByteSequenceProvider() throws Exception |
| | | { |
| | | return byteSequenceProvider(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Test(dataProvider = "byteSequenceProvider") |
| | | public void testByteAt(final ByteSequence bs, final byte[] ba) |
| | | { |
| | |
| | | Assert.assertTrue(bs.toString().equals(str)); |
| | | } |
| | | |
| | | |
| | | |
| | | protected abstract Object[][] byteSequenceProvider() throws Exception; |
| | | |
| | | } |
| | |
| | | * |
| | | * @return The array of ByteStrings and the bytes it should contain. |
| | | */ |
| | | @Override |
| | | @DataProvider(name = "byteSequenceProvider") |
| | | public Object[][] byteSequenceProvider() throws Exception |
| | | { |
| | |
| | | * |
| | | * @return The array of ByteStrings and the bytes it should contain. |
| | | */ |
| | | @Override |
| | | @DataProvider(name = "byteSequenceProvider") |
| | | public Object[][] byteSequenceProvider() throws Exception |
| | | { |
| | |
| | | * the classes found directly under the package org.opends.sdk. |
| | | */ |
| | | |
| | | @Test(groups = { "precommit", "types", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "types", "sdk" }) |
| | | public abstract class SdkTestCase extends OpenDJTestCase |
| | | { |
| | | } |
| | |
| | | * the classes found directly under the package org.opends.sdk. |
| | | */ |
| | | |
| | | @Test(groups = { "precommit", "types", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "types", "sdk" }) |
| | | public class TypesTestCase extends SdkTestCase |
| | | { |
| | | /** |
| | |
| | | /** |
| | | * An abstract base class for all ASN1Reader test cases. |
| | | */ |
| | | @Test(groups = { "precommit", "asn1", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "asn1", "sdk" }) |
| | | public abstract class ASN1ReaderTestCase extends OpenDJTestCase |
| | | { |
| | | |
| | |
| | | /** |
| | | * An abstract base class for all ASN1Writer test cases. |
| | | */ |
| | | @Test(groups = { "precommit", "asn1", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "asn1", "sdk" }) |
| | | public abstract class ASN1WriterTestCase extends OpenDJTestCase |
| | | { |
| | | |
| | |
| | | * org.opends.sdk.controls. |
| | | */ |
| | | |
| | | @Test(groups = { "precommit", "controls", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "controls", "sdk" }) |
| | | public abstract class ControlsTestCase extends OpenDJTestCase |
| | | { |
| | | /** |
| | |
| | | * classes found directly under the package org.opends.sdk.ldif. |
| | | */ |
| | | |
| | | @Test(groups = { "precommit", "types", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "types", "sdk" }) |
| | | public abstract class LDIFTestCase extends OpenDJTestCase |
| | | { |
| | | } |
| | |
| | | * org.opends.sdk.requests. |
| | | */ |
| | | |
| | | @Test(groups = { "precommit", "requests", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "requests", "sdk" }) |
| | | public abstract class RequestsTestCase extends OpenDJTestCase |
| | | { |
| | | } |
| | |
| | | * org.opends.sdk.responses. |
| | | */ |
| | | |
| | | @Test(groups = { "precommit", "responses", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "responses", "sdk" }) |
| | | public abstract class ResponsesTestCase extends OpenDJTestCase |
| | | { |
| | | } |
| | |
| | | /** |
| | | * An abstract class that all schema unit test should extend. |
| | | */ |
| | | @Test(groups = { "precommit", "schema", "sdk" }, sequential = true) |
| | | @Test(groups = { "precommit", "schema", "sdk" }) |
| | | public abstract class SchemaTestCase extends OpenDJTestCase |
| | | { |
| | | } |
| | |
| | | * This class adds the ability to print error messages and automatically have |
| | | * them include the class name. |
| | | */ |
| | | @Test(sequential = true) |
| | | @Test |
| | | public abstract class OpenDJTestCase |
| | | { |
| | | |
| | |
| | | private void enforceMethodHasAnnotation(final ITestResult tr) |
| | | { |
| | | // Only warn once per method. |
| | | final Method testMethod = tr.getMethod().getMethod(); |
| | | final Method testMethod = tr.getMethod().getConstructorOrMethod() |
| | | .getMethod(); |
| | | if (_checkedForAnnotation.contains(testMethod)) |
| | | { |
| | | return; |
| | |
| | | final String errorMessage = "The test class " |
| | | + testClass.getName() |
| | | + " does not have a @Test annotation. " |
| | | + "All test classes must have a @Test annotation, and this annotation must have " |
| | | + "sequential=true set to ensure that tests for a single class are run together."; |
| | | System.err.println("\n\nERROR: " + errorMessage + "\n\n"); |
| | | throw new RuntimeException(errorMessage); |
| | | } |
| | | |
| | | final Test testAnnotation = classWithTestAnnotation |
| | | .getAnnotation(Test.class); |
| | | if (!testAnnotation.sequential()) |
| | | { |
| | | // Give an error message that is as specific as possible. |
| | | final String errorMessage = "The @Test annotation for class " |
| | | + testClass.getName() |
| | | + (classWithTestAnnotation.equals(testClass) ? " " |
| | | : (", which is declared by class " |
| | | + classWithTestAnnotation.getName() + ", ")) |
| | | + "must include sequential=true to ensure that tests for a single class are run together."; |
| | | + "All test classes must have a @Test annotation"; |
| | | System.err.println("\n\nERROR: " + errorMessage + "\n\n"); |
| | | throw new RuntimeException(errorMessage); |
| | | } |
| | |
| | | { |
| | | System.err.print(threadStacksToString()); |
| | | } |
| | | |
| | | if (_classesWithTestsRunInterleaved.size() > 0) |
| | | { |
| | | System.err |
| | | .println("WARNING: Some of the test methods for multiple classes " |
| | | + "were run out of order (i.e. interleaved with other classes). Either " |
| | | + "a class doesn't have the sequential=true annotation, which should " |
| | | + "have been reported already or there has been a regression with TestNG."); |
| | | } |
| | | } |
| | | } |