MockLDAPConnection.java revision bccd35904bb6c244e7eae5b7ddb28e5c295e856b
/*
* 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 legal-notices/CDDLv1_0.txt
* 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 legal-notices/CDDLv1_0.txt.
* 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
*
*
* Copyright 2007-2008 Sun Microsystems, Inc.
*/
/**
* A mock LDAP connection which fakes up search results based on some LDIF
* content. Implementations should override the modify operations in order to
* get provide the correct fake behavior.
*/
public class MockLDAPConnection extends LDAPConnection {
/**
* A mock entry.
*/
private static final class MockEntry {
}
return entry;
}
return children;
}
return dn;
}
}
}
/** All the entries. */
/** The single root entry. */
/**
* Create a mock connection.
*/
public MockLDAPConnection() {
}
/**
* {@inheritDoc}
*/
throw new UnsupportedOperationException("createEntry");
}
/**
* {@inheritDoc}
*/
throw new UnsupportedOperationException("deleteSubtree");
}
/**
* {@inheritDoc}
*/
}
/**
* Imports the provided LDIF into this mock connection.
*
* @param lines
* The LDIF.
*/
try {
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* {@inheritDoc}
*/
throw ErrorResultException.newErrorResult(ResultCode.NO_SUCH_OBJECT, "Could not find entry: " + dn);
} else {
}
return names;
}
}
/**
* {@inheritDoc}
*/
throw new UnsupportedOperationException("modifyEntry");
}
/**
* {@inheritDoc}
*/
return new SearchResultEntry() {
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
return false;
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
}
throw new RuntimeException("not implemented");
}
throws DecodeException {
throw new RuntimeException("not implemented");
}
public int getAttributeCount() {
}
}
}
}
}
}
}
public boolean containsAttribute(Attribute attribute, Collection<? super ByteString> missingValues) {
throw new RuntimeException("not implemented");
}
public SearchResultEntry clearAttributes() {
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
throw new RuntimeException("not implemented");
}
};
}
/**
* Asserts whether the provided attribute contains exactly the set of values
* contained in the provided collection.
*
* @param attr
* The attribute.
* @param values
* The expected values.
* @throws ErrorResultException
* If an unexpected problem occurred.
*/
protected final void assertAttributeEquals(Attribute attr, Collection<String> values) throws ErrorResultException {
}
}
/**
* Create a new mock entry.
*
* @param entry
* The entry to be added.
*/
// Create required glue entries.
}
}
// We now have the parent entry - so construct the new entry.
}
/**
* Gets the named entry.
*
* @param dn
* The name of the entry.
* @return Returns the mock entry or <code>null</code> if it does not exist.
*/
}
/**
* {@inheritDoc}
*/
public void unbind() {
// nothing to do
}
}