Search in sources :

Example 41 with ResultSet

use of com.google.api.ads.admanager.jaxws.v202205.ResultSet in project googleads-java-lib by googleads.

the class PqlTest method testCombineResultSet.

@Test
public void testCombineResultSet() {
    Row row1 = new Row();
    row1.setValues(new Value[] { textValue1, booleanValue1, numberValue1 });
    Row row2 = new Row();
    row2.setValues(new Value[] { textValue2, booleanValue2, numberValue2 });
    Row row3 = new Row();
    row3.setValues(new Value[] { textValue3, booleanValue3, numberValue3 });
    ResultSet resultSet1 = new ResultSet();
    resultSet1.setColumnTypes(new ColumnType[] { column1, column2, column3 });
    resultSet1.setRows(new Row[] { row1, row2 });
    ResultSet resultSet2 = new ResultSet();
    resultSet2.setColumnTypes(new ColumnType[] { column1, column2, column3 });
    resultSet2.setRows(new Row[] { row3 });
    ResultSet combinedResultSet = Pql.combineResultSets(resultSet1, resultSet2);
    assertEquals(3, combinedResultSet.getRows().length);
    assertArrayEquals(new ColumnType[] { column1, column2, column3 }, combinedResultSet.getColumnTypes());
    assertArrayEquals(new Value[] { textValue1, booleanValue1, numberValue1 }, combinedResultSet.getRows()[0].getValues());
    assertArrayEquals(new Value[] { textValue2, booleanValue2, numberValue2 }, combinedResultSet.getRows()[1].getValues());
    assertArrayEquals(new Value[] { textValue3, booleanValue3, numberValue3 }, combinedResultSet.getRows()[2].getValues());
}
Also used : ResultSet(com.google.api.ads.admanager.axis.v202111.ResultSet) Row(com.google.api.ads.admanager.axis.v202111.Row) Test(org.junit.Test)

Example 42 with ResultSet

use of com.google.api.ads.admanager.jaxws.v202205.ResultSet in project googleads-java-lib by googleads.

the class PqlTest method testCombineResultSet_badColumns.

@Test
public void testCombineResultSet_badColumns() {
    Row row1 = new Row();
    row1.setValues(new Value[] { textValue1, booleanValue1, numberValue1 });
    Row row2 = new Row();
    row2.setValues(new Value[] { textValue2, booleanValue2, numberValue2 });
    Row row3 = new Row();
    row3.setValues(new Value[] { textValue3, booleanValue3 });
    ResultSet resultSet1 = new ResultSet();
    resultSet1.setColumnTypes(new ColumnType[] { column1, column2, column3 });
    resultSet1.setRows(new Row[] { row1, row2 });
    ResultSet resultSet2 = new ResultSet();
    resultSet2.setColumnTypes(new ColumnType[] { column1, column2 });
    resultSet2.setRows(new Row[] { row3 });
    thrown.expect(IllegalArgumentException.class);
    Pql.combineResultSets(resultSet1, resultSet2);
}
Also used : ResultSet(com.google.api.ads.admanager.axis.v202111.ResultSet) Row(com.google.api.ads.admanager.axis.v202111.Row) Test(org.junit.Test)

Example 43 with ResultSet

use of com.google.api.ads.admanager.jaxws.v202205.ResultSet in project googleads-java-lib by googleads.

the class PqlTest method testGetColumnLabels.

@Test
public void testGetColumnLabels() {
    ResultSet resultSet = new ResultSet();
    resultSet.setColumnTypes(new ColumnType[] { column1, column2, column3 });
    assertEquals(Lists.newArrayList(new String[] { "column1", "column2", "column3" }), Pql.getColumnLabels(resultSet));
}
Also used : ResultSet(com.google.api.ads.admanager.axis.v202202.ResultSet) Test(org.junit.Test)

Example 44 with ResultSet

use of com.google.api.ads.admanager.jaxws.v202205.ResultSet in project googleads-java-lib by googleads.

the class PqlTest method testCombineResultSet.

@Test
public void testCombineResultSet() {
    Row row1 = new Row();
    row1.setValues(new Value[] { textValue1, booleanValue1, numberValue1 });
    Row row2 = new Row();
    row2.setValues(new Value[] { textValue2, booleanValue2, numberValue2 });
    Row row3 = new Row();
    row3.setValues(new Value[] { textValue3, booleanValue3, numberValue3 });
    ResultSet resultSet1 = new ResultSet();
    resultSet1.setColumnTypes(new ColumnType[] { column1, column2, column3 });
    resultSet1.setRows(new Row[] { row1, row2 });
    ResultSet resultSet2 = new ResultSet();
    resultSet2.setColumnTypes(new ColumnType[] { column1, column2, column3 });
    resultSet2.setRows(new Row[] { row3 });
    ResultSet combinedResultSet = Pql.combineResultSets(resultSet1, resultSet2);
    assertEquals(3, combinedResultSet.getRows().length);
    assertArrayEquals(new ColumnType[] { column1, column2, column3 }, combinedResultSet.getColumnTypes());
    assertArrayEquals(new Value[] { textValue1, booleanValue1, numberValue1 }, combinedResultSet.getRows()[0].getValues());
    assertArrayEquals(new Value[] { textValue2, booleanValue2, numberValue2 }, combinedResultSet.getRows()[1].getValues());
    assertArrayEquals(new Value[] { textValue3, booleanValue3, numberValue3 }, combinedResultSet.getRows()[2].getValues());
}
Also used : ResultSet(com.google.api.ads.admanager.axis.v202202.ResultSet) Row(com.google.api.ads.admanager.axis.v202202.Row) Test(org.junit.Test)

Example 45 with ResultSet

use of com.google.api.ads.admanager.jaxws.v202205.ResultSet in project googleads-java-lib by googleads.

the class PqlTest method testCombineResultSet_badColumns.

@Test
public void testCombineResultSet_badColumns() {
    Row row1 = new Row();
    row1.setValues(new Value[] { textValue1, booleanValue1, numberValue1 });
    Row row2 = new Row();
    row2.setValues(new Value[] { textValue2, booleanValue2, numberValue2 });
    Row row3 = new Row();
    row3.setValues(new Value[] { textValue3, booleanValue3 });
    ResultSet resultSet1 = new ResultSet();
    resultSet1.setColumnTypes(new ColumnType[] { column1, column2, column3 });
    resultSet1.setRows(new Row[] { row1, row2 });
    ResultSet resultSet2 = new ResultSet();
    resultSet2.setColumnTypes(new ColumnType[] { column1, column2 });
    resultSet2.setRows(new Row[] { row3 });
    thrown.expect(IllegalArgumentException.class);
    Pql.combineResultSets(resultSet1, resultSet2);
}
Also used : ResultSet(com.google.api.ads.admanager.axis.v202202.ResultSet) Row(com.google.api.ads.admanager.axis.v202202.Row) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)37 ResultSet (com.google.spanner.v1.ResultSet)21 PartialResultSet (com.google.spanner.v1.PartialResultSet)14 ResultSet (com.google.api.ads.admanager.axis.v202108.ResultSet)12 ResultSet (com.google.api.ads.admanager.axis.v202111.ResultSet)12 ResultSet (com.google.api.ads.admanager.axis.v202202.ResultSet)12 ResultSet (com.google.api.ads.admanager.axis.v202205.ResultSet)12 Function (com.google.common.base.Function)10 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder)8 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder)8 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder)8 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder)8 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202108.PublisherQueryLanguageServiceInterface)8 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202111.PublisherQueryLanguageServiceInterface)8 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202202.PublisherQueryLanguageServiceInterface)8 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202205.PublisherQueryLanguageServiceInterface)8 Session (com.google.spanner.v1.Session)8 DateTime (org.joda.time.DateTime)8 ListValue (com.google.protobuf.ListValue)5 ResultSet (org.apache.cassandra.cql3.ResultSet)5