Package ch.inftec.ju.util.PropertyChain

Examples of ch.inftec.ju.util.PropertyChain.PropertyInfo


  @Test
  public void propertyInfo_isNull_forNonExistingKey() {
    PropertyChain pc = createPropertiesChain(true,
        "p1", "v1");
   
    PropertyInfo pi = pc.getInfo("p2");
    Assert.assertNull(pi);
  }
View Full Code Here


  @Test
  public void canGet_propertyInfo_forRegularProperty() {
    PropertyChain pc = createPropertiesChain(true,
        "p1", "v1");
   
    PropertyInfo pi = pc.getInfo("p1");
   
    // Check PropertyInfo
    Assert.assertEquals("p1", pi.getKey());
    Assert.assertEquals("v1", pi.getValue());
    Assert.assertEquals("v1", pi.getRawValue());
    Assert.assertEquals("v1", pi.getDisplayValue());
    Assert.assertFalse(pi.isSensitive());
    Assert.assertEquals("PropertyChainBuilder.PropertiesPropertyEvaluator[]", pi.getEvaluatorInfo());
  }
View Full Code Here

  public void canGet_propertyInfo_forInterpolatedValue() {
    PropertyChain pc = createPropertiesChain(true,
        "p1", "${p2}",
        "p2", "v2");
   
    PropertyInfo pi = pc.getInfo("p1");
   
    // Check PropertyInfo
    Assert.assertEquals("p1", pi.getKey());
    Assert.assertEquals("v2", pi.getValue());
    Assert.assertEquals("${p2}", pi.getRawValue());
    Assert.assertEquals("v2", pi.getDisplayValue());
    Assert.assertFalse(pi.isSensitive());
    Assert.assertEquals("PropertyChainBuilder.PropertiesPropertyEvaluator[]", pi.getEvaluatorInfo());
  }
View Full Code Here

      .addResourcePropertyEvaluator("ch/inftec/ju/util/PropertyChainTest_encryption.properties", false)
      .setDecryptor(encryptor)
      .interpolation().enable(true).done()
      .getPropertyChain();
   
    PropertyInfo pi = chain.getInfo("encString");
   
    // Check PropertyInfo
    Assert.assertEquals("encString", pi.getKey());
    Assert.assertEquals("secret String", pi.getValue());
    Assert.assertEquals("ENC(bSmw4g8BdopiLClgC7zU2Kwr0LyRqj79)", pi.getRawValue());
    Assert.assertEquals("***", pi.getDisplayValue());
    Assert.assertTrue(pi.isSensitive());
    Assert.assertTrue(pi.getEvaluatorInfo().startsWith("PropertyChainBuilder.PropertiesPropertyEvaluator[url="));
  }
View Full Code Here

      PropertyChain chain = chainBuilder.getPropertyChain();
      Set<String> keys = chain.listKeys();
     
      for (String key : keys) {
        if (this.isIncluded(key, this.chain.filter, true)) {
          PropertyInfo pi = chain.getInfo(key);
         
          this.project.getProperties().put(key, pi.getValue());
         
          boolean exportToSystemProperties = this.isIncluded(key, this.chain.exportToSystemProperty, false)
              || exportedProperty.contains(key);
          if (exportToSystemProperties) {
            System.setProperty(key, pi.getValue());
          }
          if (this.chain.logAddedKeys) {
            String addedKeyLog = String.format("Added key: %s=%s", key, pi.getDisplayValue());
            if (exportToSystemProperties) addedKeyLog += " (-> sys-export)";
            this.getLog().info(addedKeyLog);
          }
        }
      }
View Full Code Here

      PropertyChain chain = chainBuilder.getPropertyChain();
      Set<String> keys = chain.listKeys();
     
      for (String key : keys) {
        if (this.isIncluded(key, this.chain.filter, true)) {
          PropertyInfo pi = chain.getInfo(key);
         
          this.project.getProperties().put(key, pi.getValue());
         
          boolean exportToSystemProperties = this.isIncluded(key, this.chain.exportToSystemProperty, false)
              || exportedProperty.contains(key);
          if (exportToSystemProperties) {
            System.setProperty(key, pi.getValue());
          }
          if (this.chain.logAddedKeys) {
            String addedKeyLog = String.format("Added key: %s=%s", key, pi.getDisplayValue());
            if (exportToSystemProperties) addedKeyLog += " (-> sys-export)";
            this.getLog().info(addedKeyLog);
          }
        }
      }
View Full Code Here

TOP

Related Classes of ch.inftec.ju.util.PropertyChain.PropertyInfo

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.