Use commons-lang3 instead, as it provides better interface anyway.
Change-Id: I8574166cf77f8f40c9a2ada4b06cc0d8b14244a9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
</dependency>
<!-- Testing dependencies -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>mockito-configuration</artifactId>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-testkit_2.13</artifactId>
</dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThrows;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.access.ABIVersion;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
import static java.util.Objects.requireNonNull;
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.eclipse.jdt.annotation.NonNull;
import org.junit.Test;
import org.opendaylight.controller.cluster.access.ABIVersion;
import static java.util.Objects.requireNonNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Before;
import org.junit.Test;
import akka.serialization.JavaSerializer;
import akka.testkit.TestProbe;
import com.google.common.base.MoreObjects;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.cluster.access.ABIVersion;
import java.io.DataInput;
import java.io.IOException;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
<artifactId>commons-io</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.raft.RaftVersions;
import java.util.Iterator;
import java.util.List;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.raft.MockRaftActorContext.MockPayload;
import org.opendaylight.controller.cluster.raft.RaftVersions;
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.raft.RaftVersions;
import org.opendaylight.controller.cluster.raft.persisted.ServerConfigurationPayload;
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import static org.junit.Assert.assertTrue;
import java.util.List;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.raft.MockRaftActorContext;
import static org.junit.Assert.assertEquals;
import java.util.List;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.raft.MockRaftActorContext.MockPayload;
import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.Option;
final Class<?> ofType;
WriteMessagesComplete(final int count, final Class<?> ofType) {
- this.latch = new CountDownLatch(count);
+ latch = new CountDownLatch(count);
this.ofType = ofType;
}
}
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
</dependency>
<!-- Apache -->
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
@Test
public void testSerialization() {
AbortSlicing expected = new AbortSlicing(new StringIdentifier("test"));
- AbortSlicing cloned = (AbortSlicing) SerializationUtils.clone(expected);
+ AbortSlicing cloned = SerializationUtils.clone(expected);
assertEquals("getIdentifier", expected.getIdentifier(), cloned.getIdentifier());
}
}
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
@Test
public void testSerialization() {
MessageSliceIdentifier expected = new MessageSliceIdentifier(new StringIdentifier("test"), 123L);
- MessageSliceIdentifier cloned = (MessageSliceIdentifier) SerializationUtils.clone(expected);
+ MessageSliceIdentifier cloned = SerializationUtils.clone(expected);
assertEquals("cloned", expected, cloned);
assertEquals("getClientIdentifier", expected.getClientIdentifier(), cloned.getClientIdentifier());
assertEquals("getSlicerId", expected.getSlicerId(), cloned.getSlicerId());
import akka.serialization.JavaSerializer;
import akka.testkit.TestProbe;
import akka.testkit.javadsl.TestKit;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
private void testSuccess() {
MessageSliceReply expected = MessageSliceReply.success(new StringIdentifier("test"), 3,
TestProbe.apply(actorSystem).ref());
- MessageSliceReply cloned = (MessageSliceReply) SerializationUtils.clone(expected);
+ MessageSliceReply cloned = SerializationUtils.clone(expected);
assertEquals("getIdentifier", expected.getIdentifier(), cloned.getIdentifier());
assertEquals("getSliceIndex", expected.getSliceIndex(), cloned.getSliceIndex());
private void testFailure() {
MessageSliceReply expected = MessageSliceReply.failed(new StringIdentifier("test"),
new MessageSliceException("mock", true), TestProbe.apply(actorSystem).ref());
- MessageSliceReply cloned = (MessageSliceReply) SerializationUtils.clone(expected);
+ MessageSliceReply cloned = SerializationUtils.clone(expected);
assertEquals("getIdentifier", expected.getIdentifier(), cloned.getIdentifier());
assertEquals("getSliceIndex", expected.getSliceIndex(), cloned.getSliceIndex());
import akka.serialization.JavaSerializer;
import akka.testkit.TestProbe;
import akka.testkit.javadsl.TestKit;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@After
public void tearDown() {
- TestKit.shutdownActorSystem(actorSystem, Boolean.TRUE);
+ TestKit.shutdownActorSystem(actorSystem, true);
}
@Test
MessageSlice expected = new MessageSlice(new StringIdentifier("test"), data, 2, 3, 54321,
TestProbe.apply(actorSystem).ref());
- MessageSlice cloned = (MessageSlice) SerializationUtils.clone(expected);
+ MessageSlice cloned = SerializationUtils.clone(expected);
assertEquals("getIdentifier", expected.getIdentifier(), cloned.getIdentifier());
assertEquals("getSliceIndex", expected.getSliceIndex(), cloned.getSliceIndex());
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
<artifactId>commons-io</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-test-util</artifactId>
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.cluster.datastore.MockIdentifiers;
import java.io.Serializable;
import java.util.Optional;
import java.util.SortedSet;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.controller.cluster.datastore.AbstractTest;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
CanCommitTransactionReply.class);
}
- private static void testSerialization(CanCommitTransactionReply expected, Class<?> expSerialized) {
+ private static void testSerialization(final CanCommitTransactionReply expected, final Class<?> expSerialized) {
Object serialized = expected.toSerializable();
assertEquals("Serialized type", expSerialized, serialized.getClass());
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.AbstractTest;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.AbstractTest;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import static org.junit.Assert.assertEquals;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.AbstractTest;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.AbstractTest;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.AbstractTest;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import static org.junit.Assert.assertEquals;
import java.io.Serializable;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import static org.junit.Assert.assertEquals;
import java.util.Optional;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
DeleteModification expected = new DeleteModification(path);
- DeleteModification clone = (DeleteModification) SerializationUtils.clone(expected);
+ DeleteModification clone = SerializationUtils.clone(expected);
assertEquals("getPath", expected.getPath(), clone.getPath());
}
}
import static org.junit.Assert.assertEquals;
import java.util.Optional;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
.withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo"))
.build());
- MergeModification clone = (MergeModification) SerializationUtils.clone(expected);
+ MergeModification clone = SerializationUtils.clone(expected);
assertEquals("getPath", expected.getPath(), clone.getPath());
assertEquals("getData", expected.getData(), clone.getData());
}
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import static org.junit.Assert.assertEquals;
import java.util.Optional;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
.withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo"))
.build());
- WriteModification clone = (WriteModification) SerializationUtils.clone(expected);
+ WriteModification clone = SerializationUtils.clone(expected);
assertEquals("getPath", expected.getPath(), clone.getPath());
assertEquals("getData", expected.getData(), clone.getData());
}
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
/**
public void testSerialization() {
ShardManagerSnapshot expected =
new ShardManagerSnapshot(Arrays.asList("shard1", "shard2"));
- ShardManagerSnapshot cloned = (ShardManagerSnapshot) SerializationUtils.clone(expected);
+ ShardManagerSnapshot cloned = SerializationUtils.clone(expected);
assertEquals("getShardList", expected.getShardList(), cloned.getShardList());
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
.build();
ShardSnapshotState expected = new ShardSnapshotState(new MetadataShardDataTreeSnapshot(expectedNode));
- ShardSnapshotState cloned = (ShardSnapshotState) SerializationUtils.clone(expected);
+ ShardSnapshotState cloned = SerializationUtils.clone(expected);
assertNotNull("getSnapshot is null", cloned.getSnapshot());
assertEquals("getSnapshot type", MetadataShardDataTreeSnapshot.class, cloned.getSnapshot().getClass());
<type>test-jar</type>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
import static org.junit.Assert.assertEquals;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.remote.rpc.AbstractOpsTest;
ExecuteRpc expected = ExecuteRpc.from(AbstractOpsTest.TEST_RPC_ID,
AbstractOpsTest.makeRPCInput("serialization-test"));
- ExecuteRpc actual = (ExecuteRpc) SerializationUtils.clone(expected);
+ ExecuteRpc actual = SerializationUtils.clone(expected);
assertEquals("getName", expected.getType(), actual.getType());
assertEquals("getInputNormalizedNode", expected.getInput(), actual.getInput());
import java.util.Collections;
import java.util.Optional;
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
import org.opendaylight.controller.remote.rpc.AbstractOpsTest;
ActionResponse expectedAction = new ActionResponse(
Optional.of(AbstractOpsTest.makeRPCOutput("serialization-test")), Collections.emptyList());
- RpcResponse actualRpc = (RpcResponse) SerializationUtils.clone(expectedRpc);
+ RpcResponse actualRpc = SerializationUtils.clone(expectedRpc);
- ActionResponse actualAction = (ActionResponse) SerializationUtils.clone(expectedAction);
+ ActionResponse actualAction = SerializationUtils.clone(expectedAction);
assertEquals("getResultNormalizedNode", expectedRpc.getOutput(),
actualRpc.getOutput());