import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import java.io.FileNotFoundException;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
import org.opendaylight.netconf.sal.restconf.impl.RestCodec.InstanceIdentifierCodecImpl;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
public class InstanceIdentifierCodecImplTest {
+ private static SchemaContext schemaContext;
private Codec<IdentityValuesDTO, YangInstanceIdentifier> instanceIdentifierDTO;
private YangInstanceIdentifier instanceIdentifierBadNamespace;
private YangInstanceIdentifier instanceIdentifierOKList;
private YangInstanceIdentifier instanceIdentifierOKLeafList;
- private SchemaContext schemaContext;
+
+ @BeforeClass
+ public static void init() throws FileNotFoundException {
+ schemaContext = YangParserTestUtils.parseYangFiles(
+ TestRestconfUtils.loadFiles("/restconf/parser/deserializer"));
+ }
@Before
public void setUp() throws Exception {
- this.schemaContext =
- YangParserTestUtils.parseYangFiles(TestRestconfUtils.loadFiles("/restconf/parser/deserializer"));
- this.instanceIdentifierDTO = new InstanceIdentifierCodecImpl(null);
- ControllerContext.getInstance().setGlobalSchema(this.schemaContext);
+ ControllerContext controllerContext = TestRestconfUtils.newControllerContext(schemaContext);
+
+ this.instanceIdentifierDTO = new InstanceIdentifierCodecImpl(null, controllerContext);
final QName baseQName = QName.create("deserializer:test", "2016-06-06", "deserializer-test");
final QName contA = QName.create(baseQName, "contA");
this.instanceIdentifierDTO.deserialize(valuesDTO);
assertNull(deserializedIdentifier);
}
-}
\ No newline at end of file
+}