import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.CheckedFuture;
import java.io.FileNotFoundException;
-import java.net.URI;
import java.util.List;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
+import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
import org.opendaylight.netconf.sal.restconf.impl.PutResult;
-import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
-import org.opendaylight.netconf.sal.restconf.impl.RestconfError;
-import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorTag;
-import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorType;
import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
+import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
+import org.opendaylight.restconf.common.errors.RestconfError;
+import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
+import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
public class RestPutListDataTest {
+ private static SchemaContext schemaContextTestModule;
private static BrokerFacade brokerFacade;
private static RestconfImpl restconfImpl;
- private static SchemaContext schemaContextTestModule;
private static final String TEST_MODULE_NS_STRING = "test:module";
- private static final URI TEST_MODULE_NS;
private static final String TEST_MODULE_REVISION = "2014-01-09";
- static {
- TEST_MODULE_NS = URI.create("test:module");
+ @BeforeClass
+ public static void staticSetup() throws FileNotFoundException {
+ schemaContextTestModule = TestUtils.loadSchemaContext("/full-versions/test-module");
}
@Before
- public void initialize() throws FileNotFoundException, ReactorException {
- final ControllerContext controllerContext = ControllerContext.getInstance();
- schemaContextTestModule = TestUtils.loadSchemaContext("/full-versions/test-module");
- controllerContext.setSchemas(schemaContextTestModule);
+ public void initialize() throws FileNotFoundException {
+ final ControllerContext controllerContext = TestRestconfUtils.newControllerContext(schemaContextTestModule);
brokerFacade = mock(BrokerFacade.class);
- restconfImpl = RestconfImpl.getInstance();
- restconfImpl.setBroker(brokerFacade);
- restconfImpl.setControllerContext(controllerContext);
+ restconfImpl = RestconfImpl.newInstance(brokerFacade, controllerContext);
final PutResult result = mock(PutResult.class);
when(brokerFacade.commitConfigurationDataPut(any(SchemaContext.class), any(YangInstanceIdentifier.class),
any(NormalizedNode.class), Mockito.anyString(), Mockito.anyString()))