use of com.google.api.ads.admanager.axis.v202205.ColumnType in project molgenis-emx2 by molgenis.
the class TestOpenApi method constructApi.
@Test
public void constructApi() throws IOException {
SchemaMetadata schema = new SchemaMetadata("test");
TableMetadata table = schema.create(TableMetadata.table("TypeTest"));
for (ColumnType columnType : ColumnType.values()) {
if (columnType.isReference()) {
// TODO: outside of test for now
} else {
table.add(Column.column(columnType.toString().toLowerCase() + "Column").setType(columnType));
}
}
TableMetadata personTable = schema.create(TableMetadata.table("Person").add(Column.column("First_Name")).add(Column.column("Last_Name")));
OpenAPI api = OpenApiYamlGenerator.createOpenApi(schema);
// useless test
Assert.assertEquals(1, api.getComponents().getSchemas().size());
// useless test
Assert.assertEquals(1, api.getComponents().getSchemas().size());
StringWriter writer = new StringWriter();
Yaml.pretty().writeValue(writer, api);
System.out.println(writer);
}
use of com.google.api.ads.admanager.axis.v202205.ColumnType in project molgenis-emx2 by molgenis.
the class TestGetSetAllTypesOnRows method addContents.
private void addContents(SchemaMetadata m, List<ColumnType> columnTypes) {
TableMetadata t = m.create(table("TypeTest"));
for (ColumnType columnType : columnTypes) {
t.add(column("test" + columnType).setType(columnType).setRequired(true));
t.add(column("test" + columnType + "_nullable").setType(columnType));
t.add(column("test" + columnType + "_readonly").setType(columnType).setReadonly(true));
}
}
use of com.google.api.ads.admanager.axis.v202205.ColumnType in project molgenis-emx2 by molgenis.
the class TestMapPojoToTable method testTypeTestToTable.
@Test
public void testTypeTestToTable() {
TableMetadata table = Mapper.map(TypeTestBean.class);
for (ColumnType columnType : new ColumnType[] { STRING, INT, DECIMAL, BOOL, DATE, DATETIME }) {
String columnName = "a" + columnType.toString().substring(0, 1).toUpperCase() + columnType.toString().substring(1).toLowerCase();
assertEquals(columnType, table.getColumn(columnName).getColumnType());
}
}
use of com.google.api.ads.admanager.axis.v202205.ColumnType in project molgenis-emx2 by molgenis.
the class RefAndRefArrayTestExample method createRefAndRefArrayTestExample.
public static void createRefAndRefArrayTestExample(SchemaMetadata schema) {
ColumnType[] columnTypes = new ColumnType[] { UUID, STRING, BOOL, INT, DECIMAL, TEXT, DATE, DATETIME };
for (ColumnType columnType : columnTypes) {
String aTableName = columnType.toString() + "_A";
String fieldName = "AKeyOf" + columnType;
schema.create(table(aTableName).add(column(fieldName).setType(columnType).setPkey()));
String bTableName = columnType.toString() + "_B";
String refFromBToA = "RefToAKeyOf" + columnType;
String refArrayFromBToA = "RefArrayToAKeyOf" + columnType;
schema.create(table(bTableName).add(column(refFromBToA).setType(REF).setRefTable(aTableName)).add(column(refArrayFromBToA).setType(REF_ARRAY).setRefTable(aTableName)));
}
}
use of com.google.api.ads.admanager.axis.v202205.ColumnType in project molgenis-emx2 by molgenis.
the class SimpleTypeTestExample method createSimpleTypeTest.
public static void createSimpleTypeTest(SchemaMetadata schema) {
TableMetadata typeTestTable = table(TYPE_TEST).add(column("id").setPkey());
ColumnType[] columnTypes = new ColumnType[] { UUID, STRING, BOOL, INT, LONG, DECIMAL, TEXT, DATE, DATETIME };
for (ColumnType columnType : columnTypes) {
typeTestTable.add(column("Test " + columnType.toString().toLowerCase()).setType(columnType).setRequired(true));
typeTestTable.add(column("Test " + columnType.toString().toLowerCase() + " nillable").setType(columnType));
}
schema.create(typeTestTable);
}
Aggregations