@@ -0,0 +1,3460 @@
+/*%0A * ################################################################%0A *%0A * ProActive Parallel Suite(TM): The Java(TM) library for%0A *    Parallel, Distributed, Multi-Core Computing for%0A *    Enterprise Grids & Clouds%0A *%0A * Copyright (C) 1997-2010 INRIA/University of%0A * %09%09%09%09Nice-Sophia Antipolis/ActiveEon%0A * Contact: proactive@ow2.org or contact@activeeon.com%0A *%0A * This library is free software; you can redistribute it and/or%0A * modify it under the terms of the GNU General Public License%0A * as published by the Free Software Foundation; version 3 of%0A * the License.%0A *%0A * This library is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A * General Public License for more details.%0A *%0A * You should have received a copy of the GNU General Public License%0A * along with this library; if not, write to the Free Software%0A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307%0A * USA%0A *%0A * If needed, contact us to obtain a release under GPL Version 2%0A * or a different license than the GPL.%0A *%0A *  Initial developer(s):               The ActiveEon Team%0A *                        http://www.activeeon.com/%0A *  Contributor(s):%0A *%0A * ################################################################%0A * $ACTIVEEON_INITIAL_DEV$%0A */%0Apackage functionaltests.nodestate;%0A%0Aimport org.objectweb.proactive.core.node.Node;%0Aimport org.ow2.proactive.resourcemanager.common.event.RMEventType;%0Aimport org.ow2.proactive.resourcemanager.core.RMCore;%0Aimport org.ow2.proactive.resourcemanager.frontend.ResourceManager;%0Aimport org.ow2.proactive.resourcemanager.nodesource.NodeSource;%0Aimport org.ow2.proactive.resourcemanager.nodesource.infrastructure.DefaultInfrastructureManager;%0Aimport org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy;%0A%0Aimport functionalTests.FunctionalTest;%0Aimport functionaltests.RMTHelper;%0A%0A%0A/**%0A * This class tests a particular case of node add/removal where a race condition%0A * exists and that lead to dead lock in the past.%0A * Running this test ensure that at least the dead lock doesn't occur.%0A */%0Apublic class TestAddRemoveAll extends FunctionalTest %7B%0A%0A    String nodeName = %22nodeDeadLock%22;%0A%0A    @org.junit.Test%0A    public void action() throws Exception %7B%0A        ResourceManager resourceManager = RMTHelper.getResourceManager();%0A        RMTHelper.log(%22Add/RemoveAll%22);%0A        resourceManager.createNodeSource(NodeSource.DEFAULT, DefaultInfrastructureManager.class.getName(),%0A                null, StaticPolicy.class.getName(), null);%0A        RMTHelper.waitForNodeSourceEvent(RMEventType.NODESOURCE_CREATED, NodeSource.DEFAULT);%0A        Node nodeToAdd = RMTHelper.createNode(nodeName);%0A        resourceManager.addNode(nodeToAdd.getNodeInformation().getURL(), NodeSource.DEFAULT)%0A                .getBooleanValue();%0A        //at this time, nodes maybe fully added in the nodesource but not in the core%0A        //the next removal may fail for some nodes that are not known by the core...%0A        RMCore resourceManagerIMPL = (RMCore) resourceManager;%0A        resourceManagerIMPL.removeAllNodes(NodeSource.DEFAULT, true);%0A        if (resourceManager.getState().getTotalNodesNumber() != 0) %7B%0A            RMTHelper.log(%22The removeAll method in RMCore didn't removed all nodes%22);%0A        %7D else %7B%0A            RMTHelper.log(%22The removeAll method in RMCore did its job well%22);%0A        %7D%0A    %7D%0A%7D%0A

Test added for RMCore race condition test on Add/RemoveAllNodes. Even if the race exists, the test mustn't fail because of a timeout.