Merge "Arranged the config so that its obvious how to enable the ClusteredDataStorePr...
authorAlessandro Boch <aboch@cisco.com>
Thu, 5 Dec 2013 23:09:02 +0000 (23:09 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 5 Dec 2013 23:09:02 +0000 (23:09 +0000)
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/forwardingrulesmanager/consumer/impl/GroupConsumerImpl.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/forwardingrulesmanager/consumer/impl/MeterConsumerImpl.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/DummyRpcResult.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/ToJsonChoiceCaseTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/ToJsonIdentityrefTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/ToJsonLeafrefType.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/XmlProvidersTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/YangAndXmlAndDataSchemaLoader.java [new file with mode: 0644]
opendaylight/netconf/netconf-ssh/pom.xml

index 7d16cb5b428452dfa25e110ebbc7ad795c298a18..d28e8e1fd18994979d211821680eb2ff7339eec9 100644 (file)
@@ -39,6 +39,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.Sal
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.Buckets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
@@ -269,6 +270,7 @@ public class GroupConsumerImpl implements IForwardingRulesManager {
         
         UpdateGroupInputBuilder groupData = new UpdateGroupInputBuilder();
         updateGroupBuilder = new UpdatedGroupBuilder();
+        updateGroupBuilder.setGroupId(new GroupId(groupUpdateDataObject.getId()));
         updateGroupBuilder.fieldsFrom(groupUpdateDataObject);
         groupData.setUpdatedGroup(updateGroupBuilder.build());        
         groupService.updateGroup(groupData.build());
@@ -293,7 +295,7 @@ public class GroupConsumerImpl implements IForwardingRulesManager {
         AddGroupInputBuilder groupData = new AddGroupInputBuilder();
         groupData.setBuckets(groupAddDataObject.getBuckets());
         groupData.setContainerName(groupAddDataObject.getContainerName());
-        groupData.setGroupId(groupAddDataObject.getGroupId());
+        groupData.setGroupId(new GroupId(groupAddDataObject.getId()));
         groupData.setGroupType(groupAddDataObject.getGroupType());
         groupData.setNode(groupAddDataObject.getNode());    
         groupService.addGroup(groupData.build());
@@ -318,7 +320,7 @@ public class GroupConsumerImpl implements IForwardingRulesManager {
         RemoveGroupInputBuilder groupData = new RemoveGroupInputBuilder();
         groupData.setBuckets(groupRemoveDataObject.getBuckets());
         groupData.setContainerName(groupRemoveDataObject.getContainerName());
-        groupData.setGroupId(groupRemoveDataObject.getGroupId());
+        groupData.setGroupId(new GroupId(groupRemoveDataObject.getId()));
         groupData.setGroupType(groupRemoveDataObject.getGroupType());
         groupData.setNode(groupRemoveDataObject.getNode());    
         groupService.removeGroup(groupData.build());  
@@ -336,7 +338,7 @@ public class GroupConsumerImpl implements IForwardingRulesManager {
 
         for (Entry<InstanceIdentifier<?>, Group> entry : transaction.updates.entrySet()) {
 
-            if (!updateGroup(entry.getKey(), entry.getValue()).isSuccess()) {
+            if (!addGroup(entry.getKey(), entry.getValue()).isSuccess()) {
                 transaction.updates.remove(entry.getKey());
                 return Rpcs.getRpcResult(false, null, Collections.<RpcError>emptySet());
             }
index aa9d572d79724b27031b3aaa31193ec6d9d2577c..42d0897fb11ae85182f6a87e83f3015e191f716c 100644 (file)
@@ -242,6 +242,8 @@ public class MeterConsumerImpl implements IForwardingRulesManager {
         if (null != meterKey && validateMeter(meterUpdateDataObject, FRMUtil.operation.UPDATE).isSuccess()) {                UpdateMeterInputBuilder updateMeterInputBuilder = new UpdateMeterInputBuilder();
             updateMeterBuilder = new UpdatedMeterBuilder();
             updateMeterBuilder.fieldsFrom(meterUpdateDataObject);
+            updateMeterBuilder.setMeterId(new MeterId(meterUpdateDataObject.getId()));
+            
             updateMeterInputBuilder.setUpdatedMeter(updateMeterBuilder.build());
             meterService.updateMeter(updateMeterInputBuilder.build());
         } else {
@@ -267,7 +269,7 @@ public class MeterConsumerImpl implements IForwardingRulesManager {
             meterBuilder.setNode(meterRemoveDataObject.getNode());
             meterBuilder.setFlags(meterRemoveDataObject.getFlags());
             meterBuilder.setMeterBandHeaders(meterRemoveDataObject.getMeterBandHeaders());
-            meterBuilder.setMeterId(meterRemoveDataObject.getMeterId());
+            meterBuilder.setMeterId(new MeterId(meterRemoveDataObject.getId()));
             meterBuilder.setNode(meterRemoveDataObject.getNode());        
             meterService.removeMeter(meterBuilder.build());
         } else {
index 5ab4f99fdc07a20c78d65343b1b2dba0f3afd210..7f23776a84bf903171ce1df059b1976d5ba12c2a 100644 (file)
@@ -2,31 +2,25 @@ package org.opendaylight.controller.sal.restconf.impl.test;
 
 import java.util.Collection;
 
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.*;
+
+public class DummyRpcResult<T> implements RpcResult<T> {
 
-public class DummyRpcResult implements RpcResult<TransactionStatus> {
-    
     private final boolean isSuccessful;
-    private final TransactionStatus result;
+    private final T result;
     private final Collection<RpcError> errors;
-    
+
     public DummyRpcResult() {
         isSuccessful = false;
         result = null;
         errors = null;
     }
-    
-    private DummyRpcResult(Builder builder) {
+
+    private DummyRpcResult(Builder<T> builder) {
         isSuccessful = builder.isSuccessful;
         result = builder.result;
         errors = builder.errors;
     }
-    
-    public static Builder builder() {
-        return new DummyRpcResult.Builder();
-    }
 
     @Override
     public boolean isSuccessful() {
@@ -34,7 +28,7 @@ public class DummyRpcResult implements RpcResult<TransactionStatus> {
     }
 
     @Override
-    public TransactionStatus getResult() {
+    public T getResult() {
         return result;
     }
 
@@ -42,31 +36,31 @@ public class DummyRpcResult implements RpcResult<TransactionStatus> {
     public Collection<RpcError> getErrors() {
         return errors;
     }
-    
-    public static class Builder {
+
+    public static class Builder<T> {
         private boolean isSuccessful;
-        private TransactionStatus result;
+        private T result;
         private Collection<RpcError> errors;
-        
-        public Builder isSuccessful(boolean isSuccessful) {
+
+        public Builder<T> isSuccessful(boolean isSuccessful) {
             this.isSuccessful = isSuccessful;
             return this;
         }
-        
-        public Builder result(TransactionStatus result) {
+
+        public Builder<T> result(T result) {
             this.result = result;
             return this;
         }
-        
-        public Builder errors(Collection<RpcError> errors) {
+
+        public Builder<T> errors(Collection<RpcError> errors) {
             this.errors = errors;
             return this;
         }
-        
-        public RpcResult<TransactionStatus> build() {
-            return new DummyRpcResult(this);
+
+        public RpcResult<T> build() {
+            return new DummyRpcResult<T>(this);
         }
-        
+
     }
 
 }
index 104e52f6a9ce6a66540daee850683e35ed0fd4ac..103c9ed3cdbe04f3f192180da77d6fd8fc14945e 100644 (file)
@@ -23,38 +23,11 @@ public class InvokeRpcMethodTest {
 
     private static Set<Module> modules;
 
-    private class RpcResultImpl<T> implements RpcResult<T> {
-
-        final T result;
-
-        public RpcResultImpl(T compNode) {
-            this.result = compNode;
-        }
-
-        @Override
-        public boolean isSuccessful() {
-            // TODO Auto-generated method stub
-            return false;
-        }
-
-        @Override
-        public T getResult() {
-            return result;
-        }
-
-        @Override
-        public Collection<RpcError> getErrors() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-    }
-
     private class AnswerImpl implements Answer<RpcResult<CompositeNode>> {
         @Override
         public RpcResult<CompositeNode> answer(InvocationOnMock invocation) throws Throwable {
             CompositeNode compNode = (CompositeNode) invocation.getArguments()[1];
-            return new RpcResultImpl<CompositeNode>(compNode);
+            return new DummyRpcResult.Builder<CompositeNode>().result(compNode).build();
         }
     }
 
index 61942e81a6e5918689cb4e77d1c9758b94b85911..20dfb31dab3362261fb1496dd1da9246fbc8052a 100644 (file)
@@ -205,14 +205,14 @@ final class TestUtils {
 
         ControllerContext contContext = ControllerContext.getInstance();
         contContext.setSchemas(loadSchemaContext(modules));
-        
+
         StructuredDataToJsonProvider structuredDataToJsonProvider = StructuredDataToJsonProvider.INSTANCE;
         structuredDataToJsonProvider.writeTo(new StructuredData(compositeNode, dataSchemaNode), null, null, null, null,
                 null, byteArrayOS);
 
         jsonResult = byteArrayOS.toString();
         if (outputPath != null) {
-            try {            
+            try {
                 outputToFile(byteArrayOS, outputPath);
             } catch (IOException e) {
                 System.out.println("Output file wasn't cloased sucessfuly.");
@@ -343,7 +343,8 @@ final class TestUtils {
         ControllerContext controllerContext = mock(ControllerContext.class);
         BrokerFacade broker = mock(BrokerFacade.class);
 
-        RpcResult<TransactionStatus> rpcResult = DummyRpcResult.builder().result(TransactionStatus.COMMITED).build();
+        RpcResult<TransactionStatus> rpcResult = new DummyRpcResult.Builder<TransactionStatus>().result(
+                TransactionStatus.COMMITED).build();
         Future<RpcResult<TransactionStatus>> future = DummyFuture.builder().rpcResult(rpcResult).build();
         when(controllerContext.toInstanceIdentifier(any(String.class))).thenReturn(instIdAndSchema);
         when(broker.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(
index 8e3ff1d2ed4a998997181a897a1c8ff648099aaa..c5682cb5cc1381eb31c66716a06118aa2e557e48 100644 (file)
@@ -1,27 +1,18 @@
 package org.opendaylight.controller.sal.restconf.impl.test;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
-import java.util.Set;
 
-import javax.activation.UnsupportedDataTypeException;
 import javax.ws.rs.WebApplicationException;
 
 import org.junit.*;
-import org.opendaylight.yangtools.yang.model.api.*;
 
-public class ToJsonChoiceCaseTest {
-
-    private static Set<Module> modules;
-    private static DataSchemaNode dataSchemaNode;
+public class ToJsonChoiceCaseTest extends YangAndXmlAndDataSchemaLoader {
 
     @BeforeClass
     public static void initialization() {
-        modules = TestUtils.resolveModules("/yang-to-json-conversion/choice");
-        Module module = TestUtils.resolveModule(null, modules);
-        dataSchemaNode = TestUtils.resolveDataSchemaNode(module, null);
-
+        dataLoad("/yang-to-json-conversion/choice");
     }
 
     /**
@@ -44,9 +35,9 @@ public class ToJsonChoiceCaseTest {
 
     /**
      * Test when some data are in one case node and other in another.
-     * Additionally data are loadef from various choices. This isn't
-     * correct. Next Json validator should return error because nodes has to be
-     * from one case below concrete choice.
+     * Additionally data are loadef from various choices. This isn't correct.
+     * Next Json validator should return error because nodes has to be from one
+     * case below concrete choice.
      * 
      */
     @Test
index c9ac042ff1b60655a89d9eb31a326d2cd3e6039d..ce1b4afababd1841f0718410b74158d43ef9d6ac 100644 (file)
@@ -1,9 +1,9 @@
 package org.opendaylight.controller.sal.restconf.impl.test;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
-import java.util.Set;
 import java.util.regex.*;
 
 import javax.ws.rs.WebApplicationException;
@@ -11,22 +11,12 @@ import javax.ws.rs.WebApplicationException;
 import org.junit.*;
 import org.opendaylight.yangtools.yang.data.api.*;
 import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
-import org.opendaylight.yangtools.yang.model.api.*;
 
-public class ToJsonIdentityrefTest {
-
-    private static Set<Module> modules;
-    private static DataSchemaNode dataSchemaNode;
+public class ToJsonIdentityrefTest extends YangAndXmlAndDataSchemaLoader {
 
     @BeforeClass
     public static void initialization() {
-        modules = TestUtils.resolveModules("/yang-to-json-conversion/identityref");
-        assertEquals(2, modules.size());
-        Module module = TestUtils.resolveModule("identityref-module", modules);
-        assertNotNull(module);
-        dataSchemaNode = TestUtils.resolveDataSchemaNode(module, "cont");
-        assertNotNull(dataSchemaNode);
-
+        dataLoad("/yang-to-json-conversion/identityref", 2, "identityref-module", "cont");
     }
 
     @Test
index a5cc02e9f26e26fb934311b221f1e4574efa9592..b4b8b4b3e3bc8d144fde73d51090354ecbefe0a4 100644 (file)
@@ -1,31 +1,20 @@
 package org.opendaylight.controller.sal.restconf.impl.test;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
-import java.util.Set;
 import java.util.regex.Matcher;
 
 import javax.ws.rs.WebApplicationException;
 
 import org.junit.*;
-import org.opendaylight.yangtools.yang.model.api.*;
 
-public class ToJsonLeafrefType {
-    private static Set<Module> modules;
-    private static DataSchemaNode dataSchemaNode;
+public class ToJsonLeafrefType extends YangAndXmlAndDataSchemaLoader {
 
     @BeforeClass
     public static void initialization() {
-        modules = TestUtils.resolveModules("/yang-to-json-conversion/leafref");
-        assertEquals(2, modules.size());
-        Module module = TestUtils.resolveModule("main-module", modules);
-        assertNotNull(module);
-        dataSchemaNode = TestUtils.resolveDataSchemaNode(module, "cont");
-        assertNotNull(dataSchemaNode);
-
+        dataLoad("/yang-to-json-conversion/leafref", 2, "main-module", "cont");
     }
 
     @Test
index 10885b642b8a75de219a2e997e95d362fbf43085..5b0eea32126e5f85dc5c95d2c7b0ef52624c9a9d 100644 (file)
@@ -54,7 +54,8 @@ public class XmlProvidersTest extends JerseyTest {
 
     @BeforeClass
     public static void init() throws FileNotFoundException {
-        Set<Module> allModules = TestUtils.loadModules(RestconfImplTest.class.getResource("/full-versions/yangs").getPath());
+        Set<Module> allModules = TestUtils.loadModules(RestconfImplTest.class.getResource("/full-versions/yangs")
+                .getPath());
         SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules);
         controllerContext = ControllerContext.getInstance();
         controllerContext.setSchemas(schemaContext);
@@ -75,11 +76,11 @@ public class XmlProvidersTest extends JerseyTest {
     @Test
     public void testStructuredDataToXmlProvider() throws FileNotFoundException, UnsupportedEncodingException {
         String uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0");
-        
+
         InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces.xml");
         CompositeNode loadedCompositeNode = TestUtils.loadCompositeNode(xmlStream);
         when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(loadedCompositeNode);
-        
+
         Response response = target(uri).request(MEDIA_TYPE).get();
         assertEquals(200, response.getStatus());
     }
@@ -87,94 +88,100 @@ public class XmlProvidersTest extends JerseyTest {
     @Test
     public void testBadFormatXmlToCompositeNodeProvider() throws UnsupportedEncodingException, URISyntaxException {
         String uri = createUri("/operations/", "ietf-interfaces:interfaces/interface/eth0");
-        
+
         Response response = target(uri).request(Draft01.MediaTypes.DATA + RestconfService.XML).post(
                 Entity.entity("<SimpleNode/>", MEDIA_TYPE));
         assertEquals(400, response.getStatus());
-        
+
         response = target(uri).request(Draft01.MediaTypes.DATA + RestconfService.XML).post(
                 Entity.entity("<SimpleNode>", MEDIA_TYPE));
         assertEquals(400, response.getStatus());
     }
-    
+
     @Test
     public void testXmlToCompositeNode404NotFound() throws UnsupportedEncodingException, URISyntaxException {
         String uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0");
-        
+
         when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(null);
-        
-        Response response = target(uri).request(Draft01.MediaTypes.DATA+RestconfService.XML).get();
+
+        Response response = target(uri).request(Draft01.MediaTypes.DATA + RestconfService.XML).get();
         assertEquals(404, response.getStatus());
     }
-    
+
     @Test
     public void testXmlToCompositeNode400() throws UnsupportedEncodingException, URISyntaxException {
         String uri = createUri("/datastore/", "simple-nodes:user/name");
-        
+
         when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(null);
-        
-        Response response = target(uri).request(Draft01.MediaTypes.DATA+RestconfService.XML).get();
+
+        Response response = target(uri).request(Draft01.MediaTypes.DATA + RestconfService.XML).get();
         assertEquals(400, response.getStatus());
     }
-    
+
     @Test
     public void testRpcResultCommitedToStatusCodes() throws UnsupportedEncodingException {
         InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces.xml");
         String xml = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream));
         Entity<String> entity = Entity.entity(xml, MEDIA_TYPE_DRAFT02);
-        RpcResult<TransactionStatus> rpcResult = DummyRpcResult.builder().result(TransactionStatus.COMMITED).build();
+        RpcResult<TransactionStatus> rpcResult = new DummyRpcResult.Builder<TransactionStatus>().result(
+                TransactionStatus.COMMITED).build();
         Future<RpcResult<TransactionStatus>> dummyFuture = DummyFuture.builder().rpcResult(rpcResult).build();
-        when(brokerFacade.commitOperationalDataPut(any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
-        when(brokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
-        
+        when(brokerFacade.commitOperationalDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+                .thenReturn(dummyFuture);
+        when(brokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+                .thenReturn(dummyFuture);
+
         String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/eth0");
         Response response = target(uri).request(MEDIA_TYPE_DRAFT02).put(entity);
         assertEquals(204, response.getStatus());
         response = target(uri).request(MEDIA_TYPE_DRAFT02).post(entity);
         assertEquals(200, response.getStatus());
-        
+
         uri = createUri("/config/", "ietf-interfaces:interfaces/interface/eth0");
         response = target(uri).request(MEDIA_TYPE_DRAFT02).put(entity);
         assertEquals(204, response.getStatus());
         response = target(uri).request(MEDIA_TYPE_DRAFT02).post(entity);
         assertEquals(200, response.getStatus());
-        
+
         uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0");
         response = target(uri).request(MEDIA_TYPE).put(entity);
         assertEquals(204, response.getStatus());
         response = target(uri).request(MEDIA_TYPE).post(entity);
         assertEquals(200, response.getStatus());
     }
-    
+
     @Test
     public void testRpcResultOtherToStatusCodes() throws UnsupportedEncodingException {
         InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces.xml");
         String xml = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream));
         Entity<String> entity = Entity.entity(xml, MEDIA_TYPE_DRAFT02);
-        RpcResult<TransactionStatus> rpcResult = DummyRpcResult.builder().result(TransactionStatus.FAILED).build();
+        RpcResult<TransactionStatus> rpcResult = new DummyRpcResult.Builder<TransactionStatus>().result(
+                TransactionStatus.FAILED).build();
         Future<RpcResult<TransactionStatus>> dummyFuture = DummyFuture.builder().rpcResult(rpcResult).build();
-        when(brokerFacade.commitOperationalDataPut(any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
-        when(brokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
-        
+        when(brokerFacade.commitOperationalDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+                .thenReturn(dummyFuture);
+        when(brokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+                .thenReturn(dummyFuture);
+
         String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/eth0");
         Response response = target(uri).request(MEDIA_TYPE_DRAFT02).put(entity);
         assertEquals(500, response.getStatus());
         response = target(uri).request(MEDIA_TYPE_DRAFT02).post(entity);
         assertEquals(500, response.getStatus());
-        
+
         uri = createUri("/config/", "ietf-interfaces:interfaces/interface/eth0");
         response = target(uri).request(MEDIA_TYPE_DRAFT02).put(entity);
         assertEquals(500, response.getStatus());
         response = target(uri).request(MEDIA_TYPE_DRAFT02).post(entity);
         assertEquals(500, response.getStatus());
-        
+
         uri = createUri("/datastore/", "ietf-interfaces:interfaces/interface/eth0");
         response = target(uri).request(MEDIA_TYPE).put(entity);
         assertEquals(500, response.getStatus());
         response = target(uri).request(MEDIA_TYPE).post(entity);
         assertEquals(500, response.getStatus());
     }
-    
+
     private String createUri(String prefix, String encodedPart) throws UnsupportedEncodingException {
         return URI.create(prefix + URLEncoder.encode(encodedPart, Charsets.US_ASCII.name()).toString()).toASCIIString();
     }
@@ -185,9 +192,10 @@ public class XmlProvidersTest extends JerseyTest {
         enable(TestProperties.DUMP_ENTITY);
         enable(TestProperties.RECORD_LOG_LEVEL);
         set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
-        
+
         ResourceConfig resourceConfig = new ResourceConfig();
-        resourceConfig = resourceConfig.registerInstances(restconfImpl, StructuredDataToXmlProvider.INSTANCE, XmlToCompositeNodeProvider.INSTANCE);
+        resourceConfig = resourceConfig.registerInstances(restconfImpl, StructuredDataToXmlProvider.INSTANCE,
+                XmlToCompositeNodeProvider.INSTANCE);
         return resourceConfig;
     }
 
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/YangAndXmlAndDataSchemaLoader.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/YangAndXmlAndDataSchemaLoader.java
new file mode 100644 (file)
index 0000000..7e3da0e
--- /dev/null
@@ -0,0 +1,27 @@
+package org.opendaylight.controller.sal.restconf.impl.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Set;
+import org.opendaylight.yangtools.yang.model.api.*;
+
+public abstract class YangAndXmlAndDataSchemaLoader {
+
+    protected static Set<Module> modules;
+    protected static DataSchemaNode dataSchemaNode;
+
+    protected static void dataLoad(String yangPath) {
+        dataLoad(yangPath, 1, null, null);
+    }
+
+    protected static void dataLoad(String yangPath, int modulesNumber, String moduleName, String dataSchemaName) {
+        modules = TestUtils.resolveModules(yangPath);
+        assertEquals(modulesNumber, modules.size());
+        Module module = TestUtils.resolveModule(moduleName, modules);
+        assertNotNull(module);
+        dataSchemaNode = TestUtils.resolveDataSchemaNode(module, dataSchemaName);
+        assertNotNull(dataSchemaNode);
+    }
+
+}
index 794bb16605fc1b0d572ac3b08b2f3a26ba607831..f60b4b02f5edb571c15313139ce32895fb4843a8 100644 (file)
                         </Export-Package>
                         <Import-Package>
                             com.google.common.base,
-                            com.google.common.collect,
                             ch.ethz.ssh2,
                             ch.ethz.ssh2.signature,
-                            io.netty.buffer,
-                            io.netty.channel,
-                            io.netty.channel.nio,
-                            io.netty.channel.socket,
-                            io.netty.util,
-                            io.netty.util.concurrent,
-                            javax.annotation,
                             java.net,
-                            javax.net.ssl,
-                            javax.xml.namespace,
-                            javax.xml.parsers,
-                            javax.xml.xpath,
+                            javax.annotation,
                             org.apache.commons.io,
-                            org.opendaylight.controller.netconf.api,
-                            org.opendaylight.controller.netconf.client,
                             org.opendaylight.controller.netconf.util,
                             org.opendaylight.controller.netconf.util.osgi,
-                            org.opendaylight.controller.netconf.util.xml,
                             org.opendaylight.protocol.framework,
                             org.osgi.framework,
-                            org.slf4j,
-                            org.w3c.dom,
-                            org.xml.sax
+                            org.slf4j
                         </Import-Package>
                     </instructions>
                 </configuration>