Examples of matches()


Examples of org.jwall.web.audit.rules.operators.ConditionIN.matches()

  }

  @Test
  public void testMatchesStringString() throws Exception {
    ConditionIN in = new ConditionIN( AuditEvent.SEVERITY, "3,4" );
    Assert.assertTrue( in.matches( "3,*jwall.org", "www.jwall.org" ) );
  }


  @Test
  public void testInvertedMatche() throws Exception {

Examples of org.jwall.web.audit.rules.operators.ConditionLE.matches()

    {
        try {
            log.info( "Testing  SEVERITY @le 4" );
            log.info( "   event SEVERITY: " + ValueExtractor.extractValues( AuditEvent.SEVERITY, event ) );
            Condition c = new ConditionLE( "SEVERITY", "2" );
            if( ! c.matches( event ) )
                fail( "Failed to match ConditionLE on SEVERITY with value '2' !" );
        } catch (Exception e) {
            fail( "Error: " + e.getMessage() );
        }
    }

Examples of org.jwall.web.audit.rules.operators.ConditionLT.matches()

            AuditEvent event = reader.readNext();

            ConditionLT lt = new ConditionLT( ModSecurity.RULE_SEV, "3" );
           
            List<String> values = ValueExtractor.extractValues( ModSecurity.RULE_SEV, event );
            boolean matches = lt.matches( values );
            Assert.assertFalse( matches );
           
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail( e.getMessage() );

Examples of org.jwall.web.audit.rules.operators.ConditionPM.matches()

            log.info( "Testing  REQUEST_HEADERS:User-Agent \"@pm test alexa\"" );
            String val = event.get( "REQUEST_HEADERS:User-Agent" );
            log.info( "  event.get('REQUEST_HEADERS:User-Agent') = " + val );
            Condition c = new ConditionPM( "REQUEST_HEADERS:User-Agent", "test alexa" );
            long start = System.nanoTime();
            if( ! c.matches( event ) )
                fail( "Failed to match ConditionPM on REQUEST_HEADERS:User-Agent with value 'test alexa' !" );
            log.info( "PM-Match took " + (System.nanoTime() - start ) + " ns." );
        } catch (Exception e) {
            fail( "Error: " + e.getMessage() );
        }

Examples of org.jwall.web.audit.rules.operators.ConditionRX.matches()

        try {
            log.info( "Testing  SEVERITY @rx ^\\d$" );
            String val = event.get( "SEVERITY" );
            log.info( "  event.get('SEVERITY') = " + val );
            Condition c = new ConditionRX( "SEVERITY", "^\\d$" );
            if( ! c.matches( event ) )
                fail( "Failed to match ConditionRX on SEVERITY with value '^\\d$' !" );
        } catch (Exception e) {
            fail( "Error: " + e.getMessage() );
        }
    }

Examples of org.jwall.web.audit.rules.operators.ConditionSX.matches()

    public void testNegateMatch() throws Exception {
        log.info( "Testing negation... " );
        ConditionSX neg = new ConditionSX( "", "!*.org" );
        ConditionSX neg2 = new ConditionSX( "", "!*.org" );
        Assert.assertFalse( neg.matches( "secure.jwall.org" ) );
        Assert.assertTrue( neg2.matches( "secure.jwall.com" ) );
    }

   
    @Test
    public void testNegateMatchNoWildcard() throws Exception {

Examples of org.jwall.web.policy.TreeNode.matches()

    TreeNode dst = null;
   
    Iterator<TreeNode> it = nodes.iterator();
    while( dst == null && it.hasNext() ){
      dst = it.next();
      if(! dst.matches( node ) )
        dst = null;
    }
   
    if( dst == null ){
      nodes.add( node.copy() );

Examples of org.kitesdk.morphline.shaded.com.google.code.regexp.Matcher.matches()

        }       
        int numMatches = 0;
        for (Object value : values) {
          matcher.reset(value.toString());
          if (!findSubstrings) {
            if (matcher.matches()) {
              numMatches++;
              if (numMatches > maxMatches) {
                LOG.debug("grok failed because it found too many matches for values: {} for grok command: {}",
                          values, renderedConfig);
                return false;

Examples of org.kitesdk.morphline.shaded.org.apache.hadoop.fs.GlobPattern.matches()

public class GlobPatternTest {
  private void assertMatch(boolean yes, String glob, String...input) {
    GlobPattern pattern = new GlobPattern(glob);

    for (String s : input) {
      boolean result = pattern.matches(s);
      assertTrue(glob +" should"+ (yes ? "" : " not") +" match "+ s,
                 yes ? result : !result);
    }
  }

Examples of org.lilyproject.indexer.model.indexerconf.TypePattern.matches()

public class TypePatternTest {
    @Test
    public void testNameWildcards() throws Exception {
        TypePattern pattern = new TypePattern("STR*");

        assertTrue(pattern.matches("STRING"));
        assertFalse(pattern.matches("STING"));

        pattern = new TypePattern("STR*<STR*>");
        assertTrue(pattern.matches("STRING<STRONG>"));

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.