@Test public void formatResponseStringWithModifiers() throws Exception { List<Metadata> metadataList = new ArrayList<Metadata>(); List<Metadata.Field> fields = new ArrayList<Metadata.Field>(); Metadata.Item itemName = new Metadata.Item("default", "table1"); Metadata metadata = new Metadata(itemName, fields); fields.add(new Metadata.Field("field1", EnumGpdbType.Int8Type, "bigint")); fields.add(new Metadata.Field("field2", EnumGpdbType.NumericType, "decimal", new String[] {"1349", "1789"})); fields.add(new Metadata.Field("field3", EnumGpdbType.BpcharType, "char", new String[] {"50"})); metadataList.add(metadata); response = MetadataResponseFormatter.formatResponse(metadataList, "path.file"); StringBuilder expected = new StringBuilder("{\"PXFMetadata\":[{"); expected.append("\"item\":{\"path\":\"default\",\"name\":\"table1\"},") .append("\"fields\":[") .append("{\"name\":\"field1\",\"type\":\"int8\",\"sourceType\":\"bigint\",\"complexType\":false},") .append("{\"name\":\"field2\",\"type\":\"numeric\",\"sourceType\":\"decimal\",\"modifiers\":[\"1349\",\"1789\"],\"complexType\":false},") .append("{\"name\":\"field3\",\"type\":\"bpchar\",\"sourceType\":\"char\",\"modifiers\":[\"50\"],\"complexType\":false}") .append("]}]}"); assertEquals(expected.toString(), convertResponseToString(response)); }
public static MetadataResponse formatResponse(List<Metadata> metadataList, String path) throws IOException { if (LOG.isDebugEnabled()) { MetadataResponseFormatter.printMetadata(metadataList, path); } return new MetadataResponse(metadataList); }
MetadataResponseFormatter { public static MetadataResponse formatResponse(List<Metadata> metadataList, String path) throws IOException { if (LOG.isDebugEnabled()) { MetadataResponseFormatter.printMetadata(metadataList, path); } return new MetadataResponse(metadataList); } }
MetadataResponseFormatter { public static MetadataResponse formatResponse(List<Metadata> metadataList, String path) throws IOException { if (LOG.isDebugEnabled()) { MetadataResponseFormatter.printMetadata(metadataList, path); } return new MetadataResponse(metadataList); }  }
MetadataResponseFormatter { public static MetadataResponse formatResponse(List<Metadata> metadataList, String path) throws IOException { if (LOG.isDebugEnabled()) { MetadataResponseFormatter.printMetadata(metadataList, path); } return new MetadataResponse(metadataList); }  static MetadataResponse formatResponse(List<Metadata> metadataList, String path); }
MetadataResponseFormatter { public static MetadataResponse formatResponse(List<Metadata> metadataList, String path) throws IOException { if (LOG.isDebugEnabled()) { MetadataResponseFormatter.printMetadata(metadataList, path); } return new MetadataResponse(metadataList); }  static MetadataResponse formatResponse(List<Metadata> metadataList, String path);  }