+/*
+ * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.controller.cluster.datastore.node.utils;
+import com.google.common.collect.ImmutableSet;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.util.TestModel;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-
import static junit.framework.TestCase.assertEquals;
public class PathUtilsTest {
- @Test
- public void getParentPath(){
- assertEquals("", PathUtils.getParentPath("foobar"));
- assertEquals("", PathUtils.getParentPath("/a"));
- assertEquals("/a", PathUtils.getParentPath("/a/b"));
- assertEquals("/a/b", PathUtils.getParentPath("/a/b/c"));
- assertEquals("/a/b", PathUtils.getParentPath("a/b/c"));
- }
-
@Test
public void toStringNodeIdentifier(){
YangInstanceIdentifier.PathArgument pathArgument = nodeIdentifier();
}
- private YangInstanceIdentifier.NodeIdentifier nodeIdentifier(){
+ private static YangInstanceIdentifier.NodeIdentifier nodeIdentifier(){
return new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME);
}
- private YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier(){
- Set<QName> childNames = new HashSet();
- childNames.add(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics"));
+ private static YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier(){
+ Set<QName> childNames = ImmutableSet.of(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics"));
return new YangInstanceIdentifier.AugmentationIdentifier(childNames);
}
- private YangInstanceIdentifier.NodeWithValue nodeWithValue(){
+ private static YangInstanceIdentifier.NodeWithValue nodeWithValue(){
return new YangInstanceIdentifier.NodeWithValue(TestModel.TEST_QNAME, Integer.valueOf(100));
}
- private YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates(){
+ private static YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates(){
Map<QName, Object> keys = new HashMap<>();
keys.put(TestModel.ID_QNAME, Integer.valueOf(100));