import static org.junit.Assert.*;
+import java.io.FileNotFoundException;
import java.net.URI;
import java.util.List;
import java.util.Set;
import org.opendaylight.controller.yang.model.api.IdentitySchemaNode;
import org.opendaylight.controller.yang.model.api.LeafSchemaNode;
import org.opendaylight.controller.yang.model.api.Module;
+import org.opendaylight.controller.yang.model.api.Status;
import org.opendaylight.controller.yang.model.api.TypeDefinition;
import org.opendaylight.controller.yang.model.api.type.BitsTypeDefinition.Bit;
import org.opendaylight.controller.yang.model.api.type.EnumTypeDefinition.EnumPair;
private Set<Module> testedModules;
@Before
- public void init() {
+ public void init() throws FileNotFoundException {
testedModules = TestUtils.loadModules("src/test/resources/types");
}
@Test
public void testEnumeration() {
- Module tested = TestUtils.findModule(testedModules, "custom-types-test");
+ Module tested = TestUtils
+ .findModule(testedModules, "custom-types-test");
Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
TypeDefinition<?> type = TestUtils.findTypedef(typedefs, "ip-version");
EnumPair value3 = values.get(3);
assertEquals("default", value3.getName());
assertEquals(20, (int) value3.getValue());
- assertEquals("default ip",
- value3.getDescription());
+ assertEquals("default ip", value3.getDescription());
}
@Test
assertEquals(502L, (long) bit4.getPosition());
}
-
@Test
public void testIanaTimezones() {
Module tested = TestUtils.findModule(testedModules, "iana-timezones");
Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs,
"iana-timezone");
- /*
- // FIXME: Refactor sources not to be timezone specific.
- String expectedDesc = "A timezone location as defined by the IANA timezone\n database (http://www.iana.org/time-zones)";
- assertEquals(expectedDesc, testedType.getDescription());
+
+ String expectedDesc = "A timezone location as defined by the IANA timezone";
+ assertTrue(testedType.getDescription().contains(expectedDesc));
assertNull(testedType.getReference());
assertEquals(Status.CURRENT, testedType.getStatus());
- */
+
QName testedTypeQName = testedType.getQName();
assertEquals(URI.create("urn:ietf:params:xml:ns:yang:iana-timezones"),
testedTypeQName.getNamespace());
Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs,
"service-type-ref");
- IdentityrefType baseType = (IdentityrefType)testedType.getBaseType();
+ IdentityrefType baseType = (IdentityrefType) testedType.getBaseType();
QName identity = baseType.getIdentity();
- assertEquals(URI.create("urn:simple.container.demo"), identity.getNamespace());
+ assertEquals(URI.create("urn:simple.container.demo"),
+ identity.getNamespace());
assertEquals(TestUtils.createDate("2012-04-16"), identity.getRevision());
assertEquals("iit", identity.getPrefix());
assertEquals("service-type", identity.getLocalName());