public static Test suite() {
    TestSuite suite = new TestSuite("ReplicationRun_Local_1Indexing Suite");

    suite.addTestSuite(ReplicationRun_Local_1Indexing.class);

    return SecurityManagerSetup.noSecurityManager(suite);
  }
Esempio n. 2
0
  static Vector getSecurityProps(Vector D) throws ClassNotFoundException, IOException {
    if (D == null) D = new Vector();

    String userDir = System.getProperty("user.dir");
    String policyFile = userDir + baseName(DEFAULT_POLICY);

    String serverCodeBase = System.getProperty("serverCodeBase");
    boolean[] isJar = new boolean[1];
    if (serverCodeBase == null) serverCodeBase = findCodeBase(isJar);

    if (serverCodeBase == null) {
      String ws = guessWSHome();
      serverCodeBase = ws + DEFAULT_CODEBASE;
    }

    File pf = new File(policyFile);
    File cb = new File(serverCodeBase);

    if (!pf.exists()) {
      System.out.println(
          "WARNING: Running without Security manager."
              + "policy File ("
              + policyFile
              + ") or serverCodeBase("
              + serverCodeBase
              + ") not available");
      return D;
    }

    D.addElement("java.security.manager");
    D.addElement("java.security.policy=" + pf.getAbsolutePath());

    Properties jusetup = SecurityManagerSetup.getPolicyFilePropertiesForOldHarness();
    // Take the definitions from the way JUnit tests
    // set them up. This then supports the jar files being
    // in different locations.
    for (Enumeration p = jusetup.keys(); p.hasMoreElements(); ) {
      String key = (String) p.nextElement();
      D.addElement(key + "=" + jusetup.getProperty(key));
    }

    // file path to the codebase
    D.addElement("derbyTesting.codedir=" + cb.getAbsolutePath());
    String hostName = (System.getProperty("hostName"));
    if (hostName == null) hostName = "localhost";
    D.addElement("derbyTesting.serverhost=" + hostName);
    // in the case of testing with a remote host, this is irrelevant,
    // when testing 'normal' it is also localhost:
    D.addElement("derbyTesting.clienthost=" + hostName);

    return D;
  }