package org.opendaylight.controller.sal.packet;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.controller.liblldp.BitBufferHelper;
package org.opendaylight.controller.config.persist.storage.file.xml;
-import static junit.framework.Assert.assertFalse;
+import static org.junit.Assert.assertFalse;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-
+import com.google.common.base.Charsets;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
-
-import junit.framework.Assert;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
import org.opendaylight.controller.config.persist.test.PropertiesProviderTest;
-import com.google.common.base.Charsets;
-
public class FileStorageAdapterTest {
private static int i;
@Before
public void setUp() throws Exception {
file = Files.createTempFile("testFilePersist", ".txt").toFile();
- if (!file.exists())
+ if (!file.exists()) {
return;
+ }
com.google.common.io.Files.write("", file, Charsets.UTF_8);
i = 1;
}
storage.persistConfig(holder);
- Assert.assertEquals(storage.toString().replace("\\","/"),"XmlFileStorageAdapter [storage="+NON_EXISTENT_DIRECTORY+NON_EXISTENT_FILE+"]");
+ assertEquals(storage.toString().replace("\\","/"),"XmlFileStorageAdapter [storage="+NON_EXISTENT_DIRECTORY+NON_EXISTENT_FILE+"]");
delete(new File(NON_EXISTENT_DIRECTORY));
}
@Test
storage.setNumberOfBackups(Integer.MAX_VALUE);
List<ConfigSnapshotHolder> last = storage.loadLastConfigs();
- Assert.assertEquals(createCaps(), last.get(0).getCapabilities());
+ assertEquals(createCaps(), last.get(0).getCapabilities());
}
private SortedSet<String> createCaps() {
@Test
public void testNoLastConfig() throws Exception {
File file = Files.createTempFile("testFilePersist", ".txt").toFile();
- if (!file.exists())
+ if (!file.exists()) {
return;
+ }
XmlFileStorageAdapter storage = new XmlFileStorageAdapter();
storage.setFileStorage(file);
return "<config>" + i++ + "</config>";
}
- private void delete(File f) throws IOException {
+ private void delete(final File f) throws IOException {
if (f.isDirectory()) {
- for (File c : f.listFiles())
+ for (File c : f.listFiles()) {
delete(c);
+ }
}
- if (!f.delete())
+ if (!f.delete()) {
throw new FileNotFoundException("Failed to delete file: " + f);
+ }
}
}
*/
package org.opendaylight.controller.config.yang.netty.timer;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.ObjectName;
-
-import junit.framework.Assert;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.api.ConflictingVersionException;
try {
createInstance(transaction, instanceName, 0L, 10, true);
transaction.validateConfig();
- Assert.fail();
+ fail();
} catch (ValidationException e) {
- Assert.assertTrue(e.getMessage().contains("TickDuration value must be greater than 0"));
+ assertTrue(e.getMessage().contains("TickDuration value must be greater than 0"));
}
}
try {
createInstance(transaction, instanceName, 500L, 0, true);
transaction.validateConfig();
- Assert.fail();
+ fail();
} catch (ValidationException e) {
- Assert.assertTrue(e.getMessage().contains("TicksPerWheel value must be greater than 0"));
+ assertTrue(e.getMessage().contains("TicksPerWheel value must be greater than 0"));
}
}
assertStatus(status, 0, 1, 1);
}
- private ObjectName createInstance(ConfigTransactionJMXClient transaction, String instanceName,
+ private ObjectName createInstance(final ConfigTransactionJMXClient transaction, final String instanceName,
final Long tickDuration, final Integer ticksPerWheel, final boolean hasThreadfactory)
throws InstanceAlreadyExistsException {
ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
return nameCreated;
}
- private ObjectName createThreadfactoryInstance(ConfigTransactionJMXClient transaction, String instanceName,
+ private ObjectName createThreadfactoryInstance(final ConfigTransactionJMXClient transaction, final String instanceName,
final String namePrefix) throws InstanceAlreadyExistsException {
ObjectName nameCreated = transaction.createModule(threadFactory.getImplementationName(), instanceName);
NamingThreadFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
*/
package org.opendaylight.controller.config.yangjmxgenerator.plugin;
+import static org.junit.Assert.assertEquals;
import java.io.File;
-
-import junit.framework.Assert;
-
import org.junit.Test;
public class JMXGeneratorGeneratedFilesTrackerTest {
JMXGenerator.GeneratedFilesTracker tracker = new JMXGenerator.GeneratedFilesTracker();
tracker.addFile(new File("./a/b/c"));
- Assert.assertEquals(1, tracker.getFiles().size());
+ assertEquals(1, tracker.getFiles().size());
tracker.addFile(new File("./a/b/c"));
}
}
*/
package org.opendaylight.controller.config.yangjmxgenerator;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.format;
+import static org.junit.Assert.assertNotNull;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
QName qName = identitySchemaNode.getQName();
Preconditions.checkArgument(
result.containsKey(qName) == false,
- format("Two identities of %s contain same " + "qname %s",
- module, qName));
+ "Two identities of %s contain same qname %s",
+ module, qName);
result.put(qName, identitySchemaNode);
}
return result;
*/
package org.opendaylight.controller.config.yangjmxgenerator;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
import com.google.common.collect.Lists;
-import junit.framework.Assert;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.api.IdentityAttributeRef;
List<ObjectName> testingDeps = proxy.getTestingDeps();
ObjectName testingDep = proxy.getTestingDep();
- Assert.assertEquals(TESTING_DEP_PREFIX, ObjectNameUtil.getInstanceName(testingDep));
+ assertEquals(TESTING_DEP_PREFIX, ObjectNameUtil.getInstanceName(testingDep));
assertTestingDeps(testingDeps, 4);
transaction.abortConfig();
}
private void assertTestingDeps(List<ObjectName> testingDeps, int i) {
- Assert.assertEquals(i, testingDeps.size());
+ assertEquals(i, testingDeps.size());
int c = 1;
for (ObjectName testingDep : testingDeps) {
- Assert.assertEquals(TESTING_DEP_PREFIX + Integer.toString(c++), ObjectNameUtil.getInstanceName(testingDep));
+ assertEquals(TESTING_DEP_PREFIX + Integer.toString(c++), ObjectNameUtil.getInstanceName(testingDep));
}
}
*/
package org.opendaylight.controller.sal.compatibility.test;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.controller.sal.action.Action;
import org.opendaylight.controller.sal.action.PushVlan;
import java.util.Collections;
import java.util.List;
-import junit.framework.Assert;
-
import org.junit.Test;
import org.opendaylight.controller.sal.action.Flood;
import org.opendaylight.controller.sal.action.FloodAll;
public void testFromNodeConnectorRef() throws ConstructionException {
Node node = new Node(NodeIDType.OPENFLOW, 42L);
NodeConnector nodeConnector = ToSalConversionsUtils.fromNodeConnectorRef(new Uri("1"), node);
- Assert.assertEquals("OF|1@OF|00:00:00:00:00:00:00:2a", nodeConnector.toString());
+ assertEquals("OF|1@OF|00:00:00:00:00:00:00:2a", nodeConnector.toString());
}
private void checkSalMatch(org.opendaylight.controller.sal.match.Match match, MtchType mt) throws ConstructionException {
*/
package org.opendaylight.controller.sal.compatibility.topology.test;
-import junit.framework.Assert;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.opendaylight.controller.sal.compatibility.topology.TopologyMapping;
NodeId nodeId = new NodeId("openflow:1");
String observedNodeId = TopologyMapping.toADNodeId(nodeId);
- Assert.assertEquals("1", observedNodeId);
+ assertEquals("1", observedNodeId);
}
/**
TpId source = new TpId("foo:2");
NodeConnector observedNodeConnector = TopologyMapping.toADNodeConnector(source, nodeId);
- Assert.assertEquals("OF|2@OF|00:00:00:00:00:00:00:01", observedNodeConnector.toString());
+ assertEquals("OF|2@OF|00:00:00:00:00:00:00:01", observedNodeConnector.toString());
}
/**
TpId source = new TpId("foo:2");
String observedNodeConnectorId = TopologyMapping.toADNodeConnectorId(source);
- Assert.assertEquals("2", observedNodeConnectorId);
+ assertEquals("2", observedNodeConnectorId);
}
/**
NodeId nodeId = new NodeId("openflow:1");
Node observedNode = TopologyMapping.toADNode(nodeId);
- Assert.assertEquals("OF|00:00:00:00:00:00:00:01", observedNode.toString());
+ assertEquals("OF|00:00:00:00:00:00:00:01", observedNode.toString());
}
/**
TpId source = new TpId("192.168.0.1");
NodeConnector observedNodeConnector = TopologyMapping.toADNodeConnector(source, nodeId);
- Assert.assertEquals("MD_SAL_DEPRECATED|192.168.0.1@MD_SAL_DEPRECATED|some_unknown_node", observedNodeConnector.toString());
+ assertEquals("MD_SAL_DEPRECATED|192.168.0.1@MD_SAL_DEPRECATED|some_unknown_node", observedNodeConnector.toString());
}
}
import akka.actor.ActorRef;
import akka.actor.Props;
import akka.testkit.JavaTestKit;
-import junit.framework.Assert;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl;
import akka.actor.Props;
import akka.testkit.JavaTestKit;
import com.google.protobuf.ByteString;
-import junit.framework.Assert;
import org.junit.Test;
import org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl;
import org.opendaylight.controller.cluster.raft.MockRaftActorContext;
RaftActorBehavior raftBehavior =
follower.handleMessage(followerActor, new ElectionTimeout());
- Assert.assertTrue(raftBehavior instanceof Candidate);
+ assertTrue(raftBehavior instanceof Candidate);
}
@Test
*/
package org.opendaylight.controller.sal.binding.test;
-import junit.framework.Assert;
-
-
+import static org.junit.Assert.assertNotNull;
import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.Augmentation;
public static <T extends Augmentable<T>> void assertHasAugmentation(T object,
Class<? extends Augmentation<T>> augmentation) {
- Assert.assertNotNull(object);
- Assert.assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", object.getAugmentation(augmentation));
+ assertNotNull(object);
+ assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", object.getAugmentation(augmentation));
}
public static <T extends Augmentable<T>> AugmentationVerifier<T> from(T obj) {
*/
package org.opendaylight.controller.sal.binding.test.connect.dom;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNotSame;
-import static junit.framework.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import java.util.Collections;
*/
package org.opendaylight.controller.sal.binding.test.connect.dom;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.fail;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.InputStream;
import java.util.Collections;
*/
package org.opendaylight.controller.sal.binding.test.connect.dom;
-import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertNotNull;
import java.util.concurrent.Future;
import java.util.List;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class NormalizedNodeToNodeCodecTest {
package org.opendaylight.controller.cluster.datastore.node.utils;
-import junit.framework.Assert;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
NodeIdentifierFactory
.getArgument("AugmentationIdentifier{childNames=[(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics]}");
- Assert
- .assertTrue(argument instanceof YangInstanceIdentifier.AugmentationIdentifier);
+ assertTrue(argument instanceof YangInstanceIdentifier.AugmentationIdentifier);
}
import org.opendaylight.controller.cluster.datastore.util.TestModel;
import org.opendaylight.yangtools.yang.common.QName;
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.TestCase.assertEquals;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
public class QNameFactoryTest {
package org.opendaylight.controller.xml.codec;
-
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.io.ByteSource;
-import junit.framework.Assert;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-
public class XmlUtilsTest {
private static final DocumentBuilderFactory BUILDERFACTORY;
package org.opendaylight.controller.sal.dom.broker;
-import static junit.framework.Assert.fail;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
package org.opendaylight.controller.sal.connect.netconf;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import java.util.Collections;
import java.util.List;
import java.util.Set;
-
import javax.xml.parsers.DocumentBuilderFactory;
import org.junit.Before;
import org.junit.Test;
package org.opendaylight.controller.sal.connect.netconf;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import java.util.Collections;
package org.opendaylight.controller.sal.connect.netconf.sal.tx;
-import static junit.framework.Assert.fail;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
package org.opendaylight.controller.remote.rpc.utils;
-
+import static org.junit.Assert.assertTrue;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.japi.Pair;
import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import com.typesafe.config.ConfigFactory;
-import junit.framework.Assert;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
-
public class LatestEntryRoutingLogicTest {
static ActorSystem system;
pairList.add(new Pair<ActorRef, Long>(actor2, 3000L));
pairList.add(new Pair<ActorRef, Long>(actor3, 2000L));
RoutingLogic logic = new LatestEntryRoutingLogic(pairList);
- Assert.assertTrue(logic.select().equals(actor2));
+ assertTrue(logic.select().equals(actor2));
}
}
import java.util.Set;
import java.util.TreeSet;
import javax.ws.rs.core.UriInfo;
-import junit.framework.Assert;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.After;
if (m.getKey().getAbsolutePath().endsWith("toaster.yang")) {
ApiDeclaration doc = generator.getSwaggerDocSpec(m.getValue(), "http://localhost:8080/restconf", "",
schemaContext);
- Assert.assertNotNull(doc);
+ assertNotNull(doc);
// testing bugs.opendaylight.org bug 1290. UnionType model type.
String jsonString = doc.getModels().toString();
*/
package org.opendaylight.controller.netconf.impl;
-import junit.framework.Assert;
-
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader;
public void testParsing() throws Exception {
String s = "[netconf;10.12.0.102:48528;ssh;;;;;;]";
NetconfHelloMessageAdditionalHeader header = NetconfHelloMessageAdditionalHeader.fromString(s);
- Assert.assertEquals("netconf", header.getUserName());
- Assert.assertEquals("10.12.0.102", header.getAddress());
- Assert.assertEquals("ssh", header.getTransport());
+ assertEquals("netconf", header.getUserName());
+ assertEquals("10.12.0.102", header.getAddress());
+ assertEquals("ssh", header.getTransport());
}
@Test
public void testParsing2() throws Exception {
String s = "[tomas;10.0.0.0/10000;tcp;1000;1000;;/home/tomas;;]";
NetconfHelloMessageAdditionalHeader header = NetconfHelloMessageAdditionalHeader.fromString(s);
- Assert.assertEquals("tomas", header.getUserName());
- Assert.assertEquals("10.0.0.0", header.getAddress());
- Assert.assertEquals("tcp", header.getTransport());
+ assertEquals("tomas", header.getUserName());
+ assertEquals("10.0.0.0", header.getAddress());
+ assertEquals("tcp", header.getTransport());
}
@Test(expected = IllegalArgumentException.class)
*/
package org.opendaylight.controller.netconf.impl;
-import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.opendaylight.controller.netconf.api.NetconfMessage;
package org.opendaylight.controller.netconf.impl.mapping.operations;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
import com.google.common.base.Optional;
-import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
import org.opendaylight.controller.netconf.util.xml.XmlUtil;
import org.w3c.dom.Document;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-
public class DefaultGetSchemaTest {
private CapabilityProvider cap;
*/
package org.opendaylight.controller.netconf.it;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doAnswer;
*/
package org.opendaylight.controller.northbound.bundlescanner.internal;
-
-
import java.io.File;
import java.io.FileFilter;
import java.net.MalformedURLException;
import org.springframework.osgi.mock.MockBundle;
import org.springframework.osgi.mock.MockBundleContext;
-import static junit.framework.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class BundleScannerTest {
*/
package org.opendaylight.controller.topology.northbound;
-
-
import org.junit.Test;
import org.opendaylight.controller.sal.core.Bandwidth;
import org.opendaylight.controller.sal.core.ConstructionException;
import java.util.List;
import java.util.Set;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
public class TopologyTest {