diff options
Diffstat (limited to 'pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryTest.java')
-rw-r--r-- | pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryTest.java | 42 |
1 files changed, 23 insertions, 19 deletions
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 { /** * |