Package net.jini.config

Examples of net.jini.config.ConfigurationFile$PushbackStreamTokenizer


    }

    private static ConfigurationFile getDefaultConfig() {
  if (defaultConfig == null) {
      try {
    defaultConfig = new ConfigurationFile(new String[]{location});
      } catch (ConfigurationException e) {
    throw unexpectedException(e);
      }
  }
  return defaultConfig;
View Full Code Here


      super(value, "comp", "a", shouldBe);
      this.value = value;
  }

  ConfigurationFile getConfig() throws ConfigurationException {
      return new ConfigurationFile(
    new String[] { "-", "comp.a = " + value });
  }
View Full Code Here

            } else if (forReader instanceof URL) {
                cfis = ((URL)forReader).openStream();
                reader = new InputStreamReader(cfis, "UTF-8");
            }
        }
        ConfigurationFile cf = null;
        if (       testCase == OPT_TEST_CASE) {
            cf = new ConfigurationFile(options);
        } else if (testCase == OPT_CL_TEST_CASE) {
            cf = new ConfigurationFile(options, fakeClassLoader);
        } else if (testCase == OPT_NULL_TEST_CASE) {
            cf = new ConfigurationFile(options, null);
        } else if (testCase == RDR_OPT_TEST_CASE) {
            cf = new ConfigurationFile(reader, options);
        } else if (testCase == RDR_OPT_CL_TEST_CASE) {
            cf = new ConfigurationFile(reader, options, fakeClassLoader);
        } else if (testCase == RDR_OPT_NULL_TEST_CASE) {
            cf = new ConfigurationFile(reader, options, null);
        }
        String s = cf.toString();
        logger.log(Level.INFO, "toString()=" + s);
        assertion(s != null, "toString method returns null");
        assertion(s.length() != 0, "toString method returns empty string");
        if (withReader(testCase)) {
            if (reader != null) reader.close();
View Full Code Here

        createFile(confFile, conf);
        String entryName = (String)(testCase[3]);
        Class entryType = (Class)(testCase[4]);
        String[] optionsWithFile = { confFile.getPath() };
        try {
            ConfigurationFile configurationFile =
                    callConstructor(OPT_TEST_CASE, null, optionsWithFile);
            Object entry = configurationFile.getEntry(
                    "com.sun.jini.test.spec.config.util.TestComponent",
                    entryName,
                    entryType,
                    Configuration.NO_DEFAULT,
                    new Integer(7));
View Full Code Here

   *
   * @param conf the configuration to examine
   * @return the array of entry/value pairs
   */
  private Object getEntries(Configuration conf) {
      ConfigurationFile cf = (ConfigurationFile) conf;
      ArrayList list = new ArrayList();
      Set names = cf.getEntryNames();
      Iterator it = names.iterator();
      String s = "";
      while (it.hasNext()) {
    String name = (String) it.next();
    s += name + "\n";
View Full Code Here

        reader.readToEOF();
        reader.readToEOF();
        continue;
    }

    ConfigurationFile config = null;
    Throwable throwable = null;
    StringBuffer result = new StringBuffer();
    try {
        config = new ConfigurationFile(reader, new String[0]);
        Object[] entryNames = config.getEntryNames().toArray();
        Arrays.sort(entryNames);
        String lastComponent = null;
        for (int i = 0; i < entryNames.length; i++) {
      String fullName = (String) entryNames[i];
      int dot = fullName.lastIndexOf('.');
      String component = fullName.substring(0, dot);
      String name = fullName.substring(dot + 1);
      Class type = config.getEntryType(component, name);
      if (type == null) {
          type = Object.class;
      }
      if (!component.equals(lastComponent)) {
          if (lastComponent != null) {
        result.append("}\n");
          }
          result.append(component).append(" {\n");
          lastComponent = component;
      }
      result.append("    ").append(name).append(" = ");
      result.append(
          toString(config.getEntry(component, name, type)));
      result.append(";\n");
        }
        if (entryNames.length > 0) {
      result.append("}\n");
        }
View Full Code Here

    private Configuration defaultConfiguration;

    public QAConfiguration(String[] options, QAConfig config)
  throws ConfigurationException
    {
  testConfiguration = new ConfigurationFile(options);
  options[0] =
      config.getStringConfigVal("com.sun.jini.qa.harness.defaultTestConfig",
              null);
  defaultConfiguration = new ConfigurationFile(options);
    }
View Full Code Here

            IOException,
            TestException
    {
        InputStream cfis = null;
        Reader reader = null;
        ConfigurationFile result = null;
        if (withReader(testCase)) {
            if (forReader instanceof File) {
                cfis = new FileInputStream((File)forReader);
                reader = new InputStreamReader(cfis, "UTF-8");
            } else if (forReader instanceof URL) {
View Full Code Here

                        confFile.getPath(),
                        entryOverride + " = new Object()\n" };
                options = optionsWithOverride;
            }

            ConfigurationFile configurationFile =
                    callConstructor(testCase, confFile, options);
                   
            int numberOfRuns = ((Integer) testAction[1]).intValue();
            for (int l = 0; l < numberOfRuns; ++l) { // more then once
                Set ens = configurationFile.getEntryNames();

                if (!ens.containsAll(expectedENs)){
                    throw new TestException(
                            "Returned set contains not expected elements");
                }
View Full Code Here

      logger.log(Level.FINER, "Test Configuration options:");
      for (int i = 0; i < options.length; i++) {
    logger.log(Level.FINER, "   " + options[i]);
      }
      if (currentTag.equals("none")) {
    configuration = new ConfigurationFile(options);
      } else {
    configuration = new QAConfiguration(options, this);
      }
  } catch (ConfigurationException e) {
      if (getBooleanConfigVal("testConfigurationOptional",false)) {
View Full Code Here

TOP

Related Classes of net.jini.config.ConfigurationFile$PushbackStreamTokenizer

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.