| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | * @param className The class name. |
| | | * @param settings The trace settings for the class. |
| | | */ |
| | | private synchronized final void setClassSettings(String className, |
| | | TraceSettings settings) |
| | | private final synchronized void setClassSettings(String className, TraceSettings settings) |
| | | { |
| | | if (classTraceSettings == null) |
| | | { |
| | |
| | | * @param methodName The method name. |
| | | * @param settings The trace settings for the method. |
| | | */ |
| | | private synchronized final void setMethodSettings(String className, |
| | | private final synchronized void setMethodSettings(String className, |
| | | String methodName, TraceSettings settings) |
| | | { |
| | | if (methodTraceSettings == null) { |
| | |
| | | |
| | | |
| | | // Construct a dummy path. |
| | | private synchronized static <C extends ConfigurationClient, S extends Configuration> |
| | | private static synchronized <C extends ConfigurationClient, S extends Configuration> |
| | | ManagedObjectPath<C, S> getPath(AbstractManagedObjectDefinition<C, S> d) { |
| | | if (!isProfileRegistered) { |
| | | LDAPProfile.Wrapper profile = new LDAPProfile.Wrapper() { |
| | |
| | | |
| | | private static boolean initialized; |
| | | |
| | | static public void initServer() |
| | | public static void initServer() |
| | | throws IOException, ApplicationException, InterruptedException { |
| | | File qsServerRoot = getQuickSetupTestServerRootDir(); |
| | | if (!initialized) { |
| | |
| | | } |
| | | } |
| | | |
| | | static public Installation getInstallation() { |
| | | public static Installation getInstallation() { |
| | | return new Installation(getQuickSetupTestServerRootDir(),getQuickSetupTestServerRootDir()); |
| | | } |
| | | |
| | | static private void setupServer() throws IOException, InterruptedException { |
| | | private static void setupServer() throws IOException, InterruptedException { |
| | | int[] ports = TestCaseUtils.findFreePorts(2); |
| | | ldapPort = ports[0]; |
| | | jmxPort = ports[1]; |
| | | |
| | | List<String> args = new ArrayList<String>(); |
| | | File root = getQuickSetupTestServerRootDir(); |
| | | if (OperatingSystem.isUnixBased()) { |
| | | args.add(new File(root, "setup").getPath()); |
| | | } else { |
| | | args.add(new File(root, "setup.bat").getPath()); |
| | | } |
| | | String filename = OperatingSystem.isUnixBased() ? "setup" : "setup.bat"; |
| | | args.add(new File(root, filename).getPath()); |
| | | args.add("--cli"); |
| | | args.add("-n"); |
| | | args.add("-p"); |
| | |
| | | } |
| | | } |
| | | |
| | | static public void stopServer() throws ApplicationException { |
| | | public static void stopServer() throws ApplicationException { |
| | | ServerController controller = new ServerController(getInstallation()); |
| | | controller.stopServer(); |
| | | } |
| | | |
| | | static public File getInstallPackageFile() throws FileNotFoundException { |
| | | public static File getInstallPackageFile() throws FileNotFoundException { |
| | | File installPackageFile = null; |
| | | String buildRoot = System.getProperty(PROPERTY_BUILD_ROOT); |
| | | File buildDir = new File(buildRoot, "build"); |
| | |
| | | return installPackageFile; |
| | | } |
| | | |
| | | static public File getQuickSetupTestWorkspace() { |
| | | public static File getQuickSetupTestWorkspace() { |
| | | 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"); |
| | | } |
| | | |
| | | static public File getQuickSetupTestServerRootDir() { |
| | | public static File getQuickSetupTestServerRootDir() { |
| | | return new File(getQuickSetupTestWorkspace(), "OpenDS"); |
| | | } |
| | | } |
| | |
| | | * @throws Exception |
| | | * If an unexpected error occurred. |
| | | */ |
| | | public synchronized static void setUp() throws Exception { |
| | | public static synchronized void setUp() throws Exception { |
| | | if (TEST_PARENT_OCD == null) { |
| | | String ocd = "( 1.3.6.1.4.1.26027.1.2.4455114401 " |
| | | + "NAME 'ds-cfg-test-parent-dummy' " |
| | |
| | | |
| | | |
| | | // Construct a dummy path. |
| | | private synchronized static <C extends ConfigurationClient, S extends Configuration> |
| | | private static synchronized <C extends ConfigurationClient, S extends Configuration> |
| | | ManagedObjectPath<C, S> getPath(AbstractManagedObjectDefinition<C, S> d) { |
| | | if (!isProfileRegistered) { |
| | | LDAPProfile.Wrapper profile = new LDAPProfile.Wrapper() { |
| | |
| | | "ldap://kansashost/OU=People,O=Kansas,C=US"; |
| | | //GLOBAL ACIs |
| | | |
| | | protected final static String G_READ_ACI = |
| | | protected static final String G_READ_ACI = |
| | | "(targetattr!=\"userPassword||authPassword\")" + |
| | | "(version 3.0; acl \"Anonymous read access\";" + |
| | | "allow (read,search,compare) userdn=\"ldap:///anyone\";)"; |
| | | |
| | | protected final static String G_SELF_MOD = |
| | | protected static final String G_SELF_MOD = |
| | | "(targetattr=\"*\")(version 3.0; acl \"Self entry modification\";" + |
| | | "allow (write) userdn=\"ldap:///self\";)"; |
| | | |
| | | protected final static String G_SCHEMA = |
| | | protected static final String G_SCHEMA = |
| | | "(target=\"ldap:///cn=schema\")(targetscope=\"base\")" + |
| | | "(targetattr=\"attributeTypes||dITContentRules||dITStructureRules||" + |
| | | "ldapSyntaxes||matchingRules||matchingRuleUse||nameForms||" + |
| | |
| | | "(version 3.0; acl \"User-Visible Schema Operational Attributes\";" + |
| | | "allow (read,search,compare) userdn=\"ldap:///anyone\";)"; |
| | | |
| | | protected final static String G_DSE = |
| | | protected static final String G_DSE = |
| | | "(target=\"ldap:///\")(targetscope=\"base\")" + |
| | | "(targetattr=\"namingContexts||supportedAuthPasswordSchemes||" + |
| | | "supportedControl||supportedExtension||supportedFeatures||" + |
| | |
| | | "(version 3.0; acl \"User-Visible Root DSE Operational Attributes\"; " + |
| | | "allow (read,search,compare) userdn=\"ldap:///anyone\";)"; |
| | | |
| | | protected final static String G_USER_OPS = |
| | | protected static final String G_USER_OPS = |
| | | "(targetattr=\"createTimestamp||creatorsName||modifiersName||" + |
| | | "modifyTimestamp||entryDN||entryUUID||subschemaSubentry\")" + |
| | | "(version 3.0; acl \"User-Visible Operational Attributes\"; " + |
| | | "allow (read,search,compare) userdn=\"ldap:///anyone\";)"; |
| | | |
| | | protected final static String G_CONTROL = |
| | | protected static final String G_CONTROL = |
| | | "(targetcontrol = \"*\")" + |
| | | "(version 3.0; acl \"Anonymous control access\"; " + |
| | | "allow (read) userdn=\"ldap:///anyone\";)"; |
| | | |
| | | protected final static String E_EXTEND_OP = |
| | | protected static final String E_EXTEND_OP = |
| | | "(extop = \"*\")" + |
| | | "(version 3.0; acl \"Anonymous extend op access\"; " + |
| | | "allow (read) userdn=\"ldap:///anyone\";)"; |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014 ForgeRock AS. |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | @SuppressWarnings("javadoc") |
| | | public class LoggingCategoryNamesTest extends DirectoryServerTestCase |
| | | { |
| | | private final static String CORE_PACKAGE = DirectoryServer.class.getPackage().getName(); |
| | | private final static String CORE_PACKAGE_NAME = "CORE"; |
| | | private static final String CORE_PACKAGE = DirectoryServer.class.getPackage().getName(); |
| | | private static final String CORE_PACKAGE_NAME = "CORE"; |
| | | |
| | | @DataProvider |
| | | public Object[][] matchingNames() |
| | |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | private final static class Decoder |
| | | private static final class Decoder |
| | | implements ControlDecoder<DelayRequestControl> |
| | | { |
| | | /** |
| | |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | private final static class Decoder |
| | | private static final class Decoder |
| | | implements ControlDecoder<DisconnectClientControl> |
| | | { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DisconnectClientControl decode(boolean isCritical, |
| | | ByteString value) |
| | | throws DirectoryException |
| | | public DisconnectClientControl decode(boolean isCritical, ByteString value) throws DirectoryException |
| | | { |
| | | return new DisconnectClientControl(isCritical, value.toString()); |
| | | } |
| | |
| | | /** |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | private final static class Decoder |
| | | private static final class Decoder |
| | | implements ControlDecoder<ShortCircuitRequestControl> |
| | | { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ShortCircuitRequestControl decode(boolean isCritical, |
| | | ByteString value) |
| | | public ShortCircuitRequestControl decode(boolean isCritical, ByteString value) |
| | | throws DirectoryException |
| | | { |
| | | ASN1Reader reader = ASN1.getReader(value); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | * @param baseDN The baseDN for which we want the generationId |
| | | * @return The value of the generationId. |
| | | */ |
| | | static protected long getGenerationId(DN baseDN) |
| | | protected static long getGenerationId(DN baseDN) |
| | | { |
| | | // This is the value of the generationId computed by the server when the |
| | | // test suffix (o=test) has only the root entry created. |
| | | long genId = TEST_DN_WITH_ROOT_ENTRY_GENID; |
| | | try |
| | | { |
| | | LDAPReplicationDomain replDomain = LDAPReplicationDomain.retrievesReplicationDomain(baseDN); |
| | | genId = replDomain.getGenerationID(); |
| | | return replDomain.getGenerationID(); |
| | | } |
| | | catch(Exception e) { |
| | | logger.traceException(e); |
| | | } |
| | | return genId; |
| | | // This is the value of the generationId computed by the server when the |
| | | // test suffix (o=test) has only the root entry created. |
| | | return TEST_DN_WITH_ROOT_ENTRY_GENID; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | + "userPassword: password\n" + "initials: AA\n"; |
| | | } |
| | | |
| | | static private ReplicationMsg createAddMsg(CSN csn) throws Exception |
| | | private static ReplicationMsg createAddMsg(CSN csn) throws Exception |
| | | { |
| | | Entry personWithUUIDEntry = null; |
| | | String user1entryUUID; |
| | |
| | | private DN user5; |
| | | private DN user6; |
| | | |
| | | private final static String TIME_ATTR = "test-time"; |
| | | private final static String DATE_ATTR = "test-date"; |
| | | private static final String TIME_ATTR = "test-time"; |
| | | private static final String DATE_ATTR = "test-date"; |
| | | |
| | | |
| | | /** |
| | |
| | | @SuppressWarnings("javadoc") |
| | | public class UpgradeTestCase extends ToolsTestCase |
| | | { |
| | | private final static String configFilePath = DirectoryServer.getInstanceRoot() |
| | | private static final String configFilePath = DirectoryServer.getInstanceRoot() |
| | | + File.separator + "config" + File.separator + "config.ldif"; |
| | | |
| | | /** |
| | |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 Manuel Gaupp |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | //////////////////////////////////////////////////////////////////////////// |
| | | |
| | | |
| | | private static final String makeSimpleLdif(String givenname, String sn) { |
| | | private static String makeSimpleLdif(String givenname, String sn) { |
| | | String cn = givenname + " " + sn; |
| | | return TestCaseUtils.makeLdif( |
| | | "dn: cn=" + cn + ",dc=example,dc=com", |