@Test() public void verifyPortConfiguration() throws Exception { ForkedFrameworkFactory frameworkFactory = new ForkedFrameworkFactory(null); new SystemPropertyRunnable(org.ops4j.pax.exam.Constants.EXAM_FORKED_INVOKER_PORT, "15000") { @Override protected void doRun() { Assert.assertThat(frameworkFactory.getPort(), CoreMatchers.equalTo(15000)); } }.run(); new SystemPropertyRunnable(org.ops4j.pax.exam.Constants.EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "15000") { @Override protected void doRun() { Assert.assertThat(frameworkFactory.getPort(), CoreMatchers.equalTo(15000)); } }.run(); }
protected int getPort() { String configuredPort = System.getProperty(EXAM_FORKED_INVOKER_PORT); if (configuredPort != null) { return Integer.parseInt(configuredPort); } else { int lowerBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "21000")); int upperBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_UPPERBOUND, "21099")); return new FreePort(lowerBound, upperBound).getPort(); } }
ForkedFrameworkFactory { protected int getPort() { String configuredPort = System.getProperty(EXAM_FORKED_INVOKER_PORT); if (configuredPort != null) { return Integer.parseInt(configuredPort); } else { int lowerBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "21000")); int upperBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_UPPERBOUND, "21099")); return new FreePort(lowerBound, upperBound).getPort(); } } }
ForkedFrameworkFactory { protected int getPort() { String configuredPort = System.getProperty(EXAM_FORKED_INVOKER_PORT); if (configuredPort != null) { return Integer.parseInt(configuredPort); } else { int lowerBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "21000")); int upperBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_UPPERBOUND, "21099")); return new FreePort(lowerBound, upperBound).getPort(); } } ForkedFrameworkFactory(FrameworkFactory frameworkFactory); }
ForkedFrameworkFactory { protected int getPort() { String configuredPort = System.getProperty(EXAM_FORKED_INVOKER_PORT); if (configuredPort != null) { return Integer.parseInt(configuredPort); } else { int lowerBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "21000")); int upperBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_UPPERBOUND, "21099")); return new FreePort(lowerBound, upperBound).getPort(); } } ForkedFrameworkFactory(FrameworkFactory frameworkFactory); FrameworkFactory getFrameworkFactory(); void setFrameworkFactory(FrameworkFactory frameworkFactory); RemoteFramework fork(List<String> vmArgs, Map<String, String> systemProperties,
        Map<String, Object> frameworkProperties, List<String> beforeFrameworkClasspath,
        List<String> afterFrameworkClasspath); RemoteFramework fork(List<String> vmArgs, Map<String, String> systemProperties,
        Map<String, Object> frameworkProperties); void join(); }
ForkedFrameworkFactory { protected int getPort() { String configuredPort = System.getProperty(EXAM_FORKED_INVOKER_PORT); if (configuredPort != null) { return Integer.parseInt(configuredPort); } else { int lowerBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_LOWERBOUND, "21000")); int upperBound = Integer.parseInt(System.getProperty(EXAM_FORKED_INVOKER_PORT_RANGE_UPPERBOUND, "21099")); return new FreePort(lowerBound, upperBound).getPort(); } } ForkedFrameworkFactory(FrameworkFactory frameworkFactory); FrameworkFactory getFrameworkFactory(); void setFrameworkFactory(FrameworkFactory frameworkFactory); RemoteFramework fork(List<String> vmArgs, Map<String, String> systemProperties,
        Map<String, Object> frameworkProperties, List<String> beforeFrameworkClasspath,
        List<String> afterFrameworkClasspath); RemoteFramework fork(List<String> vmArgs, Map<String, String> systemProperties,
        Map<String, Object> frameworkProperties); void join();  }