Keeping only README in this repository master
authorMartin Stockhammer <martin_s@apache.org>
Sun, 17 Nov 2019 12:44:44 +0000 (13:44 +0100)
committerMartin Stockhammer <martin_s@apache.org>
Sun, 17 Nov 2019 12:44:44 +0000 (13:44 +0100)
README.md
pom.xml [deleted file]
src/main/java/org/apache/archiva/redback/components/apacheds/ApacheDs.java [deleted file]
src/main/java/org/apache/archiva/redback/components/apacheds/DefaultApacheDs.java [deleted file]
src/main/java/org/apache/archiva/redback/components/apacheds/Partition.java [deleted file]
src/site/site.xml [deleted file]
src/test/java/org/apache/archiva/redback/components/apacheds/ApacheDsTest.java [deleted file]
src/test/resources/spring-context.xml [deleted file]

index 4f4961fe4766de710b48f6577fb532289bee4ae2..1f2e7f56d78548624c3d3e237709b89532801313 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
 This project has been moved to 
-org.apache.archiva.components.archiva-components-spring-registry
+org.apache.archiva.components.archiva-components-spring-apacheds
 
 Git:
 https://gitbox.apache.org/repos/asf/archiva-components.git
diff --git a/pom.xml b/pom.xml
deleted file mode 100644 (file)
index 15b1023..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~ or more contributor license agreements.  See the NOTICE file
-  ~ distributed with this work for additional information
-  ~ regarding copyright ownership.  The ASF licenses this file
-  ~ to you under the Apache License, Version 2.0 (the
-  ~ "License"); you may not use this file except in compliance
-  ~ with the License.  You may obtain a copy of the License at
-  ~
-  ~  http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing,
-  ~ software distributed under the License is distributed on an
-  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  ~ KIND, either express or implied.  See the License for the
-  ~ specific language governing permissions and limitations
-  ~ under the License.
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.archiva.redback.components</groupId>
-    <artifactId>redback-components</artifactId>
-    <version>2.5-SNAPSHOT</version>
-  </parent>
-
-  <version>2.2-SNAPSHOT</version>
-  <artifactId>spring-apacheds</artifactId>
-  <name>Spring Apache Directory Server Components</name>
-
-  <properties>
-    <scmBrowseUrl>https://gitbox.apache.org/repos/asf?a=tree;p=archiva-redback-components-spring-apacheds.git</scmBrowseUrl>
-    <apacheds.version>1.5.1</apacheds.version>
-    <site.staging.base>${project.basedir}/../site</site.staging.base>
-  </properties>
-  <scm>
-    <connection>scm:git:http://gitbox.apache.org/repos/asf/archiva-redback-components-spring-apacheds.git</connection>
-    <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/archiva-redback-components-spring-apacheds.git</developerConnection>
-    <url>${scmBrowseUrl}</url>
-  </scm>
-
-
-  <url>${webUrl}/${project.artifactId}</url>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-core</artifactId>
-      <version>${apacheds.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-core-shared</artifactId>
-      <version>${apacheds.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-server-jndi</artifactId>
-      <version>${apacheds.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-bootstrap-partition</artifactId>
-      <version>${apacheds.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-schema-registries</artifactId>
-      <version>${apacheds.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-schema-extras</artifactId>
-      <version>${apacheds.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>javax.inject</groupId>
-      <artifactId>javax.inject</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context-support</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-beans</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-test</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.logging.log4j</groupId>
-      <artifactId>log4j-jcl</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/src/main/java/org/apache/archiva/redback/components/apacheds/ApacheDs.java b/src/main/java/org/apache/archiva/redback/components/apacheds/ApacheDs.java
deleted file mode 100644 (file)
index 3b53c3d..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.archiva.redback.components.apacheds;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.InitialDirContext;
-import java.io.File;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
- *
- */
-public interface ApacheDs
-{
-
-    // ----------------------------------------------------------------------
-    // Configuration
-    // ----------------------------------------------------------------------
-
-    void setBasedir( File basedir );
-
-    void setPort( int port );
-
-    int getPort();
-
-    void setEnableNetworking( boolean enableNetworking );
-
-    void addPartition( String name, String root, Set indexedAttributes, Attributes partitionAttributes )
-        throws NamingException;
-
-    void addPartition( Partition partition )
-        throws NamingException;
-
-    /**
-     * Creates a partition usable for testing and other light usage.
-     *
-     * @param name             The name of the partition. Will be used as the directory name when persisted.
-     * @param domainComponents E.g. "plexus", "codehaus", "org"
-     * @throws NamingException
-     */
-    Partition addSimplePartition( String name, String[] domainComponents )
-        throws NamingException;
-
-    // ----------------------------------------------------------------------
-    // Server control
-    // ----------------------------------------------------------------------
-
-    void startServer()
-        throws Exception;
-
-    void stopServer()
-        throws Exception;
-
-    void sync()
-        throws Exception;
-
-    boolean isStopped();
-
-    // ----------------------------------------------------------------------
-    //
-    // ----------------------------------------------------------------------
-
-    InitialDirContext getAdminContext()
-        throws NamingException;
-
-    InitialDirContext getSystemContext()
-        throws NamingException;
-}
diff --git a/src/main/java/org/apache/archiva/redback/components/apacheds/DefaultApacheDs.java b/src/main/java/org/apache/archiva/redback/components/apacheds/DefaultApacheDs.java
deleted file mode 100644 (file)
index 111ca7a..0000000
+++ /dev/null
@@ -1,338 +0,0 @@
-package org.apache.archiva.redback.components.apacheds;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.directory.server.configuration.MutableServerStartupConfiguration;
-import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
-import org.apache.directory.server.core.configuration.ShutdownConfiguration;
-import org.apache.directory.server.core.configuration.SyncConfiguration;
-import org.apache.directory.server.jndi.ServerContextFactory;
-import org.apache.directory.server.ldap.LdapConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.InitialDirContext;
-import java.io.File;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
- * @author Olivier Lamy
- *
- */
-public class DefaultApacheDs
-    implements ApacheDs
-{
-
-    private Logger logger = LoggerFactory.getLogger( getClass() );
-
-    // ----------------------------------------------------------------------
-    // Configuration
-    // ----------------------------------------------------------------------
-
-    private boolean enableNetworking;
-
-    private File basedir;
-
-    private int port;
-
-    private String password;
-
-    // ----------------------------------------------------------------------
-    //
-    // ----------------------------------------------------------------------
-
-    private boolean stopped;
-
-    private MutableServerStartupConfiguration configuration;
-
-    private Set partitionConfigurations = new HashSet();
-
-    // ----------------------------------------------------------------------
-    // ApacheDs Implementation
-    // ----------------------------------------------------------------------
-
-    public void setBasedir( File basedir )
-    {
-        this.basedir = basedir;
-    }
-
-    public void setEnableNetworking( boolean enableNetworking )
-    {
-        this.enableNetworking = enableNetworking;
-    }
-
-    public InitialDirContext getAdminContext()
-        throws NamingException
-    {
-        assertIsStarted();
-
-        Hashtable environment = new Hashtable( configuration.toJndiEnvironment() );
-        environment.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
-        environment.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
-        environment.put( Context.SECURITY_CREDENTIALS, password );
-        environment.put( Context.SECURITY_AUTHENTICATION, "simple" );
-//        environment.put( Context.PROVIDER_URL, "dc=hauskeeper,dc=codehaus,dc=org" );
-        return new InitialDirContext( environment );
-    }
-
-    public InitialDirContext getSystemContext()
-        throws NamingException
-    {
-        assertIsStarted();
-
-        Hashtable environment = new Hashtable( configuration.toJndiEnvironment() );
-        environment.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
-        environment.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
-        environment.put( Context.SECURITY_CREDENTIALS, password );
-        environment.put( Context.SECURITY_AUTHENTICATION, "simple" );
-        environment.put( Context.PROVIDER_URL, "ou=system" );
-        return new InitialDirContext( environment );
-    }
-
-    public void addPartition( String name, String root, Set indexedAttributes, Attributes partitionAttributes )
-        throws NamingException
-    {
-        MutablePartitionConfiguration configuration = new MutablePartitionConfiguration();
-        configuration.setId( name );
-        configuration.setSuffix( root );
-        configuration.setIndexedAttributes( indexedAttributes );
-        configuration.setContextEntry( partitionAttributes );
-        partitionConfigurations.add( configuration );
-    }
-
-    public void addPartition( Partition partition )
-        throws NamingException
-    {
-        MutablePartitionConfiguration configuration = new MutablePartitionConfiguration();
-
-        configuration.setId( partition.getName() );
-        configuration.setSuffix( partition.getSuffix() );
-        configuration.setIndexedAttributes( partition.getIndexedAttributes() );
-        configuration.setContextEntry( partition.getContextAttributes() );
-        //configuration.setSynchOnWrite( true );
-        configuration.setCacheSize( 1 );
-        //configuration.setOptimizerEnabled( false );
-        partitionConfigurations.add( configuration );
-    }
-
-    public Partition addSimplePartition( String name, String[] domainComponents )
-        throws NamingException
-    {
-        if ( domainComponents.length == 0 )
-        {
-            throw new NamingException( "Illegal argument, there has to be at least one domain component." );
-        }
-
-        StringBuilder suffix = new StringBuilder();
-
-        for ( int i = 0; i < domainComponents.length; i++ )
-        {
-            String dc = domainComponents[i];
-
-            suffix.append( "dc=" ).append( dc );
-
-            if ( i != domainComponents.length - 1 )
-            {
-                suffix.append( "," );
-            }
-        }
-
-        // ----------------------------------------------------------------------
-        // The root entry of the partition
-        // ----------------------------------------------------------------------
-
-        Attributes attributes = new BasicAttributes( true );
-        attributes.put( "dc", domainComponents[0] );
-        Attribute objectClass = new BasicAttribute( "objectClass" );
-        objectClass.add( "top" );
-        objectClass.add( "domain" );
-        objectClass.add( "extensibleObject" );
-        attributes.put( objectClass );
-
-        Partition partition = new Partition();
-        partition.setName( name );
-        partition.setSuffix( suffix.toString() );
-        partition.setContextAttributes( attributes );
-        HashSet set = new HashSet();
-        set.add( "uid" );
-        set.add( "cn" );
-        partition.setIndexedAttributes( set );
-
-        addPartition( partition );
-
-        return partition;
-    }
-
-    public void startServer()
-        throws Exception
-    {
-        logger.info( "Starting Apache Directory Server server." );
-
-        logger.info( "ApacheDS basedir: {}", basedir.getAbsolutePath() );
-
-        File logs = new File( basedir, "logs" );
-
-        if ( !logs.exists() && !logs.mkdirs() )
-        {
-            throw new Exception( "Could not create logs directory: " + logs.getAbsolutePath() );
-        }
-
-        Properties environment = new Properties();
-        environment.setProperty( "java.naming.security.authentication", "simple" );
-        environment.setProperty( "java.naming.security.principal", "uid=admin,ou=system" );
-        if ( password != null )
-        {
-            environment.setProperty( "java.naming.security.credentials", password );
-        }
-        MutableServerStartupConfiguration configuration = new MutableServerStartupConfiguration();
-        configuration.setWorkingDirectory( basedir );
-        configuration.setAllowAnonymousAccess( true );
-        //configuration.setEnableNtp( false );
-        //configuration.setEnableKerberos( false );
-        //configuration.setEnableChangePassword( false );
-        LdapConfiguration config = new LdapConfiguration();
-        config.setIpPort( port );
-        configuration.setLdapConfiguration( config );
-        configuration.setEnableNetworking( enableNetworking );
-        configuration.setSynchPeriodMillis( 100 );
-
-        if ( configuration.getPartitionConfigurations() == null || ( configuration.getPartitionConfigurations() != null
-            && configuration.getPartitionConfigurations().isEmpty() ) )
-        {
-            configuration.setPartitionConfigurations( partitionConfigurations );
-        }
-        Properties env = new Properties();
-        env.setProperty( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
-        if ( password != null )
-        {
-            env.setProperty( Context.SECURITY_CREDENTIALS, password );
-        }
-        env.setProperty( Context.SECURITY_AUTHENTICATION, "simple" );
-        env.setProperty( Context.PROVIDER_URL, "ou=system" );
-        env.setProperty( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
-        env.putAll( configuration.toJndiEnvironment() );
-        InitialDirContext context = new InitialDirContext( env );
-
-        //Attributes inetAttributes = context.getAttributes( "cn=inetorgperson,ou=schema" );
-
-        //inetAttributes.remove( "m-disabled" );
-
-        this.configuration = configuration;
-
-        logger.info( "Started Apache Directory Server server." );
-
-        stopped = false;
-    }
-
-    public void stopServer()
-        throws Exception
-    {
-        if ( stopped )
-        {
-            throw new Exception( "Already stopped." );
-        }
-
-        logger.info( "Stopping Apache Directory Server server." );
-
-        sync();
-
-        stopped = true;
-
-        Hashtable env = new Hashtable();
-        env.putAll( new ShutdownConfiguration().toJndiEnvironment() );
-        new InitialDirContext( env );
-
-        logger.info( "Apache Directory Server server stopped." );
-    }
-
-    public boolean isStopped()
-    {
-        return stopped;
-    }
-
-    public void sync()
-        throws Exception
-    {
-        logger.info( "Sync'ing Apache Directory Server server." );
-
-        Hashtable env = new Hashtable();
-        env.putAll( new SyncConfiguration().toJndiEnvironment() );
-        new InitialDirContext( env );
-    }
-
-
-    public void stop()
-    {
-        try
-        {
-            if ( !stopped )
-            {
-                stopServer();
-            }
-        }
-        catch ( Exception e )
-        {
-            throw new RuntimeException( "Error while stopping Apache Directory Server server.", e );
-        }
-    }
-
-    // ----------------------------------------------------------------------
-    //
-    // ----------------------------------------------------------------------
-
-    private void assertIsStarted()
-        throws NamingException
-    {
-        if ( configuration == null )
-        {
-            throw new NamingException( "The server has to be started before used." );
-        }
-    }
-
-    public int getPort()
-    {
-        return port;
-    }
-
-    public void setPort( int port )
-    {
-        this.port = port;
-    }
-
-    public String getPassword()
-    {
-        return password;
-    }
-
-    public void setPassword( String password )
-    {
-        this.password = password;
-    }
-}
diff --git a/src/main/java/org/apache/archiva/redback/components/apacheds/Partition.java b/src/main/java/org/apache/archiva/redback/components/apacheds/Partition.java
deleted file mode 100644 (file)
index d46a630..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.apache.archiva.redback.components.apacheds;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttributes;
-import java.util.Set;
-import java.util.HashSet;
-
-/**
- * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
- *
- */
-public class Partition
-{
-    private String name;
-
-    private String suffix;
-
-    private Set indexedAttributes;
-
-    private Attributes contextAttributes;
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public String getSuffix()
-    {
-        return suffix;
-    }
-
-    public void setSuffix( String suffix )
-    {
-        this.suffix = suffix;
-    }
-
-    public Set getIndexedAttributes()
-    {
-        if ( indexedAttributes == null )
-        {
-            indexedAttributes = new HashSet();
-        }
-
-        return indexedAttributes;
-    }
-
-    public void setIndexedAttributes( Set indexedAttributes )
-    {
-        this.indexedAttributes = indexedAttributes;
-    }
-
-    public Attributes getContextAttributes()
-    {
-        if ( contextAttributes == null )
-        {
-            contextAttributes = new BasicAttributes();
-        }
-
-        return contextAttributes;
-    }
-
-    public void setContextAttributes( Attributes contextAttributes )
-    {
-        this.contextAttributes = contextAttributes;
-    }
-}
diff --git a/src/site/site.xml b/src/site/site.xml
deleted file mode 100644 (file)
index 32aea8f..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~ or more contributor license agreements.  See the NOTICE file
-  ~ distributed with this work for additional information
-  ~ regarding copyright ownership.  The ASF licenses this file
-  ~ to you under the Apache License, Version 2.0 (the
-  ~ "License"); you may not use this file except in compliance
-  ~ with the License.  You may obtain a copy of the License at
-  ~
-  ~ http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing,
-  ~ software distributed under the License is distributed on an
-  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  ~ KIND, either express or implied.  See the License for the
-  ~ specific language governing permissions and limitations
-  ~ under the License.
-  -->
-
-<project name="Spring Apacheds Component" >
-
-  <publishDate format="yyyy-MM-dd" position="none" />
-
-  <body>
-    <menu ref="modules" />
-    <menu ref="reports" />
-    <menu ref="ASF" />
-    <breadcrumbs>
-      <item name="Redback Components" href="../index.html" />
-      <item name="Spring ApacheDs" href="index.html" />
-    </breadcrumbs>
-  </body>
-</project>
diff --git a/src/test/java/org/apache/archiva/redback/components/apacheds/ApacheDsTest.java b/src/test/java/org/apache/archiva/redback/components/apacheds/ApacheDsTest.java
deleted file mode 100644 (file)
index 7293b87..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-package org.apache.archiva.redback.components.apacheds;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
-import org.apache.archiva.redback.components.apacheds.ApacheDs;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.inject.Inject;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import java.io.File;
-
-/**
- * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
- * @author Olivier Lamy
- *
- */
-
-@RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
-public class ApacheDsTest
-    extends TestCase
-{
-    private String suffix = "dc=plexus,dc=codehaus,dc=org";
-
-    @Inject
-    private ApacheDs apacheDs;
-
-    private Logger logger = LoggerFactory.getLogger( getClass() );
-
-    protected void setUp()
-        throws Exception
-    {
-        super.setUp();
-
-
-                
-    }
-
-    @Test
-    public void testBasic()
-        throws Exception
-    {
-
-        apacheDs.setBasedir( new File( "./target/plexus-home" ) );
-        
-        apacheDs.addSimplePartition( "test", new String[]{"plexus", "codehaus", "org"} ).getSuffix();
-        apacheDs.startServer();
-
-        InitialDirContext context = apacheDs.getAdminContext();
-
-        String cn = "trygvis";
-        createUser( context, cn, createDn( cn ) );
-        assertExist( context, createDn( cn ), "cn", cn );
-
-        cn = "bolla";
-        createUser( context, cn, createDn( cn ) );
-        assertExist( context, createDn( cn ), "cn", cn );
-
-        SearchControls ctls = new SearchControls();
-
-        ctls.setDerefLinkFlag( true );
-        ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-        ctls.setReturningAttributes( new String[] { "*" } );
-
-        String filter = "(&(objectClass=inetOrgPerson)(cn=trygvis))";        
-        
-        NamingEnumeration<SearchResult> results = context.search( suffix, filter, ctls );
-       
-        assertTrue( "a result should have been returned", results.hasMoreElements() );
-        
-        SearchResult result = results.nextElement();
-        
-        Attributes attrs = result.getAttributes();
-        
-        logger.info("Attributes {}", AttributeUtils.toString( attrs ) );
-        
-        assertFalse( "should only have one result returned", results.hasMoreElements() );
-        
-        apacheDs.stopServer();
-
-
-
-        // ----------------------------------------------------------------------
-        // Start it again
-        // ----------------------------------------------------------------------
-
-        apacheDs.startServer();
-
-        context = apacheDs.getAdminContext();
-        
-        assertExist( context, createDn( "trygvis" ), "cn", "trygvis" );
-        context.unbind( createDn( "trygvis" ) );
-        assertExist( context, createDn( "bolla" ), "cn", "bolla" );
-        context.unbind( createDn( "bolla" ) );
-
-        apacheDs.stopServer();
-    }
-
-    private void createUser( DirContext context, String cn, String dn )
-        throws NamingException
-    {
-        Attributes attributes = new BasicAttributes();
-        BasicAttribute objectClass = new BasicAttribute( "objectClass" );
-        objectClass.add( "top" );
-        objectClass.add( "inetOrgPerson" );
-        attributes.put( objectClass );
-        attributes.put( "cn", cn );
-        attributes.put( "sn", cn );
-        context.createSubcontext( dn, attributes );
-    }
-
-    private String createDn( String cn )
-    {
-        return "cn=" + cn + "," + suffix;
-    }
-
-    private void assertExist( DirContext context, String dn, String attribute, String value )
-        throws NamingException
-    {
-       SearchControls ctls = new SearchControls();
-
-        ctls.setDerefLinkFlag( true );
-        ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-        ctls.setReturningAttributes( new String[] { "*" } );
-               
-       BasicAttributes matchingAttributes = new BasicAttributes();
-       matchingAttributes.put( attribute, value );
-       
-       NamingEnumeration<SearchResult> results = context.search( suffix, matchingAttributes );
-       //NamingEnumeration<SearchResult> results = context.search( suffix, "(" + attribute + "=" + value + ")", ctls  );
-
-        assertTrue( results.hasMoreElements() );       
-       SearchResult result = results.nextElement();            
-       Attributes attrs = result.getAttributes();      
-       Attribute testAttr = attrs.get( attribute );            
-       assertEquals( value, testAttr.get() );
-      
-    }
-}
diff --git a/src/test/resources/spring-context.xml b/src/test/resources/spring-context.xml
deleted file mode 100755 (executable)
index 8881f24..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~ or more contributor license agreements.  See the NOTICE file
-  ~ distributed with this work for additional information
-  ~ regarding copyright ownership.  The ASF licenses this file
-  ~ to you under the Apache License, Version 2.0 (the
-  ~ "License"); you may not use this file except in compliance
-  ~ with the License.  You may obtain a copy of the License at
-  ~
-  ~   http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing,
-  ~ software distributed under the License is distributed on an
-  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  ~ KIND, either express or implied.  See the License for the
-  ~ specific language governing permissions and limitations
-  ~ under the License.
-  -->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-  <bean name="apacheDS" class="org.apache.archiva.redback.components.apacheds.DefaultApacheDs">
-    <property name="basedir" value="./target/apacheds"/>
-    <property name="port" value="10390"/>
-    <property name="enableNetworking" value="true"/>
-    <property name="password" value="secret"/>
-  </bean>
-</beans>
\ No newline at end of file