Package net.raymanoz.util

Examples of net.raymanoz.util.Properties


    return PlainProperties.createFromResource("uMigrate.properties");
  }

  private void registerCommands(CmdLineArgumentsAndSwitches cmdln) {

    Properties uMigrateProperties = uMigrateProperties(cmdln);
    ApplicationProperties applicationProperties = new ApplicationPropertiesImpl(uMigrateProperties);
    FileUtil fileUtil = new FileUtilImpl(new StreamUtilImpl());
    ConfigurationImpl configuration = new ConfigurationImpl(applicationProperties, fileUtil, uMigrateProperties);
    ConditionHandlerListAssembler.setupConditions(configuration);
    CommandAssemblerImpl commandAssembler = new CommandAssemblerImpl(configuration);
View Full Code Here


   * Launch the application.
   * @throws InterruptedException
   */
 
  static Configuration defaultConfig(){
    Properties uMigrateProperties = PlainProperties.createFromResource("uMigrate.properties");
    ApplicationProperties applicationProperties = new ApplicationPropertiesImpl(uMigrateProperties);
    FileUtil fileUtil = new FileUtilImpl(new StreamUtilImpl());
    return new ConfigurationImpl(applicationProperties, fileUtil, uMigrateProperties);
  }
View Full Code Here

  private JProgressBar progressBar;
  private JTextPane txtStatus;
 
  boolean updatePropertiesValues(String desc, Set<String> properties){
    if (properties == null || properties.size() == 0) return true;
    Properties uMigrateProperties = config.uMigrateProperties();
    Map<String, String> map = MissingPropertyDialog.askForValues(properties, uMigrateProperties, desc);
    if (map == null) return false;
    for(Entry<String, String> m: map.entrySet()){
      uMigrateProperties.setProperty(m.getKey(), m.getValue());
    }
    return true;
  }
View Full Code Here

  }
 
  @Test
  public void shouldNotReplaceVariablesNotInProperties() throws IOException {
    String findVariable = "findMe";
    Properties properties = new PlainProperties(findVariable + "=replaced");
    VariableEvaluaterImpl evaluater  = new VariableEvaluaterImpl(properties);
    assertEquals("Variables were not replaced correctly", "${ignoreMe} replaced", evaluater.replaceAllVariables("${ignoreMe} ${findMe}"));
  }
View Full Code Here

  }
 
  @Test
  public void shouldBeAbleToReplaceAVariableWithADotInIt() throws IOException {
    String findVariable = "script.name";
    Properties properties = new PlainProperties(findVariable + "=doit.sql");
    VariableEvaluaterImpl evaluater = new VariableEvaluaterImpl(properties);
    assertEquals("Variables were not replaced correctly", "find this variable: doit.sql",
        evaluater.replaceAllVariables("find this variable: ${" + findVariable + "}"));
  }
View Full Code Here

  }

  @Test
  public void shouldHandleBackSlashInVariable() throws IOException {
    String findVariable = "sql";
    Properties properties = new PlainProperties(findVariable + "='\\\\'");
    assertEquals("'\\'", properties.getProperty(findVariable));
    VariableEvaluaterImpl evaluater = new VariableEvaluaterImpl(properties);
    assertEquals("Variables were not replaced correctly", "find this variable: '\\'",
        evaluater.replaceAllVariables("find this variable: ${" + findVariable + "}"));
  }
View Full Code Here

  }
 
  @Test
  public void shouldHandleEscapedDollarInVariable() throws IOException {
    String findVariable = "sql";
    Properties properties = new PlainProperties(findVariable + "=\\$");
    VariableEvaluaterImpl evaluater = new VariableEvaluaterImpl(properties);
    assertEquals("Variables were not replaced correctly", "find this variable: $",
        evaluater.replaceAllVariables("find this variable: ${" + findVariable + "}"));
  }
View Full Code Here

    chk("to ${acc_mosaic_importer};", "to mosaic_importer;")
  }
 
  @Test
  public void transferParameteriserProperties(){
    final Properties uMigrateProperties = mock(Properties.class);
    final Properties scriptProperties = mock(Properties.class);
    doThrow(new NullPointerException()).when(scriptProperties).setProperty(anyString(), (String) eq(null));
    when(uMigrateProperties.getProperty(UMigrateProperty.PARAMETERISER_PROPERTIES.getKey())).thenReturn("acc_mosaic_importer,acc_mosaic,an_undefined_param,emptystr_param");
    when(uMigrateProperties.getProperty("acc_mosaic_importer")).thenReturn("mosaic_importer");
    when(uMigrateProperties.getProperty("acc_mosaic")).thenReturn("mosaic");
    when(uMigrateProperties.getProperty("an_undefined_param")).thenReturn(null);
View Full Code Here

    verifyNoMoreInteractions(uMigrateProperties, scriptProperties);
  }

  @Test
  public void transferParameteriserPropertiesNullParamertiserProperty(){
    final Properties uMigrateProperties = mock(Properties.class);
    final Properties scriptProperties = mock(Properties.class);
    doThrow(new NullPointerException()).when(scriptProperties).setProperty(anyString(), (String) eq(null));

    when(uMigrateProperties.getProperty(UMigrateProperty.PARAMETERISER_PROPERTIES.getKey())).thenReturn(null);
   
    ParameteriserImpl.transferParameteriserProperties(uMigrateProperties, scriptProperties);
View Full Code Here

TOP

Related Classes of net.raymanoz.util.Properties

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.