예제 #1
0
 @Test
 public void testWhitespaceOnlyGsaHostname() {
   // Requires gsa.hostname to be non-empty
   config.setValue("gsa.hostname", "  ");
   thrown.expect(InvalidConfigurationException.class);
   config.validate();
 }
예제 #2
0
 /**
  * Load default configuration file and parse command line options.
  *
  * @return unused command line arguments
  * @throws IllegalStateException when not all configuration keys have values
  */
 static String[] autoConfig(Config config, String[] args, File configFile) {
   File sysPropertiesAdditions = null;
   int i;
   for (i = 0; i < args.length; i++) {
     if (!args[i].startsWith("-D")) {
       break;
     }
     String arg = args[i].substring(2);
     String[] parts = arg.split("=", 2);
     if (parts.length < 2) {
       break;
     }
     if ("adaptor.configfile".equals(parts[0])) {
       configFile = new File(parts[1]);
     } else if ("sys.properties.file".equals(parts[0])) {
       sysPropertiesAdditions = new File(parts[1]);
     } else {
       config.setValue(parts[0], parts[1]);
     }
   }
   processSystemProperties(sysPropertiesAdditions);
   loadConfigFile(config, configFile);
   config.validate();
   if (i == 0) {
     return args;
   } else {
     return Arrays.copyOfRange(args, i, args.length);
   }
 }
예제 #3
0
 /**
  * Construct a new QueuePool instance based on the given {@link Config}.
  *
  * @param config The pool configuration to use.
  */
 public QueuePool(Config<T> config) {
   live = new LinkedTransferQueue<>();
   dead = new LinkedTransferQueue<>();
   synchronized (config) {
     config.validate();
     ThreadFactory factory = config.getThreadFactory();
     metricsRecorder = config.getMetricsRecorder();
     expiration = config.getExpiration();
     allocator = new QAllocThread<>(live, dead, config, poisonPill);
     allocatorThread = factory.newThread(allocator);
   }
   allocatorThread.start();
 }
예제 #4
0
 @Test
 public void testNoInputLoad() {
   // Requires gsa.hostname to be set
   thrown.expect(InvalidConfigurationException.class);
   config.validate();
 }
  public void addPhaseListener(Class cl) {
    Config.validate(cl, PhaseListener.class);

    _phaseListenerList.add(cl);
  }