@Test public void formatResponseStringWithMultipleItems() throws Exception { List <Metadata> metdataList = new ArrayList<Metadata>(); for (int i=1; i<=10; i++) { List<Metadata.Field> fields = new ArrayList<Metadata.Field>(); Metadata.Item itemName = new Metadata.Item("default", "table"+i); Metadata metadata = new Metadata(itemName, fields); fields.add(new Metadata.Field("field1", EnumGpdbType.Int8Type, "bigint")); fields.add(new Metadata.Field("field2", EnumGpdbType.TextType, "string")); metdataList.add(metadata); } response = MetadataResponseFormatter.formatResponse(metdataList, "path.file"); StringBuilder expected = new StringBuilder(); for (int i=1; i<=10; i++) { if(i==1) { expected.append("{\"PXFMetadata\":["); } else { expected.append(","); } expected.append("{\"item\":{\"path\":\"default\",\"name\":\"table").append(i).append("\"},"); expected.append("\"fields\":[{\"name\":\"field1\",\"type\":\"int8\",\"sourceType\":\"bigint\",\"complexType\":false},{\"name\":\"field2\",\"type\":\"text\",\"sourceType\":\"string\",\"complexType\":false}]}"); } expected.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);  }