Schema { public Type findType(String idOrName) { if (typeMap.containsKey(idOrName)) { return typeMap.get(idOrName); } else if (typeMap.containsKey(Class.nameToId(idOrName))) { return typeMap.get(Class.nameToId(idOrName)); } else if (typeMap.containsKey(Enum.nameToId(idOrName))) { return typeMap.get(Enum.nameToId(idOrName)); } return null; }  static Schema build(String path); void save(OutputStream os); Collection<Type> getTypes(); Collection<UserType> getUserTypes(); Type findType(String idOrName); SchemaVersion getVersion(); Collection<Type> getDerivedTypes(String baseTypeId,
			boolean directOnly); Collection<Type> getDerivedTypes(Type baseType,
			boolean directOnly); static final String TYPE_ID_TOKENIZER_PATTERN; }
@Test public void schemaReferenceTest() throws Exception { Schema schema = parseSchema("src/test/resources/reference.tml"); assertNotNull(schema); Class message = (Class) schema .findType("com.expedia.tesla.automation.teslacompiler.reference.Message"); for (Field member : message.getFields()) { assertTrue(member.getIsReference()); } }
@Test public void schemaExtendsClassTest() throws URISyntaxException, TeslaSchemaException, NoSuchAlgorithmException, SAXException, IOException, ParserConfigurationException { Schema schema = parseSchema("src/test/resources/extendsclass.tml"); com.expedia.tesla.schema.Class extendedClass = (com.expedia.tesla.schema.Class) schema .findType("com.expedia.tesla.automation.component.schema.ExtendClass"); assertNotNull(extendedClass); List<Field> fields = extendedClass.getAllFields(); assertEquals(2, fields.size()); }
@Test public void schemaExtendsMultiClassTest() throws URISyntaxException, TeslaSchemaException, NoSuchAlgorithmException, SAXException, IOException, ParserConfigurationException { Schema schema = parseSchema("src/test/resources/extendsmulticlass.tml"); com.expedia.tesla.schema.Class extendedClass = (com.expedia.tesla.schema.Class) schema .findType("com.expedia.tesla.automation.component.schema.ExtendClass"); assertNotNull(extendedClass); List<Field> fields = extendedClass.getAllFields(); assertEquals(3, fields.size()); }