From 30f529154749a0c79ce8e965886edff0c615b94e Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 13 Jul 2015 10:38:27 +0000
Subject: [PATCH] Inlined TestCaseUtils.new*() methods (superseded by CollectionUtils methods).
---
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2CountTest.java | 6
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java | 56 ++++----
opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationDomainTest.java | 17 +-
opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java | 16 --
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java | 5
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java | 6
opendj-server-legacy/src/test/java/org/opends/server/schema/CoreSchemaProviderTestCase.java | 8
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ControlsTestCase.java | 7
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java | 8
opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationBrokerTest.java | 21 +-
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java | 2
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java | 67 ++++----
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java | 8
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java | 3
opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java | 13 +
opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java | 111 +++++++--------
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java | 4
opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java | 3
opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java | 4
19 files changed, 175 insertions(+), 190 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java b/opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java
index ac129e3..a4b39de 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java
@@ -82,7 +82,6 @@
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.*;
@@ -1907,21 +1906,6 @@
"--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<>();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java
index 148e4d2..c2fea3b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java
@@ -724,7 +724,7 @@
{
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");
@@ -785,7 +785,7 @@
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);
@@ -905,7 +905,7 @@
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)
{
@@ -1161,7 +1161,7 @@
{
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
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ControlsTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ControlsTestCase.java
index fbb34d4..296c253 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ControlsTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ControlsTestCase.java
@@ -29,11 +29,10 @@
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;
@@ -132,7 +131,7 @@
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 });
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java
index 7ce0f6d..1a91334 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java
@@ -28,6 +28,7 @@
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;
@@ -320,17 +321,16 @@
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;
}
-
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2CountTest.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2CountTest.java
index 8d2cd76..2d60a78 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2CountTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2CountTest.java
@@ -28,6 +28,7 @@
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;
@@ -238,17 +239,16 @@
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;
}
-
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
index 8299a83..2897c9a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
@@ -29,11 +29,11 @@
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;
@@ -148,12 +148,12 @@
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);
@@ -992,7 +992,7 @@
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]);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java
index ecda7c1..43df905 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java
@@ -29,6 +29,7 @@
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;
@@ -188,13 +189,13 @@
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);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java
index a599938..e165693 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java
@@ -62,6 +62,7 @@
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.*;
@@ -421,7 +422,7 @@
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
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java
index 886da08..a8fe6a4 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java
@@ -77,9 +77,9 @@
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.*;
/**
@@ -243,7 +243,7 @@
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;
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
index dd44fe4..14976a6 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
@@ -51,6 +51,7 @@
import org.testng.annotations.Test;
import static org.opends.server.TestCaseUtils.*;
+import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
/**
@@ -365,7 +366,7 @@
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);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
index 1054bd9..ef7469c 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
@@ -77,7 +77,7 @@
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;
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java
index f66a5eec..5a940e0 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java
@@ -59,7 +59,7 @@
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.*;
/**
@@ -227,7 +227,7 @@
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);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
index 292d965..5f8c401 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
@@ -51,9 +51,9 @@
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.*;
@@ -168,7 +168,7 @@
// 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},
@@ -199,13 +199,13 @@
"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);
@@ -340,7 +340,7 @@
// 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},
@@ -448,11 +448,11 @@
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");
@@ -460,7 +460,7 @@
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++)
@@ -471,12 +471,12 @@
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 },
@@ -624,11 +624,11 @@
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");
@@ -636,7 +636,7 @@
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++)
@@ -648,7 +648,7 @@
// 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},
@@ -915,7 +915,7 @@
@DataProvider(name = "createoldAckMsgData")
public Object[][] createoldAckMsgData()
{
- List<Integer> fservers4 = newList(100, 2000, 30000);
+ List<Integer> fservers4 = newArrayList(100, 2000, 30000);
return new Object[][] {
{"05303030303031323366316535383832383030326430303030303037" +
@@ -969,16 +969,16 @@
@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)");
@@ -994,17 +994,17 @@
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" +
@@ -1014,9 +1014,9 @@
"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" +
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
index b94762e..103024b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
@@ -50,6 +50,7 @@
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.*;
@@ -90,11 +91,11 @@
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");
@@ -102,7 +103,7 @@
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++)
@@ -113,7 +114,7 @@
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[][] {
@@ -264,7 +265,7 @@
private List<Attribute> getEntryAttributes()
{
- return newList(
+ return newArrayList(
Attributes.create("description", "eav description"),
Attributes.create("namingcontexts", "eav naming contexts"));
}
@@ -327,11 +328,11 @@
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");
@@ -339,7 +340,7 @@
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++)
@@ -443,13 +444,13 @@
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);
@@ -555,10 +556,10 @@
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},
@@ -781,20 +782,20 @@
@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);
@@ -807,18 +808,18 @@
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},
@@ -876,9 +877,9 @@
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},
@@ -1174,12 +1175,12 @@
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);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java
index 28829c2..01e6b01 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java
@@ -59,6 +59,7 @@
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.*;
/**
@@ -320,7 +321,7 @@
{
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);
@@ -833,7 +834,7 @@
// 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();
@@ -908,7 +909,7 @@
// 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;
}
@@ -919,7 +920,7 @@
// 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;
}
@@ -930,7 +931,7 @@
// 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;
}
@@ -1389,7 +1390,7 @@
// Add each possible parameter as initial parameter lists
for (Object possibleParameter : possibleParameters)
{
- newObjectArrayList.add(newList(possibleParameter));
+ newObjectArrayList.add(newArrayList(possibleParameter));
}
return newObjectArrayList;
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java
index 65126c4..7553a0f 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java
@@ -48,7 +48,6 @@
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.*;
@@ -721,7 +720,7 @@
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);
@@ -745,10 +744,10 @@
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,
@@ -768,10 +767,10 @@
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,
@@ -791,10 +790,10 @@
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,
@@ -815,10 +814,10 @@
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,
@@ -839,10 +838,10 @@
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,
@@ -863,13 +862,13 @@
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,
@@ -889,13 +888,13 @@
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,
@@ -919,10 +918,10 @@
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,
@@ -942,7 +941,7 @@
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);
@@ -966,7 +965,7 @@
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);
@@ -990,16 +989,16 @@
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,
@@ -1023,16 +1022,16 @@
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,
@@ -1054,16 +1053,16 @@
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,
@@ -1085,16 +1084,16 @@
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,
@@ -1118,16 +1117,16 @@
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,
@@ -1151,10 +1150,10 @@
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,
@@ -1179,10 +1178,10 @@
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,
@@ -1205,13 +1204,13 @@
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,
@@ -1234,13 +1233,13 @@
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,
@@ -1261,10 +1260,10 @@
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);
@@ -1288,10 +1287,10 @@
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);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationBrokerTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationBrokerTest.java
index a19a1c1..ff2cbb4 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationBrokerTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationBrokerTest.java
@@ -39,7 +39,7 @@
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")
@@ -75,7 +75,7 @@
{
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)
@@ -101,7 +101,7 @@
Map<Integer, ReplicationServerInfo> rsInfos,
ReplicationServerInfo rsInfo, Integer... connectedDSs)
{
- return assertContainsRSWithDSs(rsInfos, rsInfo, newSet(connectedDSs));
+ return assertContainsRSWithDSs(rsInfos, rsInfo, newHashSet(connectedDSs));
}
private ReplicationServerInfo assertContainsRSWithDSs(
@@ -187,7 +187,7 @@
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);
@@ -199,7 +199,7 @@
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);
@@ -212,7 +212,7 @@
{
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);
@@ -226,7 +226,7 @@
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);
@@ -239,7 +239,7 @@
{
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);
@@ -250,9 +250,9 @@
@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);
@@ -263,5 +263,4 @@
assertThat(currentRS.isLocallyConfigured()).isTrue();
assertThat(anotherRS.isLocallyConfigured()).isFalse();
}
-
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationDomainTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationDomainTest.java
index cd799b9..2c012cc 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationDomainTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationDomainTest.java
@@ -27,7 +27,6 @@
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.*;
@@ -103,12 +102,12 @@
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);
@@ -260,7 +259,7 @@
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);
@@ -354,7 +353,7 @@
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(
@@ -419,8 +418,8 @@
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(
@@ -515,7 +514,7 @@
try
{
SortedSet<String> servers =
- newSortedSet(HOST1 + SENDERPORT, HOST2 + RECEIVERPORT);
+ newTreeSet(HOST1 + SENDERPORT, HOST2 + RECEIVERPORT);
replServer = createReplicationServer(replServerID, SENDERPORT,
"ReplicationDomainTestDb", 100, servers);
@@ -548,7 +547,7 @@
try
{
SortedSet<String> servers =
- newSortedSet(HOST1 + SENDERPORT, HOST2 + RECEIVERPORT);
+ newTreeSet(HOST1 + SENDERPORT, HOST2 + RECEIVERPORT);
replServer = createReplicationServer(replServerID, RECEIVERPORT,
"ReplicationDomainTestDb", 100, servers);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/schema/CoreSchemaProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/schema/CoreSchemaProviderTestCase.java
index f543d9a..6696e11 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/schema/CoreSchemaProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/schema/CoreSchemaProviderTestCase.java
@@ -21,7 +21,7 @@
* CDDL HEADER END
*
*
- * Copyright 2014 ForgeRock AS.
+ * Copyright 2014-2015 ForgeRock AS.
*/
package org.opends.server.schema;
@@ -35,7 +35,7 @@
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
@@ -71,7 +71,7 @@
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();
@@ -84,7 +84,7 @@
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();
--
Gitblit v1.10.0