@Test public void testArrayType() throws Exception { ModelMetaData model = new ModelMetaData(); model.setName("nw"); model.setModelType(Type.PHYSICAL); MetadataFactory mf = new MetadataFactory("northwind", 1, SystemMetadata.getInstance().getRuntimeTypeMap(), model); EdmDataServices edm = new EdmxFormatParser().parseMetadata( StaxUtil.newXMLEventReader(new FileReader(UnitTestUtil.getTestDataFile("arraytest.xml")))); ODataMetadataProcessor metadataProcessor = new ODataMetadataProcessor(); PropertiesUtils.setBeanProperties(metadataProcessor, mf.getModelProperties(), "importer"); metadataProcessor.getMetadata(mf, edm); Column c = mf.getSchema().getTable("G2").getColumnByName("e3"); assertEquals("integer[]", c.getRuntimeType()); Procedure p = mf.getSchema().getProcedure("ARRAYITERATE"); assertEquals("varbinary[]", p.getParameters().get(0).getRuntimeType()); assertEquals("varbinary", p.getResultSet().getColumns().get(0).getRuntimeType()); String ddl = DDLStringVisitor.getDDLString(mf.getSchema(), null, null); TransformationMetadata metadata = RealMetadataFactory.fromDDL(ddl, "northwind", "nw"); String query = "SELECT * FROM G2"; String expectedURL = "G2?$select=e1,e3"; String result = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<feed xmlns=\"http: " <title type=\"text\">VM1.x</title>\n" + " <id>http: " <updated>2015-10-14T19:36:58Z</updated>\n" + " <link rel=\"self\" title=\"VM1.x\" href=\"VM1.x\" />\n" + " <entry>\n" + " <id>http: " <title type=\"text\" />\n" + " <updated>2015-10-14T19:36:58Z</updated>\n" + " <author>\n" + " <name />\n" + " </author>\n" + " <link rel=\"edit\" title=\"x\" href=\"VM1.x('x')\" />\n" + " <category term=\"PM1.G2\" scheme=\"http: " <content type=\"application/xml\">\n" + " <m:properties>\n" + " <d:e1>32</d:e1>\n" + " <d:e3 m:type=\"Collection(Edm.Int32)\">\n" + " <d:element>1</d:element>\n" + " <d:element>2</d:element>\n" + " <d:element>3</d:element>\n" + " </d:e3>\n" + " </m:properties>\n" + " </content>\n" + " </entry>\n" + "</feed>"; ResultSetExecution excution = helpExecute(query, result, expectedURL, 200, metadata); assertArrayEquals(new Object[] {32, new Integer[] {1,2,3}}, excution.next().toArray(new Object[2])); }
@Override public List<?> next() throws TranslatorException, DataNotAvailableException { if (visitor.isCount() && this.countResponse != -1) { int count = this.countResponse; this.countResponse = -1; return Arrays.asList(count); } if (this.response != null && !this.response.hasError()) { return this.response.getNextRow(visitor.getSelect(), this.expectedColumnTypes); } return null; }
ODataQueryExecution extends BaseQueryExecution implements ResultSetExecution { @Override public List<?> next() throws TranslatorException, DataNotAvailableException { if (visitor.isCount() && this.countResponse != -1) { int count = this.countResponse; this.countResponse = -1; return Arrays.asList(count); } if (this.response != null && !this.response.hasError()) { return this.response.getNextRow(visitor.getSelect(), this.expectedColumnTypes); } return null; } }
ODataQueryExecution extends BaseQueryExecution implements ResultSetExecution { @Override public List<?> next() throws TranslatorException, DataNotAvailableException { if (visitor.isCount() && this.countResponse != -1) { int count = this.countResponse; this.countResponse = -1; return Arrays.asList(count); } if (this.response != null && !this.response.hasError()) { return this.response.getNextRow(visitor.getSelect(), this.expectedColumnTypes); } return null; } ODataQueryExecution(ODataExecutionFactory translator,
            QueryExpression command, ExecutionContext executionContext,
            RuntimeMetadata metadata, WSConnection connection); }
ODataQueryExecution extends BaseQueryExecution implements ResultSetExecution { @Override public List<?> next() throws TranslatorException, DataNotAvailableException { if (visitor.isCount() && this.countResponse != -1) { int count = this.countResponse; this.countResponse = -1; return Arrays.asList(count); } if (this.response != null && !this.response.hasError()) { return this.response.getNextRow(visitor.getSelect(), this.expectedColumnTypes); } return null; } ODataQueryExecution(ODataExecutionFactory translator,
            QueryExpression command, ExecutionContext executionContext,
            RuntimeMetadata metadata, WSConnection connection); @Override void execute(); @Override List<?> next(); @Override void close(); @Override void cancel(); }
ODataQueryExecution extends BaseQueryExecution implements ResultSetExecution { @Override public List<?> next() throws TranslatorException, DataNotAvailableException { if (visitor.isCount() && this.countResponse != -1) { int count = this.countResponse; this.countResponse = -1; return Arrays.asList(count); } if (this.response != null && !this.response.hasError()) { return this.response.getNextRow(visitor.getSelect(), this.expectedColumnTypes); } return null; } ODataQueryExecution(ODataExecutionFactory translator,
            QueryExpression command, ExecutionContext executionContext,
            RuntimeMetadata metadata, WSConnection connection); @Override void execute(); @Override List<?> next(); @Override void close(); @Override void cancel();  }