Inlined TestCaseUtils.new*() methods (superseded by CollectionUtils methods).
| | |
| | | import static org.opends.server.loggers.TextErrorLogPublisher.*; |
| | | import static org.opends.server.loggers.TextHTTPAccessLogPublisher.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | "--set", "enabled:" + enabled); |
| | | } |
| | | |
| | | public static <T> Set<T> newSet(T... elems) |
| | | { |
| | | return newHashSet(elems); |
| | | } |
| | | |
| | | public static <T> SortedSet<T> newSortedSet(T... elems) |
| | | { |
| | | return newTreeSet(elems); |
| | | } |
| | | |
| | | public static <T> List<T> newList(T... elems) |
| | | { |
| | | return newArrayList(elems); |
| | | } |
| | | |
| | | public static HashSet<PluginType> getPluginTypes(Entry e) |
| | | { |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(); |
| | |
| | | { |
| | | Entry targetEntry = parseIncludedAttributes(resultEntry, targetdn); |
| | | |
| | | Set<String> eoc = newSet("person", "inetOrgPerson", "organizationalPerson", "top"); |
| | | Set<String> eoc = newHashSet("person", "inetOrgPerson", "organizationalPerson", "top"); |
| | | assertAttributeValues(targetEntry, "objectclass", eoc); |
| | | |
| | | String changeType = getAttributeValue(resultEntry, "changetype"); |
| | |
| | | debugInfo(testName, "Starting test \n\n"); |
| | | |
| | | Set<String> attributes = |
| | | newSet("firstchangenumber", "lastchangenumber", "changelog", "lastExternalChangelogCookie"); |
| | | newHashSet("firstchangenumber", "lastchangenumber", "changelog", "lastExternalChangelogCookie"); |
| | | |
| | | InternalSearchOperation searchOp = searchDNWithBaseScope(DN_OTEST, attributes); |
| | | waitForSearchOpResult(searchOp, ResultCode.SUCCESS); |
| | |
| | | String cookie = ""; |
| | | LDIFWriter ldifWriter = getLDIFWriter(); |
| | | |
| | | InternalSearchOperation searchOp = searchDNWithBaseScope(DN.rootDN(), newSet("lastExternalChangelogCookie")); |
| | | InternalSearchOperation searchOp = searchDNWithBaseScope(DN.rootDN(), newHashSet("lastExternalChangelogCookie")); |
| | | List<SearchResultEntry> entries = searchOp.getSearchEntries(); |
| | | if (entries != null) |
| | | { |
| | |
| | | { |
| | | final MultiDomainServerState state = new MultiDomainServerState(cookie); |
| | | final Control cookieControl = new ExternalChangelogRequestControl(true, state); |
| | | return newList(cookieControl); |
| | | return newArrayList(cookieControl); |
| | | } |
| | | |
| | | private static LDIFWriter getLDIFWriter() throws Exception |
| | |
| | | import static org.mockito.Mockito.when; |
| | | import static org.opends.server.ConfigurationMock.legacyMockCfg; |
| | | import static org.opends.server.TestCaseUtils.makeEntry; |
| | | import static org.opends.server.TestCaseUtils.newSortedSet; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.getRootConnection; |
| | | import static org.opends.server.protocols.internal.Requests.newSearchRequest; |
| | | import static org.opends.server.util.ServerConstants.OID_SERVER_SIDE_SORT_RESPONSE_CONTROL; |
| | | import static org.opends.server.util.ServerConstants.OID_VLV_RESPONSE_CONTROL; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.fail; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | final PDBBackendCfg backendCfg = legacyMockCfg(PDBBackendCfg.class); |
| | | when(backendCfg.dn()).thenReturn(baseDN); |
| | | when(backendCfg.getBackendId()).thenReturn(BACKEND_NAME); |
| | | when(backendCfg.getBaseDN()).thenReturn(newSortedSet(baseDN)); |
| | | when(backendCfg.getBaseDN()).thenReturn(newTreeSet(baseDN)); |
| | | when(backendCfg.listBackendIndexes()).thenReturn(new String[0]); |
| | | when(backendCfg.listBackendVLVIndexes()).thenReturn(new String[] { SORT_ORDER_1, SORT_ORDER_2 }); |
| | | |
| | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.ConfigurationMock.legacyMockCfg; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | when(backendCfg.getDBDirectoryPermissions()).thenReturn("755"); |
| | | when(backendCfg.getDBCacheSize()).thenReturn(0L); |
| | | when(backendCfg.getDBCachePercent()).thenReturn(20); |
| | | when(backendCfg.getBaseDN()).thenReturn(TestCaseUtils.newSortedSet(DN.valueOf("dc=test,dc=com"))); |
| | | when(backendCfg.getBaseDN()).thenReturn(newTreeSet(DN.valueOf("dc=test,dc=com"))); |
| | | when(backendCfg.dn()).thenReturn(DN.valueOf("dc=test,dc=com")); |
| | | when(backendCfg.listBackendIndexes()).thenReturn(new String[] { "sn" }); |
| | | when(backendCfg.listBackendVLVIndexes()).thenReturn(new String[0]); |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(TestCaseUtils.newSortedSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | | } |
| | | |
| | | } |
| | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.ConfigurationMock.legacyMockCfg; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | |
| | | import java.util.Random; |
| | | import java.util.concurrent.Callable; |
| | |
| | | when(backendCfg.getDBDirectoryPermissions()).thenReturn("755"); |
| | | when(backendCfg.getDBCacheSize()).thenReturn(0L); |
| | | when(backendCfg.getDBCachePercent()).thenReturn(20); |
| | | when(backendCfg.getBaseDN()).thenReturn(TestCaseUtils.newSortedSet(DN.valueOf("dc=test,dc=com"))); |
| | | when(backendCfg.getBaseDN()).thenReturn(newTreeSet(DN.valueOf("dc=test,dc=com"))); |
| | | when(backendCfg.dn()).thenReturn(DN.valueOf("dc=test,dc=com")); |
| | | when(backendCfg.listBackendIndexes()).thenReturn(new String[] { "sn" }); |
| | | when(backendCfg.listBackendVLVIndexes()).thenReturn(new String[0]); |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(TestCaseUtils.newSortedSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | | } |
| | | |
| | | } |
| | |
| | | import static org.forgerock.opendj.ldap.ModificationType.ADD; |
| | | import static org.mockito.Mockito.mock; |
| | | import static org.mockito.Mockito.when; |
| | | import static org.opends.server.TestCaseUtils.newSortedSet; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.getRootConnection; |
| | | import static org.opends.server.protocols.internal.Requests.newSearchRequest; |
| | | import static org.opends.server.types.Attributes.create; |
| | | import static org.opends.server.types.IndexType.EQUALITY; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | |
| | | C backendCfg = createBackendCfg(); |
| | | when(backendCfg.dn()).thenReturn(testBaseDN); |
| | | when(backendCfg.getBackendId()).thenReturn(backendTestName); |
| | | when(backendCfg.getBaseDN()).thenReturn(newSortedSet(testBaseDN)); |
| | | when(backendCfg.getBaseDN()).thenReturn(newTreeSet(testBaseDN)); |
| | | when(backendCfg.listBackendIndexes()).thenReturn(backendIndexes); |
| | | when(backendCfg.listBackendVLVIndexes()).thenReturn(backendVlvIndexes); |
| | | |
| | | BackendIndexCfg indexCfg = mock(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newSortedSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType(backendIndexes[0])); |
| | | when(backendCfg.getBackendIndex(backendIndexes[0])).thenReturn(indexCfg); |
| | | |
| | |
| | | C backendCfg = createBackendCfg(); |
| | | when(backendCfg.dn()).thenReturn(testBaseDN); |
| | | when(backendCfg.getBackendId()).thenReturn(backendTestName); |
| | | when(backendCfg.getBaseDN()).thenReturn(newSortedSet(testBaseDN)); |
| | | when(backendCfg.getBaseDN()).thenReturn(newTreeSet(testBaseDN)); |
| | | when(backendCfg.listBackendIndexes()).thenReturn(new String[0]); |
| | | when(backendCfg.listBackendVLVIndexes()).thenReturn(new String[0]); |
| | | |
| | |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.ConfigurationMock.legacyMockCfg; |
| | | import static org.opends.server.backends.pluggable.State.IndexFlag.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | |
| | | import java.util.UUID; |
| | | |
| | |
| | | when(backendCfg.getDBDirectoryPermissions()).thenReturn("755"); |
| | | when(backendCfg.getDBCacheSize()).thenReturn(0L); |
| | | when(backendCfg.getDBCachePercent()).thenReturn(20); |
| | | when(backendCfg.getBaseDN()).thenReturn(TestCaseUtils.newSortedSet(DN.valueOf("dc=test,dc=com"))); |
| | | when(backendCfg.getBaseDN()).thenReturn(newTreeSet(DN.valueOf("dc=test,dc=com"))); |
| | | when(backendCfg.dn()).thenReturn(DN.valueOf("dc=test,dc=com")); |
| | | when(backendCfg.listBackendIndexes()).thenReturn(new String[] { "sn" }); |
| | | when(backendCfg.listBackendVLVIndexes()).thenReturn(new String[0]); |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(TestCaseUtils.newSortedSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | String attrType, String... values) |
| | | { |
| | | LDAPAttribute attr = new LDAPAttribute(attrType, Arrays.asList(values)); |
| | | return newList((RawModification) new LDAPModification(modType, attr)); |
| | | return newArrayList((RawModification) new LDAPModification(modType, attr)); |
| | | } |
| | | |
| | | @Test |
| | |
| | | |
| | | import static org.forgerock.opendj.ldap.ResultCode.*; |
| | | import static org.forgerock.opendj.ldap.SearchScope.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | |
| | | protected DomainFakeCfg newFakeCfg(final DN baseDN, int serverId, int port) |
| | | { |
| | | DomainFakeCfg fakeCfg = new DomainFakeCfg(baseDN, serverId, newSortedSet("localhost:" + port)); |
| | | DomainFakeCfg fakeCfg = new DomainFakeCfg(baseDN, serverId, newTreeSet("localhost:" + port)); |
| | | fakeCfg.setHeartbeatInterval(100000); |
| | | fakeCfg.setChangetimeHeartbeatInterval(500); |
| | | return fakeCfg; |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | private void createFakeReplicationDomain(boolean firstBackend, |
| | | long generationId) throws Exception |
| | | { |
| | | SortedSet<String> replicationServers = newSortedSet("localhost:" + replServerPort); |
| | | SortedSet<String> replicationServers = newTreeSet("localhost:" + replServerPort); |
| | | |
| | | DN baseDN = DN.valueOf(firstBackend ? TEST_ROOT_DN_STRING : TEST2_ROOT_DN_STRING); |
| | | replicationDomain = new FakeReplicationDomain(baseDN, DS2_ID, replicationServers, 1000, generationId); |
| | |
| | | private TestBroker(List<ReplicationMsg> list) |
| | | { |
| | | super(new DummyReplicationDomain(0), null, |
| | | new DomainFakeCfg(null, 0, TestCaseUtils.<String> newSortedSet()), null); |
| | | new DomainFakeCfg(null, 0, new TreeSet<String>()), null); |
| | | this.list = list; |
| | | } |
| | | |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | private ReplicationBroker createReplicationBroker(int dsId, |
| | | ServerState state, long generationId) throws Exception |
| | | { |
| | | SortedSet<String> replServers = newSortedSet("localhost:" + rs1Port); |
| | | SortedSet<String> replServers = newTreeSet("localhost:" + rs1Port); |
| | | DomainFakeCfg fakeCfg = new DomainFakeCfg(EXAMPLE_DN_, dsId, replServers); |
| | | fakeCfg.setHeartbeatInterval(0); |
| | | fakeCfg.setChangetimeHeartbeatInterval(500); |
| | |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.replication.protocol.OperationContext.*; |
| | | import static org.opends.server.replication.protocol.ProtocolVersion.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | // Entry attributes |
| | | Attribute eattr1 = Attributes.create("description", "eav description"); |
| | | Attribute eattr2 = Attributes.create("namingcontexts", "eav naming contexts"); |
| | | List<Attribute> entryAttrList = newList(eattr1, eattr2); |
| | | List<Attribute> entryAttrList = newArrayList(eattr1, eattr2); |
| | | |
| | | return new Object[][] { |
| | | {"dc=example,dc=com", false, AssuredMode.SAFE_DATA_MODE, (byte)0, null}, |
| | |
| | | "organization"); |
| | | |
| | | Attribute attr = Attributes.create("o", "com"); |
| | | List<Attribute> userAttributes = newList(attr); |
| | | List<Attribute> userAttributes = newArrayList(attr); |
| | | HashMap<AttributeType, List<Attribute>> userAttList = new HashMap<>(); |
| | | userAttList.put(attr.getAttributeType(), userAttributes); |
| | | |
| | | |
| | | attr = Attributes.create("creatorsName", "dc=creator"); |
| | | List<Attribute> operationalAttributes = newList(attr); |
| | | List<Attribute> operationalAttributes = newArrayList(attr); |
| | | HashMap<AttributeType, List<Attribute>> opList = new HashMap<>(); |
| | | opList.put(attr.getAttributeType(), operationalAttributes); |
| | | |
| | |
| | | // Entry attributes |
| | | Attribute eattr1 = Attributes.create("description", "eav description"); |
| | | Attribute eattr2 = Attributes.create("namingcontexts", "eav naming contexts"); |
| | | List<Attribute> entryAttrList = newList(eattr1, eattr2); |
| | | List<Attribute> entryAttrList = newArrayList(eattr1, eattr2); |
| | | |
| | | return new Object[][] { |
| | | {"dc=example,dc=com", false, AssuredMode.SAFE_DATA_MODE, (byte)0, null}, |
| | |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | | List<Modification> mods1 = newList(mod1); |
| | | List<Modification> mods1 = newArrayList(mod1); |
| | | |
| | | Attribute attr2 = Attributes.empty("description"); |
| | | Modification mod2 = new Modification(ModificationType.DELETE, attr2); |
| | | List<Modification> mods2 = newList(mod1, mod2); |
| | | List<Modification> mods2 = newArrayList(mod1, mod2); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(type); |
| | | builder.add("string"); |
| | |
| | | builder.add("again"); |
| | | Attribute attr3 = builder.toAttribute(); |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | List<Modification> mods3 = newList(mod3); |
| | | List<Modification> mods3 = newArrayList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | |
| | | |
| | | Attribute attr5 = Attributes.create("namingcontexts", "o=test"); |
| | | Modification mod5 = new Modification(ModificationType.REPLACE, attr5); |
| | | List<Modification> mods5 = newList(mod5); |
| | | List<Modification> mods5 = newArrayList(mod5); |
| | | |
| | | // Entry attributes |
| | | Attribute eattr1 = Attributes.create("description", "eav description"); |
| | | Attribute eattr2 = Attributes.create("namingcontexts", "eav naming contexts"); |
| | | List<Attribute> entryAttrList = newList(eattr1, eattr2); |
| | | List<Attribute> entryAttrList = newArrayList(eattr1, eattr2); |
| | | |
| | | return new Object[][] { |
| | | { csn1, "dc=test", mods1, false, AssuredMode.SAFE_DATA_MODE, (byte) 0, null }, |
| | |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | | List<Modification> mods1 = newList(mod1); |
| | | List<Modification> mods1 = newArrayList(mod1); |
| | | |
| | | Attribute attr2 = Attributes.empty("description"); |
| | | Modification mod2 = new Modification(ModificationType.DELETE, attr2); |
| | | List<Modification> mods2 = newList(mod1, mod2); |
| | | List<Modification> mods2 = newArrayList(mod1, mod2); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(type); |
| | | builder.add("string"); |
| | |
| | | builder.add("again"); |
| | | Attribute attr3 = builder.toAttribute(); |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | List<Modification> mods3 = newList(mod3); |
| | | List<Modification> mods3 = newArrayList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | |
| | | // Entry attributes |
| | | Attribute eattr1 = Attributes.create("description", "eav description"); |
| | | Attribute eattr2 = Attributes.create("namingcontexts", "eav naming contexts"); |
| | | List<Attribute> entryAttrList = newList(eattr1, eattr2); |
| | | List<Attribute> entryAttrList = newArrayList(eattr1, eattr2); |
| | | |
| | | return new Object[][] { |
| | | {"dc=test,dc=com", "dc=new", "11111111-1111-1111-1111-111111111111", "22222222-2222-2222-2222-222222222222", false, "dc=change", mods1, false, AssuredMode.SAFE_DATA_MODE, (byte)0, null}, |
| | |
| | | @DataProvider(name = "createoldAckMsgData") |
| | | public Object[][] createoldAckMsgData() |
| | | { |
| | | List<Integer> fservers4 = newList(100, 2000, 30000); |
| | | List<Integer> fservers4 = newArrayList(100, 2000, 30000); |
| | | |
| | | return new Object[][] { |
| | | {"05303030303031323366316535383832383030326430303030303037" + |
| | |
| | | @DataProvider |
| | | public Object[][] createTopologyData() throws Exception |
| | | { |
| | | List<String> urls1 = newList( |
| | | List<String> urls1 = newArrayList( |
| | | "ldap://ldap.iplanet.com/o=test??sub?(sn=Jensen)", |
| | | "ldaps://ldap.iplanet.com:4041/uid=bjensen,ou=People,o=test?cn,mail,telephoneNumber"); |
| | | |
| | | List<String> urls2 = newList(); |
| | | List<String> urls2 = newArrayList(); |
| | | |
| | | List<String> urls3 = newList( |
| | | List<String> urls3 = newArrayList( |
| | | "ldaps://host:port/dc=foo??sub?(sn=One Entry)"); |
| | | |
| | | List<String> urls4 = newList( |
| | | List<String> urls4 = newArrayList( |
| | | "ldaps://host:port/dc=foobar1??sub?(sn=Another Entry 1)", |
| | | "ldaps://host:port/dc=foobar2??sub?(sn=Another Entry 2)"); |
| | | |
| | |
| | | DSInfo dsInfo4 = new DSInfo(415, "", 146, 0, ServerStatus.BAD_GEN_ID_STATUS, |
| | | true, AssuredMode.SAFE_DATA_MODE, (byte)2, (byte)15, urls4, new HashSet<String>(), new HashSet<String>(), (short)-1); |
| | | |
| | | Set<DSInfo> dsList1 = newSet(dsInfo1); |
| | | Set<DSInfo> dsList2 = newSet(); |
| | | Set<DSInfo> dsList3 = newSet(dsInfo2); |
| | | Set<DSInfo> dsList4 = newSet(dsInfo4, dsInfo3, dsInfo2, dsInfo1); |
| | | Set<DSInfo> dsList1 = newHashSet(dsInfo1); |
| | | Set<DSInfo> dsList2 = newHashSet(); |
| | | Set<DSInfo> dsList3 = newHashSet(dsInfo2); |
| | | Set<DSInfo> dsList4 = newHashSet(dsInfo4, dsInfo3, dsInfo2, dsInfo1); |
| | | |
| | | RSInfo rsInfo1 = new RSInfo(4527, null, 45316, (byte)103, 1); |
| | | RSInfo rsInfo2 = new RSInfo(4527, null, 0, (byte)0, 1); |
| | | RSInfo rsInfo3 = new RSInfo(0, null, -21113, (byte)98, 1); |
| | | |
| | | List<RSInfo> rsList1 = newList(rsInfo1); |
| | | List<RSInfo> rsList2 = newList(rsInfo1, rsInfo2, rsInfo3); |
| | | List<RSInfo> rsList1 = newArrayList(rsInfo1); |
| | | List<RSInfo> rsList2 = newArrayList(rsInfo1, rsInfo2, rsInfo3); |
| | | |
| | | return new Object[][] { |
| | | {"1a01313300323600313534363331000300020c84026c6461703a2f2f6c6461702e697" + |
| | |
| | | "6c6570686f6e654e756d6265720001343532370034353331360067",dsList1, rsList1}, |
| | | {"1a0003343532370034353331360067343532370030000030002d32313131330062", dsList2, rsList2}, |
| | | {"1a012d34333600343933002d32323738393600020101f9f70001343532370034353331360067", dsList3, rsList1}, |
| | | {"1a012d34333600343933002d32323738393600020101f9f70000", dsList3, newList()}, |
| | | {"1a0001343532370034353331360067", newSet(), rsList1}, |
| | | {"1a0000", newSet(), newList()}, |
| | | {"1a012d34333600343933002d32323738393600020101f9f70000", dsList3, newArrayList()}, |
| | | {"1a0001343532370034353331360067", newHashSet(), rsList1}, |
| | | {"1a0000", newHashSet(), newArrayList()}, |
| | | {"1a0434313500313436003000040102020f026c646170733a2f2f686f73743a706f727" + |
| | | "42f64633d666f6f626172313f3f7375623f28736e3d416e6f7468657220456e747279" + |
| | | "203129006c646170733a2f2f686f73743a706f72742f64633d666f6f626172323f3f7" + |
| | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.replication.protocol.OperationContext.*; |
| | | import static org.opends.server.replication.protocol.ProtocolVersion.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | | List<Modification> mods1 = newList(mod1); |
| | | List<Modification> mods1 = newArrayList(mod1); |
| | | |
| | | Attribute attr2 = Attributes.empty("description"); |
| | | Modification mod2 = new Modification(ModificationType.DELETE, attr2); |
| | | List<Modification> mods2 = newList(mod1, mod2); |
| | | List<Modification> mods2 = newArrayList(mod1, mod2); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(type); |
| | | builder.add("string"); |
| | |
| | | builder.add("again"); |
| | | Attribute attr3 = builder.toAttribute(); |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | List<Modification> mods3 = newList(mod3); |
| | | List<Modification> mods3 = newArrayList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | |
| | | |
| | | Attribute attr5 = Attributes.create("namingcontexts", TEST_ROOT_DN_STRING); |
| | | Modification mod5 = new Modification(ModificationType.REPLACE, attr5); |
| | | List<Modification> mods5 = newList(mod5); |
| | | List<Modification> mods5 = newArrayList(mod5); |
| | | |
| | | List<Attribute> eclIncludes = getEntryAttributes(); |
| | | return new Object[][] { |
| | |
| | | |
| | | private List<Attribute> getEntryAttributes() |
| | | { |
| | | return newList( |
| | | return newArrayList( |
| | | Attributes.create("description", "eav description"), |
| | | Attributes.create("namingcontexts", "eav naming contexts")); |
| | | } |
| | |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | | List<Modification> mods1 = newList(mod1); |
| | | List<Modification> mods1 = newArrayList(mod1); |
| | | |
| | | Attribute attr2 = Attributes.empty("description"); |
| | | Modification mod2 = new Modification(ModificationType.DELETE, attr2); |
| | | List<Modification> mods2 = newList(mod1, mod2); |
| | | List<Modification> mods2 = newArrayList(mod1, mod2); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(type); |
| | | builder.add("string"); |
| | |
| | | builder.add("again"); |
| | | Attribute attr3 = builder.toAttribute(); |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | List<Modification> mods3 = newList(mod3); |
| | | List<Modification> mods3 = newArrayList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | |
| | | objectClassList.put(DirectoryServer.getObjectClass("organization"), "organization"); |
| | | |
| | | Attribute attr = Attributes.create("o", "com"); |
| | | List<Attribute> userAttributes = newList(attr); |
| | | List<Attribute> userAttributes = newArrayList(attr); |
| | | Map<AttributeType, List<Attribute>> userAttList = new HashMap<>(); |
| | | userAttList.put(attr.getAttributeType(), userAttributes); |
| | | |
| | | |
| | | attr = Attributes.create("creatorsname", "dc=creator"); |
| | | List<Attribute> operationalAttributes = newList(attr); |
| | | List<Attribute> operationalAttributes = newArrayList(attr); |
| | | Map<AttributeType, List<Attribute>> opList = new HashMap<>(); |
| | | opList.put(attr.getAttributeType(), operationalAttributes); |
| | | |
| | |
| | | CSN csn2 = new CSN(TimeThread.getTime(), 123, 45); |
| | | CSN csn3 = new CSN(TimeThread.getTime(), 1234567, 45678); |
| | | |
| | | List<Integer> fservers1 = newList(12345, -12345, 31657, -28456, 0); |
| | | List<Integer> fservers2 = newList(); |
| | | List<Integer> fservers3 = newList(0); |
| | | List<Integer> fservers4 = newList(100, 2000, 30000, -100, -2000, -30000); |
| | | List<Integer> fservers1 = newArrayList(12345, -12345, 31657, -28456, 0); |
| | | List<Integer> fservers2 = newArrayList(); |
| | | List<Integer> fservers3 = newArrayList(0); |
| | | List<Integer> fservers4 = newArrayList(100, 2000, 30000, -100, -2000, -30000); |
| | | |
| | | return new Object[][] { |
| | | {csn1, true, false, false, fservers1}, |
| | |
| | | @DataProvider |
| | | public Object[][] createTopologyData() throws Exception |
| | | { |
| | | List<String> urls1 = newList( |
| | | List<String> urls1 = newArrayList( |
| | | "ldap://ldap.iplanet.com/" + TEST_ROOT_DN_STRING + "??sub?(sn=Jensen)", |
| | | "ldaps://ldap.iplanet.com:4041/uid=bjensen,ou=People," |
| | | + TEST_ROOT_DN_STRING + "?cn,mail,telephoneNumber"); |
| | | List<String> urls2 = newList(); |
| | | List<String> urls3 = newList("ldaps://host:port/dc=foo??sub?(sn=One Entry)"); |
| | | List<String> urls4 = newList( |
| | | List<String> urls2 = newArrayList(); |
| | | List<String> urls3 = newArrayList("ldaps://host:port/dc=foo??sub?(sn=One Entry)"); |
| | | List<String> urls4 = newArrayList( |
| | | "ldaps://host:port/dc=foobar1??sub?(sn=Another Entry 1)", |
| | | "ldaps://host:port/dc=foobar2??sub?(sn=Another Entry 2)"); |
| | | |
| | | Set<String> a1 = newSet(); |
| | | Set<String> a2 = newSet("dc"); |
| | | Set<String> a3 = newSet("dc", "uid"); |
| | | Set<String> a4 = newSet(); |
| | | Set<String> a1 = newHashSet(); |
| | | Set<String> a2 = newHashSet("dc"); |
| | | Set<String> a3 = newHashSet("dc", "uid"); |
| | | Set<String> a4 = newHashSet(); |
| | | |
| | | DSInfo dsInfo1 = new DSInfo(13, "dsHost1:111", 26, 154631, ServerStatus.FULL_UPDATE_STATUS, |
| | | false, AssuredMode.SAFE_DATA_MODE, (byte)12, (byte)132, urls1, a1, a1, (short)1); |
| | |
| | | DSInfo dsInfo5 = new DSInfo(452436, "dsHost5:555", 45591, 0, ServerStatus.NORMAL_STATUS, |
| | | false, AssuredMode.SAFE_READ_MODE, (byte)17, (byte)0, urls3, a1, a1, (short)5); |
| | | |
| | | List<DSInfo> dsList1 = newList(dsInfo1); |
| | | List<DSInfo> dsList2 = newList(); |
| | | List<DSInfo> dsList3 = newList(dsInfo2); |
| | | List<DSInfo> dsList4 = newList(dsInfo5, dsInfo4, dsInfo3, dsInfo2, dsInfo1); |
| | | List<DSInfo> dsList1 = newArrayList(dsInfo1); |
| | | List<DSInfo> dsList2 = newArrayList(); |
| | | List<DSInfo> dsList3 = newArrayList(dsInfo2); |
| | | List<DSInfo> dsList4 = newArrayList(dsInfo5, dsInfo4, dsInfo3, dsInfo2, dsInfo1); |
| | | |
| | | RSInfo rsInfo1 = new RSInfo(4527, "rsHost1:123", 45316, (byte)103, 1); |
| | | RSInfo rsInfo2 = new RSInfo(4527, "rsHost2:456", 0, (byte)0, 1); |
| | | RSInfo rsInfo3 = new RSInfo(0, "rsHost3:789", -21113, (byte)98, 1); |
| | | RSInfo rsInfo4 = new RSInfo(45678, "rsHost4:1011", -21113, (byte)98, 1); |
| | | |
| | | List<RSInfo> rsList1 = newList(rsInfo1); |
| | | List<RSInfo> rsList2 = newList(rsInfo1, rsInfo2, rsInfo3, rsInfo4); |
| | | List<RSInfo> rsList1 = newArrayList(rsInfo1); |
| | | List<RSInfo> rsList2 = newArrayList(rsInfo1, rsInfo2, rsInfo3, rsInfo4); |
| | | |
| | | return new Object[][] { |
| | | {dsList1, rsList1}, |
| | |
| | | urls6.add("ldaps://host:port/dc=foo??sub?(sn=Fourth Entry)"); |
| | | urls6.add("ldaps://host:port/dc=foo??sub?(sn=Fifth Entry)"); |
| | | |
| | | Set<String> a1 = newSet(); |
| | | Set<String> a2 = newSet("dc"); |
| | | Set<String> a3 = newSet("dc", "uid"); |
| | | Set<String> a1 = newHashSet(); |
| | | Set<String> a2 = newHashSet("dc"); |
| | | Set<String> a3 = newHashSet("dc", "uid"); |
| | | |
| | | return new Object[][]{ |
| | | {ServerStatus.NORMAL_STATUS, urls1, true, AssuredMode.SAFE_DATA_MODE, (byte)1, a1}, |
| | |
| | | |
| | | Attribute attr = Attributes.create("o", "com"); |
| | | Map<AttributeType, List<Attribute>> userAttList = new HashMap<>(); |
| | | userAttList.put(attr.getAttributeType(), newList(attr)); |
| | | userAttList.put(attr.getAttributeType(), newArrayList(attr)); |
| | | |
| | | |
| | | attr = Attributes.create("creatorsname", "dc=creator"); |
| | | Map<AttributeType, List<Attribute>> opList = new HashMap<>(); |
| | | opList.put(attr.getAttributeType(), newList(attr)); |
| | | opList.put(attr.getAttributeType(), newArrayList(attr)); |
| | | |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | | DN dn = DN.valueOf(rawDN); |
| | |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | { |
| | | final int rsPort = getRsPort(rsId); |
| | | final DomainFakeCfg fakeCfg = new DomainFakeCfg( |
| | | DN.valueOf(TEST_ROOT_DN_STRING), serverId, newSortedSet("localhost:" + rsPort), |
| | | DN.valueOf(TEST_ROOT_DN_STRING), serverId, newTreeSet("localhost:" + rsPort), |
| | | getAssuredType(assuredMode), |
| | | safeDataLevel, groupId, assuredTimeout, new TreeSet<String>()); |
| | | fakeCfg.setHeartbeatInterval(1000); |
| | |
| | | |
| | | // Send our topo mesg |
| | | RSInfo rsInfo = new RSInfo(serverId, fakeUrl, generationId, groupId, 1); |
| | | session.publish(new TopologyMsg(null, newList(rsInfo))); |
| | | session.publish(new TopologyMsg(null, newArrayList(rsInfo))); |
| | | |
| | | // Read topo msg |
| | | TopologyMsg inTopoMsg = (TopologyMsg) session.receive(); |
| | |
| | | // Send the ack with timeout error from a virtual DS with id (ours + 10) |
| | | AckMsg ackMsg = new AckMsg(updateMsg.getCSN()); |
| | | ackMsg.setHasTimeout(true); |
| | | ackMsg.setFailedServers(newList(serverId + 10)); |
| | | ackMsg.setFailedServers(newArrayList(serverId + 10)); |
| | | session.publish(ackMsg); |
| | | ackReplied = true; |
| | | } |
| | |
| | | // Send the ack with wrong status error from a virtual DS with id (ours + 10) |
| | | AckMsg ackMsg = new AckMsg(updateMsg.getCSN()); |
| | | ackMsg.setHasWrongStatus(true); |
| | | ackMsg.setFailedServers(newList(serverId + 10)); |
| | | ackMsg.setFailedServers(newArrayList(serverId + 10)); |
| | | session.publish(ackMsg); |
| | | ackReplied = true; |
| | | } |
| | |
| | | // Send the ack with replay error from a virtual DS with id (ours + 10) |
| | | AckMsg ackMsg = new AckMsg(updateMsg.getCSN()); |
| | | ackMsg.setHasReplayError(true); |
| | | ackMsg.setFailedServers(newList(serverId + 10)); |
| | | ackMsg.setFailedServers(newArrayList(serverId + 10)); |
| | | session.publish(ackMsg); |
| | | ackReplied = true; |
| | | } |
| | |
| | | // Add each possible parameter as initial parameter lists |
| | | for (Object possibleParameter : possibleParameters) |
| | | { |
| | | newObjectArrayList.add(newList(possibleParameter)); |
| | | newObjectArrayList.add(newArrayList(possibleParameter)); |
| | | } |
| | | return newObjectArrayList; |
| | | } |
| | |
| | | |
| | | import static org.assertj.core.data.MapEntry.*; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.replication.service.ReplicationBroker.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | | newHashSet(1)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "CwinnerHost:456", 0L, (byte)1, 1), |
| | | EMPTY_SET); |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "DwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | | newHashSet(1)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 1), |
| | | newSet(101)); |
| | | newHashSet(101)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | | newHashSet(1, 2)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "EwinnerHost:456", 0L, (byte)1, 1), |
| | | newSet(101)); |
| | | newHashSet(101)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | | newHashSet(1)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "FwinnerHost:456", 0L, (byte)1, 2), |
| | | newSet(101)); |
| | | newHashSet(101)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | | newHashSet(1)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "GwinnerHost:456", 0L, (byte)1, 2), |
| | | newSet(101, 102)); |
| | | newHashSet(101, 102)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | | newHashSet(1, 2)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "HwinnerHost:456", 0L, (byte)1, 2), |
| | | newSet(101, 102, 103, 104)); |
| | | newHashSet(101, 102, 103, 104)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | | newHashSet(1)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 2), |
| | | newSet(101, 102)); |
| | | newHashSet(101, 102)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "IwinnerHost:789", 0L, (byte)1, 3), |
| | | newSet(201, 202, 203)); |
| | | newHashSet(201, 202, 203)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "JwinnerHost:123", 0L, (byte)1, 5), |
| | | newSet(1, 2, 3)); |
| | | newHashSet(1, 2, 3)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 3), |
| | | newSet(101, 102, 103, 104, 105)); |
| | | newHashSet(101, 102, 103, 104, 105)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "looserHost:789", 0L, (byte)1, 2), |
| | | newSet(201)); |
| | | newHashSet(201)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | | newHashSet(1)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "KwinnerHost:456", 0L, (byte)1, 1), |
| | | newSet(101)); |
| | | newHashSet(101)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | | newHashSet(1, 2)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "LwinnerHost:456", 0L, (byte)1, 1), |
| | | EMPTY_SET); |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "MwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | | newHashSet(1, 2)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 1), |
| | | EMPTY_SET); |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 3), |
| | | newSet(1, 2, 3, 4, 5, 6)); |
| | | newHashSet(1, 2, 3, 4, 5, 6)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "NwinnerHost:456", 0L, (byte)1, 4), |
| | | newSet(101, 102, 103, 104, 105, 106, 107, 108)); |
| | | newHashSet(101, 102, 103, 104, 105, 106, 107, 108)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "looserHost:789", 0L, (byte)1, 1), |
| | | newSet(201, 202)); |
| | | newHashSet(201, 202)); |
| | | put(rsInfos, |
| | | new RSInfo(14, "looserHost:1011", 0L, (byte)1, 2), |
| | | newSet(301, 302, 303, 304)); |
| | | newHashSet(301, 302, 303, 304)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 3), |
| | | newSet(1, 2, 3, 4)); |
| | | newHashSet(1, 2, 3, 4)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "OwinnerHost:456", 0L, (byte)1, 4), |
| | | newSet(101, 102, 103, 104, 105, 106, 107, 108)); |
| | | newHashSet(101, 102, 103, 104, 105, 106, 107, 108)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "looserHost:789", 0L, (byte)1, 1), |
| | | newSet(201, 202)); |
| | | newHashSet(201, 202)); |
| | | put(rsInfos, |
| | | new RSInfo(14, "looserHost:1011", 0L, (byte)1, 2), |
| | | newSet(301, 302, 303, 304, 305, 306)); |
| | | newHashSet(301, 302, 303, 304, 305, 306)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "PwinnerHost:123", 0L, (byte)1, 3), |
| | | newSet(1, 2, 3, 4)); |
| | | newHashSet(1, 2, 3, 4)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 4), |
| | | newSet(101, 102, 103, 104, 105, 106, 107, 108)); |
| | | newHashSet(101, 102, 103, 104, 105, 106, 107, 108)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "looserHost:789", 0L, (byte)1, 1), |
| | | newSet(201, 202)); |
| | | newHashSet(201, 202)); |
| | | put(rsInfos, |
| | | new RSInfo(14, "looserHost:1011", 0L, (byte)1, 2), |
| | | newSet(306, 305, 304, 303, 302, 301)); |
| | | newHashSet(306, 305, 304, 303, 302, 301)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 3), |
| | | newSet(1, 2, 3, 4)); |
| | | newHashSet(1, 2, 3, 4)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 4), |
| | | newSet(101, 102, 103, 104, 105, 106, 107, 108)); |
| | | newHashSet(101, 102, 103, 104, 105, 106, 107, 108)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "looserHost:789", 0L, (byte)1, 1), |
| | | newSet(201, 202)); |
| | | newHashSet(201, 202)); |
| | | put(rsInfos, |
| | | new RSInfo(14, "QwinnerHost:1011", 0L, (byte)1, 2), |
| | | newSet(306, 305, 304, 303, 302, 301)); |
| | | newHashSet(306, 305, 304, 303, 302, 301)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte) 1, 3), |
| | | newSet(1, 2, 3, 4)); |
| | | newHashSet(1, 2, 3, 4)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 4), |
| | | newSet(113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101)); |
| | | newHashSet(113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "looserHost:789", 0L, (byte)1, 1), |
| | | newSet(201, 202)); |
| | | newHashSet(201, 202)); |
| | | put(rsInfos, |
| | | new RSInfo(14, "looserHost:1011", 0L, (byte)1, 2), |
| | | newSet(301)); |
| | | newHashSet(301)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "RwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | | newHashSet(1, 2)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 1), |
| | | newSet(3)); |
| | | newHashSet(3)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "SwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | | newHashSet(1, 2)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 1), |
| | | newSet(3)); |
| | | newHashSet(3)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "TwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | | newHashSet(1, 2)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 1), |
| | | newSet(3)); |
| | | newHashSet(3)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "looserHost:789", 0L, (byte)1, 1), |
| | | newSet(4)); |
| | | newHashSet(4)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "UwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2, 3)); |
| | | newHashSet(1, 2, 3)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 1), |
| | | newSet(4, 5)); |
| | | newHashSet(4, 5)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "looserHost:789", 0L, (byte)1, 1), |
| | | newSet(6, 7)); |
| | | newHashSet(6, 7)); |
| | | |
| | | testData[idx++] = new Object[] { |
| | | rsInfos, |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | | newHashSet(1, 2)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 1), |
| | | newSet(3)); |
| | | newHashSet(3)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "VwinnerHost:789", 0L, (byte)1, 1), |
| | | EMPTY_SET); |
| | |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "WwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | | newHashSet(1, 2)); |
| | | put(rsInfos, |
| | | new RSInfo(12, "looserHost:456", 0L, (byte)1, 1), |
| | | newSet(3)); |
| | | newHashSet(3)); |
| | | put(rsInfos, |
| | | new RSInfo(13, "looserHost:789", 0L, (byte)1, 1), |
| | | EMPTY_SET); |
| | |
| | | import static java.util.Collections.*; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | |
| | | { |
| | | byte z = 0; |
| | | final RSInfo info = new RSInfo(rsServerId, rsServerId + ":1389", 0, z, 0); |
| | | return new ReplicationServerInfo(info, newSet(dsIds)); |
| | | return new ReplicationServerInfo(info, newHashSet(dsIds)); |
| | | } |
| | | |
| | | private Map<Integer, ReplicationServerInfo> newMap(ReplicationServerInfo... infos) |
| | |
| | | Map<Integer, ReplicationServerInfo> rsInfos, |
| | | ReplicationServerInfo rsInfo, Integer... connectedDSs) |
| | | { |
| | | return assertContainsRSWithDSs(rsInfos, rsInfo, newSet(connectedDSs)); |
| | | return assertContainsRSWithDSs(rsInfos, rsInfo, newHashSet(connectedDSs)); |
| | | } |
| | | |
| | | private ReplicationServerInfo assertContainsRSWithDSs( |
| | |
| | | public void topologyShouldContainRSWithoutOtherDS(TopologyCtorToUse toUse) |
| | | { |
| | | final Topology topo = newTopology(toUse, |
| | | newMap(OTHER_DS), newList(CURRENT_RS.toRSInfo()), |
| | | newMap(OTHER_DS), newArrayList(CURRENT_RS.toRSInfo()), |
| | | CURRENT_DS.getDsId(), CURRENT_RS.getServerId(), EMPTY_SET, EMPTY_MAP); |
| | | assertInvariants(topo); |
| | | assertThat(topo.rsInfos).hasSize(1); |
| | |
| | | public void topologyShouldContainRSWithAllDSs_buildWithTopologyMsg() |
| | | { |
| | | final Topology topo = newTopology(TopologyCtorToUse.BUILD_WITH_TOPOLOGY_MSG, |
| | | newMap(CURRENT_DS, OTHER_DS), newList(CURRENT_RS.toRSInfo()), |
| | | newMap(CURRENT_DS, OTHER_DS), newArrayList(CURRENT_RS.toRSInfo()), |
| | | CURRENT_DS.getDsId(), CURRENT_RS.getServerId(), EMPTY_SET, EMPTY_MAP); |
| | | assertInvariants(topo); |
| | | assertThat(topo.rsInfos).hasSize(1); |
| | |
| | | { |
| | | final Map<Integer, ReplicationServerInfo> previousRSs = newMap(CURRENT_RS); |
| | | final Topology topo = newTopology(toUse, |
| | | newMap(OTHER_DS), newList(CURRENT_RS.toRSInfo()), |
| | | newMap(OTHER_DS), newArrayList(CURRENT_RS.toRSInfo()), |
| | | CURRENT_DS.getDsId(), CURRENT_RS.getServerId(), EMPTY_SET, previousRSs); |
| | | assertInvariants(topo); |
| | | assertThat(topo.rsInfos).hasSize(1); |
| | |
| | | final ReplicationServerInfo CURRENT_RS_WITHOUT_DS = rsInfo(CURRENT_RS_ID); |
| | | final Map<Integer, ReplicationServerInfo> previousRSs = newMap(CURRENT_RS_WITHOUT_DS); |
| | | final Topology topo = newTopology(toUse, |
| | | newMap(OTHER_DS), newList(CURRENT_RS.toRSInfo()), |
| | | newMap(OTHER_DS), newArrayList(CURRENT_RS.toRSInfo()), |
| | | CURRENT_DS.getDsId(), CURRENT_RS.getServerId(), EMPTY_SET, previousRSs); |
| | | assertInvariants(topo); |
| | | assertThat(topo.rsInfos).hasSize(1); |
| | |
| | | { |
| | | final Map<Integer, ReplicationServerInfo> previousRSs = newMap(CURRENT_RS, MISSING_RS); |
| | | final Topology topo = newTopology(toUse, |
| | | newMap(OTHER_DS), newList(CURRENT_RS.toRSInfo()), |
| | | newMap(OTHER_DS), newArrayList(CURRENT_RS.toRSInfo()), |
| | | CURRENT_DS.getDsId(), CURRENT_RS.getServerId(), EMPTY_SET, previousRSs); |
| | | assertInvariants(topo); |
| | | assertThat(topo.rsInfos).hasSize(1); |
| | |
| | | @SuppressWarnings("unchecked") |
| | | public void topologyShouldHaveStampedLocallyConfiguredRSs_buildWithDsRsLists() |
| | | { |
| | | final Set<String> locallyConfigured = newSet(CURRENT_RS.getServerURL()); |
| | | final Set<String> locallyConfigured = newHashSet(CURRENT_RS.getServerURL()); |
| | | final Topology topo = newTopology(TopologyCtorToUse.BUILD_WITH_DS_RS_LISTS, |
| | | newMap(OTHER_DS), newList(CURRENT_RS.toRSInfo(), ANOTHER_RS.toRSInfo()), |
| | | newMap(OTHER_DS), newArrayList(CURRENT_RS.toRSInfo(), ANOTHER_RS.toRSInfo()), |
| | | CURRENT_DS.getDsId(), CURRENT_RS.getServerId(), locallyConfigured, EMPTY_MAP); |
| | | assertInvariants(topo); |
| | | assertThat(topo.rsInfos).hasSize(2); |
| | |
| | | assertThat(currentRS.isLocallyConfigured()).isTrue(); |
| | | assertThat(anotherRS.isLocallyConfigured()).isFalse(); |
| | | } |
| | | |
| | | } |
| | |
| | | package org.opends.server.replication.service; |
| | | |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | replServer2 = createReplicationServer(replServerID2, replServerPort2, |
| | | "ReplicationDomainTestDb2", 100, "localhost:" + replServerPort1); |
| | | |
| | | SortedSet<String> servers = newSortedSet("localhost:" + replServerPort1); |
| | | SortedSet<String> servers = newTreeSet("localhost:" + replServerPort1); |
| | | BlockingQueue<UpdateMsg> rcvQueue1 = new LinkedBlockingQueue<>(); |
| | | domain1 = new FakeReplicationDomain( |
| | | testService, domain1ServerId, servers, 100, 1000, rcvQueue1); |
| | | |
| | | SortedSet<String> servers2 = newSortedSet("localhost:" + replServerPort2); |
| | | SortedSet<String> servers2 = newTreeSet("localhost:" + replServerPort2); |
| | | BlockingQueue<UpdateMsg> rcvQueue2 = new LinkedBlockingQueue<>(); |
| | | domain2 = new FakeReplicationDomain( |
| | | testService, domain2ServerId, servers2, 100, 1000, rcvQueue2); |
| | |
| | | replServer1 = createReplicationServer(replServerID1, replServerPort, |
| | | "ReplicationDomainTestDb", 100000, "localhost:" + replServerPort); |
| | | |
| | | SortedSet<String> servers = newSortedSet("localhost:" + replServerPort); |
| | | SortedSet<String> servers = newTreeSet("localhost:" + replServerPort); |
| | | BlockingQueue<UpdateMsg> rcvQueue1 = new LinkedBlockingQueue<>(); |
| | | domain1 = new FakeReplicationDomain( |
| | | testService, domain1ServerId, servers, 1000, 100000, rcvQueue1); |
| | |
| | | |
| | | replServer = createReplicationServer(replServerID, replServerPort, |
| | | "exportAndImportData", 100); |
| | | SortedSet<String> servers = newSortedSet("localhost:" + replServerPort); |
| | | SortedSet<String> servers = newTreeSet("localhost:" + replServerPort); |
| | | |
| | | String exportedData = buildExportedData(ENTRYCOUNT); |
| | | domain1 = new FakeReplicationDomain( |
| | |
| | | replServer2 = createReplicationServer(replServerID2, replServerPort2, |
| | | "exportAndImportservice2", 100, "localhost:" + replServerPort1); |
| | | |
| | | SortedSet<String> servers1 = newSortedSet("localhost:" + replServerPort1); |
| | | SortedSet<String> servers2 = newSortedSet("localhost:" + replServerPort2); |
| | | SortedSet<String> servers1 = newTreeSet("localhost:" + replServerPort1); |
| | | SortedSet<String> servers2 = newTreeSet("localhost:" + replServerPort2); |
| | | |
| | | String exportedData = buildExportedData(ENTRYCOUNT); |
| | | domain1 = new FakeReplicationDomain( |
| | |
| | | try |
| | | { |
| | | SortedSet<String> servers = |
| | | newSortedSet(HOST1 + SENDERPORT, HOST2 + RECEIVERPORT); |
| | | newTreeSet(HOST1 + SENDERPORT, HOST2 + RECEIVERPORT); |
| | | |
| | | replServer = createReplicationServer(replServerID, SENDERPORT, |
| | | "ReplicationDomainTestDb", 100, servers); |
| | |
| | | try |
| | | { |
| | | SortedSet<String> servers = |
| | | newSortedSet(HOST1 + SENDERPORT, HOST2 + RECEIVERPORT); |
| | | newTreeSet(HOST1 + SENDERPORT, HOST2 + RECEIVERPORT); |
| | | |
| | | replServer = createReplicationServer(replServerID, RECEIVERPORT, |
| | | "ReplicationDomainTestDb", 100, servers); |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014 ForgeRock AS. |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaOptions.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | public class CoreSchemaProviderTestCase extends CoreTestCase |
| | |
| | | public void testDisableSyntax() throws Exception |
| | | { |
| | | CoreSchemaCfg coreSchemaCfg = ConfigurationMock.mockCfg(CoreSchemaCfg.class); |
| | | when(coreSchemaCfg.getDisabledSyntax()).thenReturn(newSortedSet(DIRECTORY_STRING_SYNTAX_OID)); |
| | | when(coreSchemaCfg.getDisabledSyntax()).thenReturn(newTreeSet(DIRECTORY_STRING_SYNTAX_OID)); |
| | | SchemaBuilder schemaBuilder = new SchemaBuilder(Schema.getCoreSchema()); |
| | | |
| | | CoreSchemaProvider provider = new CoreSchemaProvider(); |
| | |
| | | public void testDisableMatchingRule() throws Exception |
| | | { |
| | | CoreSchemaCfg coreSchemaCfg = ConfigurationMock.mockCfg(CoreSchemaCfg.class); |
| | | when(coreSchemaCfg.getDisabledMatchingRule()).thenReturn(newSortedSet(GENERALIZED_TIME_MATCHING_RULE_OID)); |
| | | when(coreSchemaCfg.getDisabledMatchingRule()).thenReturn(newTreeSet(GENERALIZED_TIME_MATCHING_RULE_OID)); |
| | | SchemaBuilder schemaBuilder = new SchemaBuilder(Schema.getCoreSchema()); |
| | | |
| | | CoreSchemaProvider provider = new CoreSchemaProvider(); |