Package org.ops4j.net

Examples of org.ops4j.net.FreePort


     * @return this for fluent API. Or IllegalStateException if a port has not been detected successfully.
     */
    public synchronized RMIRegistry selectGracefully()
    {
        // if( ( m_port = select( m_defaultPort ) ) == UNSELECTED ) {
        int alternativePort = new FreePort(m_altMin, m_altTo).getPort();
        if ((m_port = select(alternativePort)) == UNSELECTED) {
            throw new IllegalStateException("No port found for RMI at all. Even though " + alternativePort
                    + " should have worked. Thats.. not. good. at. all.");
        }
        printTakenStatus();
View Full Code Here


     *
     * @return this for fluent API. Or IllegalStateException if a port has not been detected successfully.
     */
    public synchronized RMIRegistry selectGracefully() {
        // if( ( m_port = select( m_defaultPort ) ) == UNSELECTED ) {
        int alternativePort = new FreePort(m_altMin, m_altTo).getPort();
        if ((m_port = select(alternativePort)) == UNSELECTED) {
            throw new IllegalStateException("No port found for RMI at all. Even though " + alternativePort
                    + " should have worked. Thats.. not. good. at. all.");
        }
        printTakenStatus();
View Full Code Here

    }

    @Configuration
    public Option[] config() {
        // ports to override values from etc/org.apache.karaf.management.cfg
        int rmiRegistryPort = new FreePort(RMI_BASE_PORT + 1, RMI_BASE_PORT + 100).getPort();
        int rmiServerPort = new FreePort(rmiRegistryPort +1, rmiRegistryPort + 100).getPort();
        LOGGER.info("Port selected for Karaf RMI Registry: {}", rmiRegistryPort);
        LOGGER.info("Port selected for JMX Server connection: {}", rmiServerPort);
        return new Option[]{
                karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("tar.gz"))
                        .karafVersion(MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf")).name("Apache Karaf").unpackDirectory(new File("target/exam")),
View Full Code Here

     *
     * @return this for fluent API. Or IllegalStateException if a port has not been detected successfully.
     */
    public synchronized RMIRegistry selectGracefully() {
        // if( ( m_port = select( m_defaultPort ) ) == UNSELECTED ) {
        int alternativePort = new FreePort(m_altMin, m_altTo).getPort();
        if ((m_port = select(alternativePort)) == UNSELECTED) {
            throw new IllegalStateException("No port found for RMI at all. Even though " + alternativePort
                    + " should have worked. Thats.. not. good. at. all.");
        }
        printTakenStatus();
View Full Code Here

        System.setProperty(Constants.EXAM_REACTOR_STRATEGY_KEY, "PerSuite");
        checkNumberOfRestartsInSuite(1);
    }

    private void checkNumberOfRestartsInSuite(int numRestarts) throws Exception {
        FreePort freePort = new FreePort(20000, 21000);

        int rmiPort = freePort.getPort();
        System.setProperty("pax.exam.regression.rmi", Integer.toString(rmiPort));
        Registry registry = LocateRegistry.createRegistry(rmiPort);
        Remote remote = UnicastRemoteObject.exportObject(this, 0);
        registry.rebind("PaxExamNotifier", remote);
View Full Code Here

            String name = system.createID(KARAF_TEST_CONTAINER);

            Option invokerConfiguration = getInvokerConfiguration();

            //registry.selectGracefully();
            FreePort freePort = new FreePort(21000, 21099);
            int port = freePort.getPort();
            LOGGER.debug("using RMI registry at port {}", port);
            rgstry = LocateRegistry.createRegistry(port);

            String host = InetAddress.getLocalHost().getHostName();
View Full Code Here

     */
    public RemoteFramework fork(List<String> vmArgs, Map<String, String> systemProperties,
        Map<String, Object> frameworkProperties, List<String> beforeFrameworkClasspath,
        List<String> afterFrameworkClasspath) {
        // TODO make port range configurable
        FreePort freePort = new FreePort(21000, 21099);
        port = freePort.getPort();
        LOG.debug("using RMI registry at port {}", port);

        String rmiName = "ExamRemoteFramework-" + UUID.randomUUID().toString();

        try {
View Full Code Here

        System.setProperty(Constants.EXAM_REACTOR_STRATEGY_KEY, "PerMethod");
        checkNumberOfRestartsInSuite(3);
    }

    private void checkNumberOfRestartsInSuite(int numRestarts) throws Exception {
        FreePort freePort = new FreePort(20000, 21000);

        int rmiPort = freePort.getPort();
        System.setProperty("pax.exam.regression.rmi", Integer.toString(rmiPort));
        Registry registry = LocateRegistry.createRegistry(rmiPort);
        Remote remote = UnicastRemoteObject.exportObject(this, 0);
        registry.rebind("PaxExamNotifier", remote);
View Full Code Here

TOP

Related Classes of org.ops4j.net.FreePort

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.