Search in sources :

Example 6 with Statement

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

the class StatementBuilderTest method testOrderBy.

@Test
public void testOrderBy() {
    StatementBuilder statementBuilder = new StatementBuilder();
    Statement statement = statementBuilder.orderBy("id ASC").toStatement();
    assertEquals("ORDER BY id ASC", statement.getQuery());
}
Also used : Statement(com.google.api.ads.admanager.axis.v202105.Statement) Test(org.junit.Test)

Example 7 with Statement

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

the class StatementBuilderTest method testFrom.

@Test
public void testFrom() {
    StatementBuilder statementBuilder = new StatementBuilder();
    Statement statement = statementBuilder.from("line_item").toStatement();
    assertEquals("FROM line_item", statement.getQuery());
}
Also used : Statement(com.google.api.ads.admanager.axis.v202105.Statement) Test(org.junit.Test)

Example 8 with Statement

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

the class StatementBuilderTest method testBindVariables_bool.

@Test
public void testBindVariables_bool() {
    StatementBuilder statementBuilder = new StatementBuilder();
    Statement statement = statementBuilder.where("bool = :bool").withBindVariableValue("bool", true).toStatement();
    String_ValueMapEntry entry = statement.getValues(0);
    assertEquals("bool", entry.getKey());
    assertEquals(BooleanValue.class, entry.getValue().getClass());
    assertEquals(true, ((BooleanValue) entry.getValue()).getValue());
}
Also used : String_ValueMapEntry(com.google.api.ads.admanager.axis.v202105.String_ValueMapEntry) Statement(com.google.api.ads.admanager.axis.v202105.Statement) Test(org.junit.Test)

Example 9 with Statement

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

the class StatementBuilderTest method testLimitOffsetDefaults.

@Test
public void testLimitOffsetDefaults() {
    StatementBuilder statementBuilder = new StatementBuilder();
    Statement initialOffset = statementBuilder.limit(100).toStatement();
    assertEquals("LIMIT 100", initialOffset.getQuery());
    Statement increasedOffset = statementBuilder.increaseOffsetBy(100).toStatement();
    assertEquals("LIMIT 100 OFFSET 100", increasedOffset.getQuery());
}
Also used : Statement(com.google.api.ads.admanager.axis.v202105.Statement) Test(org.junit.Test)

Example 10 with Statement

use of com.google.api.ads.admanager.axis.v202205.Statement in project sunbird-rc-core by Sunbird-RC.

the class Neo4jGraphProvider method createUniqueIndex.

@Override
public void createUniqueIndex(Graph graph, String label, List<String> propertyNames) {
    Neo4JGraph neo4jGraph = (Neo4JGraph) graph;
    if (propertyNames.size() > 0) {
        for (String propertyName : propertyNames) {
            Objects.requireNonNull(label, "label cannot be null");
            Objects.requireNonNull(propertyName, "propertyName cannot be null");
            neo4jGraph.execute(new Statement("CREATE CONSTRAINT ON (n:" + label + ") ASSERT n." + propertyName + " IS UNIQUE"));
            logger.info("Neo4jGraph unique index created for " + label);
        }
    } else {
        logger.info("Could not create unique index for empty properties");
    }
}
Also used : Statement(org.neo4j.driver.v1.Statement) Neo4JGraph(com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph)

Aggregations

StatementBuilder (com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder)119 Test (org.junit.Test)77 UpdateResult (com.google.api.ads.admanager.axis.v202205.UpdateResult)18 Statement (com.google.api.ads.admanager.axis.v202105.Statement)16 Statement (com.google.api.ads.admanager.axis.v202108.Statement)16 Statement (com.google.api.ads.admanager.axis.v202111.Statement)16 Statement (com.google.api.ads.admanager.axis.v202202.Statement)16 Statement (com.google.api.ads.admanager.axis.v202205.Statement)16 CustomTargetingServiceInterface (com.google.api.ads.admanager.axis.v202205.CustomTargetingServiceInterface)8 InventoryServiceInterface (com.google.api.ads.admanager.axis.v202205.InventoryServiceInterface)8 AdUnit (com.google.api.ads.admanager.axis.v202205.AdUnit)7 AdUnitPage (com.google.api.ads.admanager.axis.v202205.AdUnitPage)7 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202205.PublisherQueryLanguageServiceInterface)7 ResultSet (com.google.api.ads.admanager.axis.v202205.ResultSet)7 Statement (org.neo4j.driver.v1.Statement)5 String_ValueMapEntry (com.google.api.ads.admanager.axis.v202105.String_ValueMapEntry)4 String_ValueMapEntry (com.google.api.ads.admanager.axis.v202108.String_ValueMapEntry)4 String_ValueMapEntry (com.google.api.ads.admanager.axis.v202111.String_ValueMapEntry)4 String_ValueMapEntry (com.google.api.ads.admanager.axis.v202202.String_ValueMapEntry)4 CustomFieldServiceInterface (com.google.api.ads.admanager.axis.v202205.CustomFieldServiceInterface)4