X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-dom-it%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Ftest%2Fbugfix%2FDOMCodecBug02Test.java;h=929eb66350115f025135dc77b5ce1aaf4d103149;hp=848fb6b1900eab43a3e3e2886d654c92c2135c24;hb=43d7c8702fc7a89ca5acdeefb4696c91b2963b38;hpb=66bb5943ab1aad5d4b969a8a75c382c7590fb181 diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug02Test.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug02Test.java index 848fb6b190..929eb66350 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug02Test.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug02Test.java @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 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.sal.binding.test.bugfix; import java.util.Collections; @@ -7,9 +14,13 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import javassist.ClassPool; + +import org.junit.Ignore; import org.junit.Test; import org.opendaylight.controller.md.sal.common.api.TransactionStatus; import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest; +import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory; import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; @@ -23,6 +34,9 @@ import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; + import static org.junit.Assert.*; public class DOMCodecBug02Test extends AbstractDataServiceTest { @@ -54,15 +68,32 @@ public class DOMCodecBug02Test extends AbstractDataServiceTest { private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA); /** - * + * This test is ignored, till found out better way to test generation + * of classes without leaking of instances from previous run * * @throws Exception */ + + public void setUp() { + ListeningExecutorService executor = MoreExecutors.sameThreadExecutor(); + BindingBrokerTestFactory factory = new BindingBrokerTestFactory(); + factory.setExecutor(executor); + factory.setClassPool(new ClassPool()); + factory.setStartWithParsedSchema(getStartWithSchema()); + testContext = factory.getTestContext(); + testContext.start(); + + baDataService = testContext.getBindingDataBroker(); + biDataService = testContext.getDomDataBroker(); + dataStore = testContext.getDomDataStore(); + mappingService = testContext.getBindingToDomMappingService(); + }; + @Test public void testSchemaContextNotAvailable() throws Exception { ExecutorService testExecutor = Executors.newFixedThreadPool(1); - + testContext.loadYangSchemaFromClasspath(); Future>> future = testExecutor.submit(new Callable>>() { @Override public Future> call() throws Exception { @@ -74,11 +105,10 @@ public class DOMCodecBug02Test extends AbstractDataServiceTest { } }); - testContext.loadYangSchemaFromClasspath(); + RpcResult result = future.get().get(); assertEquals(TransactionStatus.COMMITED, result.getResult()); - Nodes nodes = checkForNodes(); assertNotNull(nodes);