/*
 * ################################################################
 *
 * ProActive: The Java(TM) library for Parallel, Distributed,
 *            Concurrent computing with Security and Mobility
 *
 * Copyright (C) 1997-2009 INRIA/University of Nice-Sophia Antipolis
 * Contact: proactive@ow2.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 *  Initial developer(s):               The ProActive Team
 *                        http://proactive.inria.fr/team_members.htm
 *  Contributor(s):
 *
 * ################################################################
 * $$PROACTIVE_INITIAL_DEV$$
 */
package performanceTests.throughput;

import java.io.Serializable;

import org.junit.Test;
import org.objectweb.proactive.ActiveObjectCreationException;
import org.objectweb.proactive.api.PAActiveObject;
import org.objectweb.proactive.core.config.PAProperties;
import org.objectweb.proactive.core.node.NodeException;

import performanceTests.HudsonReport;
import functionalTests.FunctionalTest;


public class TestHalfBody extends FunctionalTest {

    static {
        PAProperties.PA_COMMUNICATION_PROTOCOL.setValue("rmi");
    }

    @Test
    public void test() throws ActiveObjectCreationException, NodeException {
        Server server = (Server) PAActiveObject.newActive(Server.class.getName(), new Object[] {});
        Client client = new Client(server);
        client.startTest();
    }

    static public class Server implements Serializable {
        boolean firstRequest = true;
        long count = 0;
        long startTime;

        public Server() {

        }

        public void serve() {
            if (firstRequest) {
                startTime = System.currentTimeMillis();
                firstRequest = false;
            }

            count++;
        }

        public void finish() {
            long endTime = System.currentTimeMillis();
            double throughput = (1000.0 * count) / (endTime - startTime);

            System.out.println("Count: " + count);
            System.out.println("Duration: " + (endTime - startTime));
            System.out.println("Throughput " + throughput);
            HudsonReport.reportToHudson(TestHalfBody.class, throughput);
        }
    }

    static public class Client implements Serializable {
        private Server server;

        public Client() {

        }

        public Client(Server server) {
            this.server = server;
        }

        public int startTest() {
            // Warmup
            for (int i = 0; i < 1000; i++) {
                server.serve();
            }

            long startTime = System.currentTimeMillis();
            while (true) {
                if (System.currentTimeMillis() - startTime > PAProperties.PA_TEST_PERF_DURATION
                        .getValueAsInt())
                    break;

                for (int i = 0; i < 50; i++) {
                    server.serve();
                }
            }
            server.finish();

            // startTest must be sync 
            return 0;
        }
    }

}

@@ -1298,356 +1298,56 @@
 ort 
-java.io.Serializable;%0A%0Aimport org.junit.Test;%0Aimport org.objectweb.proactive.ActiveObjectCreationException;%0Aimport org.objectweb.proactive.api.PAActiveObject;%0Aimport org.objectweb.proactive.core.config.PAProperties;%0Aimport org.objectweb.proactive.core.node.NodeException;%0A%0Aimport performanceTests.HudsonReport;%0Aimport functionalTests.FunctionalTest
+org.objectweb.proactive.core.config.PAProperties
 ;%0A%0A%0A
@@ -1384,21 +1384,17 @@
 nds 
-FunctionalTes
+Throughpu
 t %7B%0A
@@ -1486,1909 +1486,66 @@
     
-@Test%0A    public void test() throws ActiveObjectCreationException, NodeException %7B%0A        Server server = (Server) PAActiveObject.newActive(Server.class.getName(), new Object%5B%5D %7B%7D);%0A        Client client = new Client(server);%0A        client.startTest();%0A    %7D%0A%0A    static public class Server implements Serializable %7B%0A        boolean firstRequest = true;%0A        long count = 0;%0A        long startTime;%0A%0A        public Server() %7B%0A%0A        %7D%0A%0A        public void serve() %7B%0A            if (firstRequest) %7B%0A                startTime = System.currentTimeMillis();%0A                firstRequest = false;%0A            %7D%0A%0A            count++;%0A        %7D%0A%0A        public void finish() %7B%0A            long endTime = System.currentTimeMillis();%0A            double throughput = (1000.0 * count) / (endTime - startTime);%0A%0A            System.out.println(%22Count: %22 + count);%0A            System.out.println(%22Duration: %22 + (endTime - startTime));%0A            System.out.println(%22Throughput %22 + throughput);%0A            HudsonReport.reportToHudson(TestHalfBody.class, throughput);%0A        %7D%0A    %7D%0A%0A    static public class Client implements Serializable %7B%0A        private Server server;%0A%0A        public Client() %7B%0A%0A        %7D%0A%0A        public Client(Server server) %7B%0A            this.server = server;%0A        %7D%0A%0A        public int startTest() %7B%0A            // Warmup%0A            for (int i = 0; i %3C 1000; i++) %7B%0A                server.serve();%0A            %7D%0A%0A            long startTime = System.currentTimeMillis();%0A            while (true) %7B%0A                if (System.currentTimeMillis() - startTime %3E PAProperties.PA_TEST_PERF_DURATION%0A                        .getValueAsInt())%0A                    break;%0A%0A                for (int i = 0; i %3C 50; i++) %7B%0A                    server.serve();%0A                %7D%0A            %7D%0A            server.finish();%0A%0A            // startTest must be sync %0A            return 0;%0A        %7D
+public TestHalfBody() %7B%0A        super(TestHalfBody.class);
 %0A   

resolve PROACTIVE-692:ests/performanceTests/throughput/TestHalfBody.java has not been updated like other performance tests