Package ch.inftec.ju.util

Examples of ch.inftec.ju.util.RegexUtil


    Assert.assertEquals("", lines.get(1));
    Assert.assertEquals("# This is my little secret file...", lines.get(2));
    Assert.assertTrue(lines.get(3).startsWith("secretProperty=ENC("));
   
    // Check encrypted value
    String encryptedVal = new RegexUtil(".*ENC\\((.*)\\)").getMatches(lines.get(3))[0].getGroups()[0];
    Assert.assertEquals("myPrecious", encryptor.decrypt(encryptedVal));
   
    // Make sure already encrypted values are not changed
    Assert.assertEquals("anoterSecret=ENC(alreadyEncrypted)", lines.get(4));
  }
View Full Code Here


    Assert.assertEquals(";Normal Value;", lines.get(1));
    Assert.assertEquals(";;", lines.get(2));
    Assert.assertTrue(lines.get(3).startsWith("#Come Comment;ENC(alreadyEncrypted);"));
   
    // Check encrypted value
    String encryptedVal = new RegexUtil(".*ENC\\((.*)\\)$").getMatches(lines.get(3))[0].getGroups()[0];
    Assert.assertEquals("myPrecious", encryptor.decrypt(encryptedVal));
  }
View Full Code Here

    Assert.assertEquals("NormalValue;", lines.get(0));
   
    // Check first encrypted value
    Assert.assertTrue(lines.get(1).startsWith("\"ENC("));
    Assert.assertTrue(lines.get(1).endsWith(")\";another value"));
    String encryptedVal1 = new RegexUtil("\"ENC\\((.*)\\)").getMatches(lines.get(1))[0].getGroups()[0];
    Assert.assertEquals("secret(;)", encryptor.decrypt(encryptedVal1));
   
    // Check second encrypted value
    Assert.assertTrue(lines.get(2).startsWith("\"ENC("));
    Assert.assertTrue(lines.get(2).endsWith(")\";"));
    String encryptedVal2 = new RegexUtil("\"ENC\\((.*)\\)").getMatches(lines.get(2))[0].getGroups()[0];
    Assert.assertEquals("\"secret;\"", encryptor.decrypt(encryptedVal2));
   
  }
View Full Code Here

        excludedPatterns = new ArrayList<>();
        this.excludedPatterns.put(filter, excludedPatterns);
       
        if (this.chain != null && filter != null) {
          for (String includeFilter : filter.includes) {
            includedPatterns.add(new RegexUtil(includeFilter));
          }
          for (String excludeFilter : filter.excludes) {
            excludedPatterns.add(new RegexUtil(excludeFilter));
          }
        }
      }
     
      for (RegexUtil ru :excludedPatterns) {
View Full Code Here

   
    @Override
    public SchemaInfo getSchemaInfo() {
      if (this.connUtil.getDbType() == DbType.MYSQL) {
        // Get the Schema info from the URL (has the form jdbc:mysql://host/schema)
        RegexUtil ru = new RegexUtil(".*/([^/]+)");
        if (!ru.matches(this.getUrl())) {
          return null;
        } else {
          String schemaName = ru.getMatches(this.getUrl())[0].getGroups()[0];
          return new SchemaInfoImpl(schemaName, null);             
        }
      } else if (this.connUtil.getDbType() == DbType.ORACLE){
        return new SchemaInfoImpl(this.getUserName(), null);
      } else {
View Full Code Here

        excludedPatterns = new ArrayList<>();
        this.excludedPatterns.put(filter, excludedPatterns);
       
        if (this.chain != null && filter != null) {
          for (String includeFilter : filter.includes) {
            includedPatterns.add(new RegexUtil(includeFilter));
          }
          for (String excludeFilter : filter.excludes) {
            excludedPatterns.add(new RegexUtil(excludeFilter));
          }
        }
      }
     
      for (RegexUtil ru :excludedPatterns) {
View Full Code Here

TOP

Related Classes of ch.inftec.ju.util.RegexUtil

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.