예제 #1
0
  private void getConnectionProperties(final Node node) {
    final NodeList childNodes = node.getChildNodes();

    for (int i = 0; i < childNodes.getLength(); ++i) {
      final Node childNode = childNodes.item(i);

      if (childNode.getNodeType() == Node.ELEMENT_NODE) {
        final String nodeName = childNode.getNodeName();
        if (nodeName.equals("property")) {
          final NamedNodeMap attributes = childNode.getAttributes();

          Node n = attributes.getNamedItem("name");
          ThreadContext.assertError(
              n != null,
              "DbAnalyse-options/connection-properties/property must contain a 'name' attribute");
          final String name = n.getNodeValue();

          n = attributes.getNamedItem("value");
          ThreadContext.assertError(
              n != null,
              "DbAnalyse-options/connection-properties/property must contain a 'value' attribute");
          final String value = n.getNodeValue();

          m_options.m_connectionProperties.add(E2.of(name, value));
        } else {
          ThreadContext.assertError(
              false, "[%s] unknown option element [%s]", getClass().getSimpleName(), nodeName);
        }
      }
    }
  }
예제 #2
0
  private E2<DummyLogger, DummyRemoteInstrumentationLogger> setupLoggers(
      final String levelsConfig) {
    // Red of Instrumentation.configure ()
    Logging.clearLoggers();

    final DummyRemoteInstrumentationLogger remoteLogger =
        new DummyRemoteInstrumentationLogger("fewi", getTempPath("log-remote.txt"));

    final List<ConsoleStringLogger> slaves =
        OUTPUT_TO_CONSOLE ? Arrays.asList(new ConsoleStringLogger()) : null;
    final DummyLogger localLogger =
        new DummyLogger(levelsConfig, slaves, getTempPath("log-local.txt"));
    Logging.addLogger(localLogger);

    Instrumentation.addInstrumentationListener(new InstrumentionStringLogger(localLogger));

    Instrumentation.addInstrumentationListener(remoteLogger);
    Logging.addLogger(remoteLogger);

    return E2.of(localLogger, remoteLogger);
  }