Package org.jwall.web.audit.rules.operators

Examples of org.jwall.web.audit.rules.operators.ConditionEQ


  @Test
  public void testCountOperator() {
    try {
      AuditEventRule rule = new AuditEventRule();

      Condition condition = new ConditionEQ("&REQUEST_HEADERS:Host", "1");
      rule.add(condition);

      boolean matches = rule.matches(event, null);

      if (!matches)
View Full Code Here


  }

 
  @Test
  public void testMatchesListOfString() throws Exception {
    ConditionEQ eq = new ConditionEQ( "", "B" );
    boolean rc = eq.matches( positive );
    Assert.assertTrue( rc );
  }
View Full Code Here

    Assert.assertTrue( rc );
  }
 
  @Test
  public void testNegated() throws Exception {
    ConditionEQ eq = new ConditionEQ( "", "!B" );
    boolean rc = eq.matches( positive );
    Assert.assertFalse( rc );
  }
View Full Code Here

    @Test
    public void testCountOperator()
    {
        try {
            Condition c = new ConditionEQ( "&REQUEST_HEADERS:Host", "1" );
            if( ! c.matches( event ) )
                fail( "Count-operator failed!" );

        } catch (Exception e) {
            e.printStackTrace();
            fail( "Error: '" + e.getMessage() + "'" );
View Full Code Here

        try {
            String sev = event.get( "REQUEST_HEADERS:Host" );
            log.info( "  event.get('REQUEST_HEADERS:Host') = " + sev );

            log.info( "Testing  REQUEST_HEADERS:Host @eq www.jwall.org" );
            Condition c = new ConditionEQ( "REQUEST_HEADERS:Host", sev );
            if( !c.matches( event ) )
                fail( "Failed to match ConditionEQ on REQUEST_HEADERS:Host with value = '" + sev + "' !" );
        } catch (Exception e) {
            fail( "Error: " + e.getMessage() );
        }
    }
View Full Code Here

 
  @Test
  public void testRuleID() throws Exception {
    AuditEventRule rule = new AuditEventRule();
    rule.add( new ConditionEQ( "RULE_ID", "960015" ) );
    rule.add( new MockAction() );
    Assert.assertTrue( rule.matches( event, null ) );
  }
View Full Code Here

    if( test.canRead() ){
      AuditEventReader reader = new ModSecurity2AuditReader( test );
      event = reader.readNext();
      log.info( "ScriptEvent is: {}", event.getEventId() );
      AuditEventRule rule = new AuditEventRule();
      rule.add( new ConditionEQ( "RULE_ID", "113" ) );
      rule.add( new MockAction() );
      Assert.assertTrue( rule.matches( event, null ) );
    }   
  }
View Full Code Here

TOP

Related Classes of org.jwall.web.audit.rules.operators.ConditionEQ

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.