@Test public void formatResponseString() 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.TextType, "string")); metadataList.add(metadata); response = MetadataResponseFormatter.formatResponse(metadataList, "path.file"); StringBuilder expected = new StringBuilder("{\"PXFMetadata\":[{"); expected.append("\"item\":{\"path\":\"default\",\"name\":\"table1\"},") .append("\"fields\":[{\"name\":\"field1\",\"type\":\"int8\",\"sourceType\":\"bigint\",\"complexType\":false},{\"name\":\"field2\",\"type\":\"text\",\"sourceType\":\"string\",\"complexType\":false}]}]}"); 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);  }