diff options
Diffstat (limited to 'pki/base/common/test/com/netscape/cmscore/dbs')
6 files changed, 135 insertions, 144 deletions
diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/CertRecordListTest.java b/pki/base/common/test/com/netscape/cmscore/dbs/CertRecordListTest.java index 699a924d..3fd6a96f 100644 --- a/pki/base/common/test/com/netscape/cmscore/dbs/CertRecordListTest.java +++ b/pki/base/common/test/com/netscape/cmscore/dbs/CertRecordListTest.java @@ -40,7 +40,7 @@ public class CertRecordListTest extends CMSBaseTestCase { return new TestSuite(CertRecordListTest.class); } - public void testProcessCertRecordsUsesSize() throws EBaseException { + public void testProcessCertRecordsUsesSize() throws EBaseException { DBVirtualListStub dbList = new DBVirtualListStub(); dbList.size = 5; @@ -57,6 +57,7 @@ public class CertRecordListTest extends CMSBaseTestCase { assertEquals(7, dbList.lastIndexGetElementAtCalledWith); } + public class DBVirtualListStub extends DBVirtualListDefaultStub { public int size = 0; public int getElementAtCallCount = 0; diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryDefaultStub.java b/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryDefaultStub.java index bb8236d7..2095e162 100644 --- a/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryDefaultStub.java +++ b/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryDefaultStub.java @@ -17,16 +17,15 @@ import com.netscape.certsrv.dbs.IFilterConverter; */ public class DBRegistryDefaultStub implements IDBRegistry { - public void registerObjectClass(String className, String ldapNames[]) - throws EDBException { + + public void registerObjectClass(String className, String ldapNames[]) throws EDBException { } public boolean isObjectClassRegistered(String className) { return false; } - public void registerAttribute(String ufName, IDBAttrMapper mapper) - throws EDBException { + public void registerAttribute(String ufName, IDBAttrMapper mapper) throws EDBException { } public boolean isAttributeRegistered(String ufName) { @@ -40,21 +39,18 @@ public class DBRegistryDefaultStub implements IDBRegistry { return null; } - public String getFilter(String filter, IFilterConverter c) - throws EBaseException { + public String getFilter(String filter, IFilterConverter c) throws EBaseException { return null; } - public void mapObject(IDBObj parent, String name, Object obj, - LDAPAttributeSet attrs) throws EBaseException { + public void mapObject(IDBObj parent, String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { } public String[] getLDAPAttributes(String attrs[]) throws EBaseException { return new String[0]; } - public LDAPAttributeSet createLDAPAttributeSet(IDBObj obj) - throws EBaseException { + public LDAPAttributeSet createLDAPAttributeSet(IDBObj obj) throws EBaseException { return null; } @@ -69,8 +65,7 @@ public class DBRegistryDefaultStub implements IDBRegistry { public void setId(String id) throws EBaseException { } - public void init(ISubsystem owner, IConfigStore config) - throws EBaseException { + public void init(ISubsystem owner, IConfigStore config) throws EBaseException { } public void startup() throws EBaseException { diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryTest.java b/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryTest.java index c33dbbaf..7b4681e5 100644 --- a/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryTest.java +++ b/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryTest.java @@ -39,11 +39,9 @@ public class DBRegistryTest extends CMSBaseTestCase { // of a long chain of initialization calls. extAttrMapper = new DBDynAttrMapperStub(); try { - registry.registerObjectClass( - requestRecordStub.getClass().getName(), - new String[] { "ocvalue" }); - registry.registerAttribute(IRequestRecord.ATTR_EXT_DATA, - extAttrMapper); + registry.registerObjectClass(requestRecordStub.getClass().getName(), + new String[] {"ocvalue"} ); + registry.registerAttribute(IRequestRecord.ATTR_EXT_DATA, extAttrMapper); registry.registerAttribute(IRequestRecord.ATTR_SOURCE_ID, new StringMapper("sourceIdOut")); registry.registerDynamicMapper(extAttrMapper); @@ -66,9 +64,13 @@ public class DBRegistryTest extends CMSBaseTestCase { assertTrue(extAttrMapper.mapObjectCalled); } - public void testGetLDAPAttributesForExtData() throws EBaseException { - String inAttrs[] = new String[] { "extData-foo", "extData-foo12", - "EXTDATA-bar;baz", IRequestRecord.ATTR_SOURCE_ID }; + public void testGetLDAPAttributesForExtData() throws EBaseException { + String inAttrs[] = new String[] { + "extData-foo", + "extData-foo12", + "EXTDATA-bar;baz", + IRequestRecord.ATTR_SOURCE_ID + }; String outAttrs[] = registry.getLDAPAttributes(inAttrs); assertTrue(TestHelper.contains(outAttrs, inAttrs[0])); @@ -77,10 +79,9 @@ public class DBRegistryTest extends CMSBaseTestCase { assertTrue(TestHelper.contains(outAttrs, "sourceIdOut")); try { - registry.getLDAPAttributes(new String[] { "badattr" }); + registry.getLDAPAttributes(new String[] {"badattr"}); fail("Should not be able to map badattr"); - } catch (EBaseException e) { /* good */ - } + } catch (EBaseException e) { /* good */ } } public void testCreateLDAPAttributeSet() throws EBaseException { @@ -108,6 +109,7 @@ public class DBRegistryTest extends CMSBaseTestCase { assertTrue(extAttrMapper.mapLDAPAttrsCalled); } + class DBSubsystemStub extends DBSubsystemDefaultStub { DBRegistry registry; @@ -116,23 +118,25 @@ public class DBRegistryTest extends CMSBaseTestCase { } } + class DBDynAttrMapperStub extends DBDynAttrMapperDefaultStub { boolean mapObjectCalled = false; Object mapObjectCalledWithObject = null; boolean mapLDAPAttrsCalled = false; public boolean supportsLDAPAttributeName(String attrName) { - return (attrName != null) - && attrName.toLowerCase().startsWith("extdata-"); + return (attrName != null) && + attrName.toLowerCase().startsWith("extdata-"); } - public void mapLDAPAttributeSetToObject(LDAPAttributeSet attrs, - String name, IDBObj parent) throws EBaseException { + public void mapLDAPAttributeSetToObject(LDAPAttributeSet attrs, String name, IDBObj parent) throws EBaseException { mapLDAPAttrsCalled = true; } public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, - Object obj, LDAPAttributeSet attrs) throws EBaseException { + Object obj, + LDAPAttributeSet attrs) + throws EBaseException { mapObjectCalled = true; mapObjectCalledWithObject = obj; } @@ -142,10 +146,10 @@ public class DBRegistryTest extends CMSBaseTestCase { /* * This class is purposefully placed outside the test because - * DBRegistry.createObject() calls Class.newInstance() to create this stub. This - * fails if the class is nested. + * DBRegistry.createObject() calls Class.newInstance() to create + * this stub. This fails if the class is nested. */ -class RequestRecordStub extends RequestRecordDefaultStub { + class RequestRecordStub extends RequestRecordDefaultStub { /** * diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/DBSSessionDefaultStub.java b/pki/base/common/test/com/netscape/cmscore/dbs/DBSSessionDefaultStub.java index d7c5a94a..aef21db1 100644 --- a/pki/base/common/test/com/netscape/cmscore/dbs/DBSSessionDefaultStub.java +++ b/pki/base/common/test/com/netscape/cmscore/dbs/DBSSessionDefaultStub.java @@ -40,44 +40,35 @@ public class DBSSessionDefaultStub implements IDBSSession { public void modify(String name, ModificationSet mods) throws EBaseException { } - public IDBSearchResults search(String base, String filter) - throws EBaseException { + public IDBSearchResults search(String base, String filter) throws EBaseException { return null; } - public IDBSearchResults search(String base, String filter, int maxSize) - throws EBaseException { + public IDBSearchResults search(String base, String filter, int maxSize) throws EBaseException { return null; } - public IDBSearchResults search(String base, String filter, int maxSize, - int timeLimit) throws EBaseException { + public IDBSearchResults search(String base, String filter, int maxSize, int timeLimit) throws EBaseException { return null; } - public IDBSearchResults search(String base, String filter, String attrs[]) - throws EBaseException { + public IDBSearchResults search(String base, String filter, String attrs[]) throws EBaseException { return null; } - public IDBVirtualList createVirtualList(String base, String filter, - String attrs[]) throws EBaseException { + public IDBVirtualList createVirtualList(String base, String filter, String attrs[]) throws EBaseException { return null; } - public LDAPSearchResults persistentSearch(String base, String filter, - String attrs[]) throws EBaseException { + public LDAPSearchResults persistentSearch(String base, String filter, String attrs[]) throws EBaseException { return null; } - public IDBVirtualList createVirtualList(String base, String filter, - String attrs[], String sortKey, int pageSize) throws EBaseException { + public IDBVirtualList createVirtualList(String base, String filter, String attrs[], String sortKey, int pageSize) throws EBaseException { return null; } - public IDBVirtualList createVirtualList(String base, String filter, - String attrs[], String startFrom, String sortKey, int pageSize) - throws EBaseException { + public IDBVirtualList createVirtualList(String base, String filter, String attrs[], String startFrom, String sortKey, int pageSize) throws EBaseException { return null; } } diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/DBSubsystemDefaultStub.java b/pki/base/common/test/com/netscape/cmscore/dbs/DBSubsystemDefaultStub.java index 9f1a87ae..68f24d50 100644 --- a/pki/base/common/test/com/netscape/cmscore/dbs/DBSubsystemDefaultStub.java +++ b/pki/base/common/test/com/netscape/cmscore/dbs/DBSubsystemDefaultStub.java @@ -17,6 +17,7 @@ import com.netscape.certsrv.dbs.IDBSubsystem; */ public class DBSubsystemDefaultStub implements IDBSubsystem { + public String getBaseDN() { return null; } @@ -69,8 +70,7 @@ public class DBSubsystemDefaultStub implements IDBSubsystem { public void setId(String id) throws EBaseException { } - public void init(ISubsystem owner, IConfigStore config) - throws EBaseException { + public void init(ISubsystem owner, IConfigStore config) throws EBaseException { } public void startup() throws EBaseException { @@ -83,91 +83,91 @@ public class DBSubsystemDefaultStub implements IDBSubsystem { return null; } - @Override - public void setMaxSerialConfig(int repo, String serial) - throws EBaseException { - // TODO Auto-generated method stub - - } - - @Override - public void setMinSerialConfig(int repo, String serial) - throws EBaseException { - // TODO Auto-generated method stub - - } - - @Override - public void setNextMaxSerialConfig(int repo, String serial) - throws EBaseException { - // TODO Auto-generated method stub - - } - - @Override - public void setNextMinSerialConfig(int repo, String serial) - throws EBaseException { - // TODO Auto-generated method stub - - } - - @Override - public String getMinSerialConfig(int repo) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getMaxSerialConfig(int repo) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getNextMaxSerialConfig(int repo) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getNextMinSerialConfig(int repo) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getLowWaterMarkConfig(int repo) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getIncrementConfig(int repo) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getNextRange(int repo) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean hasRangeConflict(int repo) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean getEnableSerialMgmt() { - // TODO Auto-generated method stub - return false; - } - - @Override - public void setEnableSerialMgmt(boolean value) throws EBaseException { - // TODO Auto-generated method stub - - } + @Override + public void setMaxSerialConfig(int repo, String serial) + throws EBaseException { + // TODO Auto-generated method stub + + } + + @Override + public void setMinSerialConfig(int repo, String serial) + throws EBaseException { + // TODO Auto-generated method stub + + } + + @Override + public void setNextMaxSerialConfig(int repo, String serial) + throws EBaseException { + // TODO Auto-generated method stub + + } + + @Override + public void setNextMinSerialConfig(int repo, String serial) + throws EBaseException { + // TODO Auto-generated method stub + + } + + @Override + public String getMinSerialConfig(int repo) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getMaxSerialConfig(int repo) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getNextMaxSerialConfig(int repo) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getNextMinSerialConfig(int repo) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getLowWaterMarkConfig(int repo) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getIncrementConfig(int repo) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getNextRange(int repo) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean hasRangeConflict(int repo) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getEnableSerialMgmt() { + // TODO Auto-generated method stub + return false; + } + + @Override + public void setEnableSerialMgmt(boolean value) throws EBaseException { + // TODO Auto-generated method stub + + } } diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/DBVirtualListDefaultStub.java b/pki/base/common/test/com/netscape/cmscore/dbs/DBVirtualListDefaultStub.java index 294ae1df..45fda77d 100644 --- a/pki/base/common/test/com/netscape/cmscore/dbs/DBVirtualListDefaultStub.java +++ b/pki/base/common/test/com/netscape/cmscore/dbs/DBVirtualListDefaultStub.java @@ -22,11 +22,11 @@ import com.netscape.certsrv.dbs.IDBVirtualList; import com.netscape.certsrv.dbs.IElementProcessor; /** - * A default stub ojbect for tests to extend. This class helps test avoid the - * problem of test stubs having to implement a new stub method every time the - * interface changes. It also makes the tests clearer by not cluttered them with - * empty methods. - * + * A default stub ojbect for tests to extend. + * This class helps test avoid the problem of test stubs having to + * implement a new stub method every time the interface changes. + * It also makes the tests clearer by not cluttered them with empty methods. + * * Do not put any behaviour in this class. */ public class DBVirtualListDefaultStub implements IDBVirtualList { @@ -73,7 +73,7 @@ public class DBVirtualListDefaultStub implements IDBVirtualList { } public void processElements(int startidx, int endidx, IElementProcessor ep) - throws EBaseException { + throws EBaseException { } public int getSelectedIndex() { |