Not sure this helps much, but my team works around this for our integration
test by using aop.  Specifically:

<aspectj>
  <aspects>
    <aspect name=" com.pastdev.apacheds.server.GetUniqueResourceReplacer" />
  </aspects>
</aspectj>


And this implementation

/**
 * An aspect workaround for <a
 * href="https://issues.apache.org/jira/browse/DIRSERVER-1606";
 * >DIRSERVER-1606</a>
 *
 * @author LTHEISEN
 */
@Aspect
public class GetUniqueResourceReplacer {
    private static final Logger log = LoggerFactory.getLogger(
GetUniqueResourceReplacer.class );

    @Pointcut( "execution(*
org.apache.directory.api.ldap.schema.extractor.impl.DefaultSchemaLdifExtractor.getUniqueResource(String,String))
&&" +
            "args(resourceName,resourceDescription)" )
    private void getUniqueResourceReplacer( String resourceName, String
resourceDescription ) {
    }

    @Around(
"com.pastdev.apacheds.server.GetUniqueResourceReplacer.getUniqueResourceReplacer(resourceName,resourceDescription)"
)
    public URL getFirstMatchingResource( String resourceName, String
resourceDescription ) throws IOException {
        Enumeration<URL> resources =
DefaultSchemaLdifExtractor.class.getClassLoader().getResources(
resourceName );
        if ( !resources.hasMoreElements() ) {
            throw new UniqueResourceException( resourceName,
resourceDescription );
        }
        URL result = resources.nextElement();
        if ( resources.hasMoreElements() ) {
            log.debug( "found more than one copy of " + resourceName + "
using first one" );
        }
        return result;
    }
}

As stated in the comment, this issue relates to
https://issues.apache.org/jira/browse/DIRSERVER-1606

Maybe that will work for you too.

On Wed, Dec 12, 2018 at 8:58 AM Shawn McKinney <[email protected]> wrote:

>
> > On Dec 12, 2018, at 5:08 AM, Emmanuel Lécharny <[email protected]>
> wrote:
> >
> > if you include ApacheDS, it will implicitely include LDAP API, so
> including ldap-api-all will be a duplicate, AFAIR.
>
> Here, fortress core apacheDS depends are:  <scope>test</scope>, and of
> course we have compile-time dependency on the api.
>
> >
> > On Dec 12, 2018, at 5:08 AM, Emmanuel Lécharny <[email protected]>
> wrote:
> >
> > I'll have  a closer look later today. What command are you executing
> that I can run to get the same result ?
>
> Simply executed the test class inside IDE, but it could command-line:
>
> $ mvn -Dtest=FortressJUnitApachedsTest test
>
> Thanks,
> —Shawn
>
>

Reply via email to