import static org.opendaylight.mdsal.binding.generator.impl.SupportTestUtil.containsInterface;
import static org.opendaylight.mdsal.binding.generator.impl.SupportTestUtil.containsMethods;
-import java.io.IOException;
import java.util.List;
import org.junit.Test;
import org.opendaylight.mdsal.binding.generator.api.BindingGenerator;
-import org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl;
import org.opendaylight.mdsal.binding.model.api.GeneratedTransferObject;
import org.opendaylight.mdsal.binding.model.api.GeneratedType;
import org.opendaylight.mdsal.binding.model.api.Type;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
public class ChoiceCaseGenTypesTest extends AbstractTypesTest {
}
@Test
- public void choiceCaseResolvingTypeTest() throws IOException, SourceException, ReactorException {
+ public void choiceCaseResolvingTypeTest() {
final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
assertNotNull("context is null", context);
- final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
final List<Type> genTypes = bindingGen.generateTypes(context);
assertNotNull("genTypes is null", genTypes);
assertFalse("genTypes is empty", genTypes.isEmpty());
// test for file choice-monitoring
- String pcgPref = "org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.choice.monitoring.rev130701.netconf.state.datastores.datastore.locks";
+ String pcgPref = "org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.choice.monitoring.rev130701."
+ + "netconf.state.datastores.datastore.locks";
GeneratedType genType = null;
checkGeneratedType(genTypes, "LockType", pcgPref); // choice
genType = checkGeneratedType(genTypes, "AnonymousLock", pcgPref
+ ".netconf.state.datastores.datastore.locks.lock.type"); // choice
- containsMethods(genType, new NameTypePattern("getLockTime", "Long"));
+ containsMethods(genType, new NameTypePattern("getLockTime", "Uint32"));
containsInterface("LockType", genType);
genType = checkGeneratedType(genTypes, "LeafAugCase", pcgPref
containsMethods(genType, new NameTypePattern("getStorageFormat", "StorageFormat"));
containsInterface("Augmentation<Datastore>", genType);
- genType = checkGeneratedType(genTypes, "StorageFormat", pcgPref + ".netconf.state.datastores.datastore"); // choice
+ // choice
+ genType = checkGeneratedType(genTypes, "StorageFormat", pcgPref + ".netconf.state.datastores.datastore");
genType = checkGeneratedType(genTypes, "UnknownFiles", pcgPref
+ ".netconf.state.datastores.datastore.storage.format"); // case
containsMethods(genType, new NameTypePattern("getFiles", "List<Files>"));
containsInterface("StorageFormat", genType);
- genType = checkGeneratedType(genTypes, "Xml", pcgPref + ".netconf.state.datastores.datastore.storage.format"); // case
+ // case
+ genType = checkGeneratedType(genTypes, "Xml", pcgPref + ".netconf.state.datastores.datastore.storage.format");
containsMethods(genType, new NameTypePattern("getXmlDef", "XmlDef"));
containsInterface("StorageFormat", genType);
- genType = checkGeneratedType(genTypes, "Yang", pcgPref + ".netconf.state.datastores.datastore.storage.format"); // case
+ // case
+ genType = checkGeneratedType(genTypes, "Yang", pcgPref + ".netconf.state.datastores.datastore.storage.format");
containsMethods(genType, new NameTypePattern("getYangFileName", "String"));
containsInterface("StorageFormat", genType);
-
}
}