BUG-7159: eliminate use of CrossStatementSourceReactor
[controller.git] / opendaylight / md-sal / sal-binding-dom-it / src / test / java / org / opendaylight / controller / sal / binding / test / connect / dom / DOMRpcServiceTestBugfix560.java
index a0f4e99a6bb8a8ff6f1cde163d83b945d60fcddd..e240b194534a919f51782de8e74d21eaf001dc50 100644 (file)
@@ -17,7 +17,6 @@ import com.google.common.util.concurrent.MoreExecutors;
 import java.io.InputStream;
 import java.util.Collections;
 import java.util.List;
-import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import org.junit.After;
@@ -44,11 +43,9 @@ import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 /**
  * Test case for reported bug 560
@@ -81,7 +78,7 @@ public class DOMRpcServiceTestBugfix560 {
     @Before
     public void setUp() throws Exception {
         final BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory();
-        testFactory.setExecutor(MoreExecutors.sameThreadExecutor());
+        testFactory.setExecutor(MoreExecutors.newDirectExecutorService());
         testFactory.setStartWithParsedSchema(true);
         testContext = testFactory.getTestContext();
 
@@ -90,20 +87,13 @@ public class DOMRpcServiceTestBugfix560 {
         bindingMountPointService = testContext.getBindingMountProviderService();
         assertNotNull(domMountPointService);
 
-        final YangContextParser parser = new YangParserImpl();
         final InputStream moduleStream = BindingReflections.getModuleInfo(
                 OpendaylightTestRpcServiceService.class)
                 .getModuleSourceStream();
 
         assertNotNull(moduleStream);
         final List<InputStream> rpcModels = Collections.singletonList(moduleStream);
-        @SuppressWarnings("deprecation")
-        final
-        Set<Module> modules = parser.parseYangModelsFromStreams(rpcModels);
-        @SuppressWarnings("deprecation")
-        final
-        SchemaContext mountSchemaContext = parser.resolveSchemaContext(modules);
-        schemaContext = mountSchemaContext;
+        schemaContext = YangParserTestUtils.parseYangStreams(rpcModels);
     }
 
     private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBITllIdentifier(
@@ -112,20 +102,18 @@ public class DOMRpcServiceTestBugfix560 {
                 .builder().node(Top.QNAME)
                 .node(TopLevelList.QNAME)
                 .nodeWithKey(TopLevelList.QNAME, TLL_NAME_QNAME, mount)
-                .toInstance();
+                .build();
     }
 
     private static InstanceIdentifier<TopLevelList> createBATllIdentifier(
             final String mount) {
         return InstanceIdentifier.builder(Top.class)
-                .child(TopLevelList.class, new TopLevelListKey(mount)).toInstance();
+                .child(TopLevelList.class, new TopLevelListKey(mount)).build();
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void test() throws ExecutionException, InterruptedException {
-        // FIXME: This is made to only make sure instance identifier codec
-        // for path is instantiated.
+        // FIXME: This is made to only make sure instance identifier codec for path is instantiated.
         domMountPointService
                 .createMountPoint(BI_MOUNT_ID).addService(DOMRpcService.class, new DOMRpcService() {