Package com.linkedin.data.it

Examples of com.linkedin.data.it.Predicate


  }

  @Test
  public void testNotParen()
  {
    final Predicate parsed = PredicateExpressionParser.parse("!(com.linkedin.data.it.AlwaysTruePredicate)");
    Assert.assertEquals(parsed.getClass(), NotPredicate.class);
    Assert.assertEquals(((NotPredicate) parsed).getChildPredicate().getClass(), AlwaysTruePredicate.class);
  }
View Full Code Here


  }

  @Test
  public void testDoubleNotParen()
  {
    final Predicate parsed = PredicateExpressionParser.parse("(!(!(com.linkedin.data.it.AlwaysTruePredicate)))");
    Assert.assertEquals(parsed.getClass(), NotPredicate.class);

    final Predicate intermediate1 = ((NotPredicate) parsed).getChildPredicate();
    Assert.assertEquals(intermediate1.getClass(), NotPredicate.class);

    final Predicate intermediate2 = ((NotPredicate) intermediate1).getChildPredicate();
    Assert.assertEquals(intermediate2.getClass(), AlwaysTruePredicate.class);
  }
View Full Code Here

  }

  @Test
  public void testNotParenAnd()
  {
    final Predicate parsed = PredicateExpressionParser.parse("!(com.linkedin.data.it.AlwaysTruePredicate & com.linkedin.data.it.AlwaysFalsePredicate)");
    Assert.assertEquals(parsed.getClass(), NotPredicate.class);

    final Predicate intermediate = ((NotPredicate) parsed).getChildPredicate();
    Assert.assertEquals(intermediate.getClass(), AndPredicate.class);

    final List<Predicate> children = ((AndPredicate) intermediate).getChildPredicates();
    Assert.assertEquals(children.get(0).getClass(), AlwaysTruePredicate.class);
    Assert.assertEquals(children.get(1).getClass(), AlwaysFalsePredicate.class);
  }
View Full Code Here

  }

  @Test
  public void testNotParenOr()
  {
    final Predicate parsed = PredicateExpressionParser.parse("!(com.linkedin.data.it.AlwaysTruePredicate | com.linkedin.data.it.AlwaysFalsePredicate)");
    Assert.assertEquals(parsed.getClass(), NotPredicate.class);

    final Predicate intermediate = ((NotPredicate) parsed).getChildPredicate();
    Assert.assertEquals(intermediate.getClass(), OrPredicate.class);

    final List<Predicate> children = ((OrPredicate) intermediate).getChildPredicates();
    Assert.assertEquals(children.get(0).getClass(), AlwaysTruePredicate.class);
    Assert.assertEquals(children.get(1).getClass(), AlwaysFalsePredicate.class);
  }
View Full Code Here

  }

  @Test
  public void testAndParenOr()
  {
    final Predicate parsed = PredicateExpressionParser.parse("com.linkedin.data.it.AlwaysTruePredicate & (com.linkedin.data.it.AlwaysTruePredicate | com.linkedin.data.it.AlwaysFalsePredicate)");
    Assert.assertEquals(parsed.getClass(), AndPredicate.class);

    final List<Predicate> andChildren = ((AndPredicate) parsed).getChildPredicates();
    Assert.assertEquals(andChildren.get(0).getClass(), AlwaysTruePredicate.class);
    Assert.assertEquals(andChildren.get(1).getClass(), OrPredicate.class);
View Full Code Here

  }

  @Test
  public void testOrParenAnd()
  {
    final Predicate parsed = PredicateExpressionParser.parse("(com.linkedin.data.it.AlwaysTruePredicate | com.linkedin.data.it.AlwaysTruePredicate) & com.linkedin.data.it.AlwaysFalsePredicate");
    Assert.assertEquals(parsed.getClass(), AndPredicate.class);

    final List<Predicate> andChildren = ((AndPredicate) parsed).getChildPredicates();
    Assert.assertEquals(andChildren.get(0).getClass(), OrPredicate.class);
    Assert.assertEquals(andChildren.get(1).getClass(), AlwaysFalsePredicate.class);
View Full Code Here

  }

  @Test
  public void testNotAndParenOr()
  {
    final Predicate parsed = PredicateExpressionParser.parse("!com.linkedin.data.it.AlwaysTruePredicate & !(com.linkedin.data.it.AlwaysTruePredicate | com.linkedin.data.it.AlwaysFalsePredicate)");
    Assert.assertEquals(parsed.getClass(), AndPredicate.class);

    final List<Predicate> andChildren = ((AndPredicate) parsed).getChildPredicates();
    Assert.assertEquals(andChildren.get(0).getClass(), NotPredicate.class);
    Assert.assertEquals(andChildren.get(1).getClass(), NotPredicate.class);

    final Predicate notChild1 = ((NotPredicate) andChildren.get(0)).getChildPredicate();
    Assert.assertEquals(notChild1.getClass(), AlwaysTruePredicate.class);

    final Predicate notChild2 = ((NotPredicate) andChildren.get(1)).getChildPredicate();
    Assert.assertEquals(notChild2.getClass(), OrPredicate.class);

    final List<Predicate> orChildren = ((OrPredicate) notChild2).getChildPredicates();
    Assert.assertEquals(orChildren.get(0).getClass(), AlwaysTruePredicate.class);
    Assert.assertEquals(orChildren.get(1).getClass(), AlwaysFalsePredicate.class);
  }
View Full Code Here

  }

  @Test
  public void testNotOrParenAnd()
  {
    final Predicate parsed = PredicateExpressionParser.parse("!(com.linkedin.data.it.AlwaysTruePredicate | com.linkedin.data.it.AlwaysTruePredicate) & !com.linkedin.data.it.AlwaysFalsePredicate");
    Assert.assertEquals(parsed.getClass(), AndPredicate.class);

    final List<Predicate> andChildren = ((AndPredicate) parsed).getChildPredicates();
    Assert.assertEquals(andChildren.get(0).getClass(), NotPredicate.class);
    Assert.assertEquals(andChildren.get(1).getClass(), NotPredicate.class);

    final Predicate notChild1 = ((NotPredicate) andChildren.get(0)).getChildPredicate();
    Assert.assertEquals(notChild1.getClass(), OrPredicate.class);

    final Predicate notChild2 = ((NotPredicate) andChildren.get(1)).getChildPredicate();
    Assert.assertEquals(notChild2.getClass(), AlwaysFalsePredicate.class);

    final List<Predicate> orChildren = ((OrPredicate) notChild1).getChildPredicates();
    Assert.assertEquals(orChildren.get(0).getClass(), AlwaysTruePredicate.class);
    Assert.assertEquals(orChildren.get(1).getClass(), AlwaysTruePredicate.class);
  }
View Full Code Here

    for (Object[] row : inputs)
    {
      int i = 0;
      String schemaText = (String) row[i++];
      Predicate predicate = (Predicate) row[i++];
      String avroSchemaText = (String) row[i++];

      RecordDataSchema schema = (RecordDataSchema) TestUtil.dataSchemaFromString(schemaText);
      NamedDataSchema filteredSchema = Filters.removeByPredicate(schema, predicate, new SchemaParser());
      Schema filteredAvroSchema = SchemaTranslator.dataToAvroSchema(filteredSchema);
View Full Code Here

    for (Object[] row : inputs)
    {
      int i = 0;
      String avroSchemaText = (String) row[i++];
      Predicate predicate = (Predicate) row[i++];
      String schemaText = (String) row[i++];

      Schema avroSchema = Schema.parse(avroSchemaText);
      System.out.println(avroSchema);
      RecordDataSchema schema = (RecordDataSchema) SchemaTranslator.avroToDataSchema(avroSchema);
View Full Code Here

TOP

Related Classes of com.linkedin.data.it.Predicate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.