Package org.apache.ambari.server.controller.spi

Examples of org.apache.ambari.server.controller.spi.Predicate.evaluate()


    resource.setProperty(propertyId, 0.06);
    Assert.assertFalse(predicate.evaluate(resource));

    resource.setProperty(propertyId, 100.3);
    Assert.assertTrue(predicate.evaluate(resource));
  }
}
View Full Code Here


    String propertyId = PropertyHelper.getPropertyId("category1", "ip");

    Predicate predicate = new FilterPredicate(propertyId, IP_ADDRESS_PATTERN);

    resource.setProperty(propertyId, "monkey");
    Assert.assertFalse(predicate.evaluate(resource));

    resource.setProperty(propertyId, "10.0.0.1");
    Assert.assertTrue(predicate.evaluate(resource));

    resource.setProperty(propertyId, "127.0.0.1");
View Full Code Here

    resource.setProperty(propertyId, "monkey");
    Assert.assertFalse(predicate.evaluate(resource));

    resource.setProperty(propertyId, "10.0.0.1");
    Assert.assertTrue(predicate.evaluate(resource));

    resource.setProperty(propertyId, "127.0.0.1");
    Assert.assertTrue(predicate.evaluate(resource));

    resource.setProperty(propertyId, "0.0.0.0");
View Full Code Here

    resource.setProperty(propertyId, "10.0.0.1");
    Assert.assertTrue(predicate.evaluate(resource));

    resource.setProperty(propertyId, "127.0.0.1");
    Assert.assertTrue(predicate.evaluate(resource));

    resource.setProperty(propertyId, "0.0.0.0");
    Assert.assertTrue(predicate.evaluate(resource));

    propertyId = PropertyHelper.getPropertyId("category1", "fun");
View Full Code Here

    resource.setProperty(propertyId, "127.0.0.1");
    Assert.assertTrue(predicate.evaluate(resource));

    resource.setProperty(propertyId, "0.0.0.0");
    Assert.assertTrue(predicate.evaluate(resource));

    propertyId = PropertyHelper.getPropertyId("category1", "fun");
    predicate = new FilterPredicate(propertyId, IP_ADDRESS_PATTERN);

    Assert.assertFalse(predicate.evaluate(resource));
View Full Code Here

    Assert.assertTrue(predicate.evaluate(resource));

    propertyId = PropertyHelper.getPropertyId("category1", "fun");
    predicate = new FilterPredicate(propertyId, IP_ADDRESS_PATTERN);

    Assert.assertFalse(predicate.evaluate(resource));
  }

  @Test
  public void testApplyNullValue() {
    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
View Full Code Here

    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
    String propertyId = PropertyHelper.getPropertyId("category1", "foo");
    Predicate predicate = new FilterPredicate(propertyId, null);

    resource.setProperty(propertyId, "monkey");
    Assert.assertFalse(predicate.evaluate(resource));

    resource.setProperty(propertyId, null);
    Assert.assertTrue(predicate.evaluate(resource));
  }
View Full Code Here

    resource.setProperty(propertyId, "monkey");
    Assert.assertFalse(predicate.evaluate(resource));

    resource.setProperty(propertyId, null);
    Assert.assertTrue(predicate.evaluate(resource));
  }

  @Test
  public void testApplyEmptyValue() {
    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
View Full Code Here

    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
    String propertyId = PropertyHelper.getPropertyId("category1", "foo");
    Predicate predicate = new FilterPredicate(propertyId, "");

    resource.setProperty(propertyId, "monkey");
    Assert.assertFalse(predicate.evaluate(resource));

    predicate = new FilterPredicate(propertyId, "monkey");
    Assert.assertTrue(predicate.evaluate(resource));
  }
View Full Code Here

    resource.setProperty(propertyId, "monkey");
    Assert.assertFalse(predicate.evaluate(resource));

    predicate = new FilterPredicate(propertyId, "monkey");
    Assert.assertTrue(predicate.evaluate(resource));
  }

  @Test
  public void testGetProperties() {
    String propertyId = PropertyHelper.getPropertyId("category1", "foo");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.