Search in sources :

Example 1 with RMException

use of org.ow2.proactive.resourcemanager.exception.RMException in project scheduling by ow2-proactive.

the class SharedSessionStoreTestUtils method createValidSession.

public static String createValidSession(RMProxyUserInterface rm) throws ActiveObjectCreationException, NodeException, RMException, KeyException, LoginException {
    SchedulerRMProxyFactory schedulerFactory = mock(SchedulerRMProxyFactory.class);
    when(schedulerFactory.connectToRM(Matchers.<CredData>any())).thenReturn(rm);
    SharedSessionStore.getInstance().setSchedulerRMProxyFactory(schedulerFactory);
    // login
    Session session = SharedSessionStore.getInstance().createUnnamedSession();
    session.connectToRM(new CredData());
    return session.getSessionId();
}
Also used : CredData(org.ow2.proactive.authentication.crypto.CredData)

Example 2 with RMException

use of org.ow2.proactive.resourcemanager.exception.RMException in project scheduling by ow2-proactive.

the class NodeSourceTest method testDetectedPingedDownNodeCallingInfrastructureManagerInternalRemoveNodeTrueFlag.

@Test
public void testDetectedPingedDownNodeCallingInfrastructureManagerInternalRemoveNodeTrueFlag() throws RMException, ClassNotFoundException {
    Node node = createNode(PROACTIVE_PROGRAMMING_NODE_URL);
    nodeSource.internalAddNode(node);
    nodeSource.detectedPingedDownNode(node.getNodeInformation().getName(), node.getNodeInformation().getURL());
    verify(infrastructureManager).internalNotifyDownNode(anyString(), anyString(), any(Node.class));
}
Also used : RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Node(org.objectweb.proactive.core.node.Node) Test(org.junit.Test)

Example 3 with RMException

use of org.ow2.proactive.resourcemanager.exception.RMException in project scheduling by ow2-proactive.

the class RMListenerProxy method init.

public boolean init(String url, Credentials credentials) throws RMException, KeyException, LoginException {
    this.credentials = credentials;
    this.rmAuth = RMConnection.join(url);
    this.target = rmAuth.login(credentials);
    rebindListener();
    // here we log on using an empty login field to ensure that
    // credentials are used.
    this.jmxClient = new JMXClientHelper(rmAuth, new Object[] { "", credentials });
    this.jmxClient.connect();
    return true;
}
Also used : JMXClientHelper(org.ow2.proactive.jmx.JMXClientHelper) PAActiveObject(org.objectweb.proactive.api.PAActiveObject) ActiveObject(org.objectweb.proactive.extensions.annotation.ActiveObject)

Example 4 with RMException

use of org.ow2.proactive.resourcemanager.exception.RMException in project scheduling by ow2-proactive.

the class RMListenerProxy method init.

public boolean init(String url, CredData credData) throws RMException, KeyException, LoginException {
    this.rmAuth = RMConnection.join(url);
    Credentials cred = Credentials.createCredentials(credData, rmAuth.getPublicKey());
    return init(url, cred);
}
Also used : Credentials(org.ow2.proactive.authentication.crypto.Credentials)

Example 5 with RMException

use of org.ow2.proactive.resourcemanager.exception.RMException in project scheduling by ow2-proactive.

the class PluginDescriptor method packParameters.

/**
 * Packs parameters inputed by user into appropriate parameters set required for this plugin.
 * Performs some operations such as file loading on user side.
 *
 * @param parameters input parameters
 * @return output parameters
 * @throws RMException when error occurs
 */
public Object[] packParameters(Object[] parameters) throws RMException {
    int configurableFieldsSize = configurableFields.size();
    List<Object> resultParams = new ArrayList<>(configurableFieldsSize);
    if (parameters.length != configurableFieldsSize) {
        throw new RMException("Incorrect number of parameters: expected " + configurableFieldsSize + ", provided " + parameters.length);
    }
    int counter = 0;
    for (ConfigurableField field : configurableFields) {
        Object value = parameters[counter++];
        Configurable configurable = field.getMeta();
        boolean credentialsFilePath = configurable.credential() && value instanceof String;
        if (configurable.fileBrowser() || credentialsFilePath) {
            try {
                if (value.toString().length() > 0) {
                    value = FileToBytesConverter.convertFileToByteArray(new File(value.toString()));
                } else {
                    // in case if file path is not specified propagate null to plugin
                    // it will decide then if it's acceptable or not
                    value = null;
                }
            } catch (IOException e) {
                throw new RMException("Cannot load file", e);
            }
        }
        resultParams.add(value);
    }
    return resultParams.toArray();
}
Also used : ArrayList(java.util.ArrayList) IOException(java.io.IOException) File(java.io.File) RMException(org.ow2.proactive.resourcemanager.exception.RMException)

Aggregations

RMException (org.ow2.proactive.resourcemanager.exception.RMException)19 Throwables.getStackTraceAsString (com.google.common.base.Throwables.getStackTraceAsString)9 IOException (java.io.IOException)8 Node (org.objectweb.proactive.core.node.Node)8 KeyException (java.security.KeyException)6 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)6 RMDeployingNode (org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode)5 CredData (org.ow2.proactive.authentication.crypto.CredData)4 UnknownHostException (java.net.UnknownHostException)3 Test (org.junit.Test)3 Credentials (org.ow2.proactive.authentication.crypto.Credentials)3 AbstractRMNode (org.ow2.proactive.resourcemanager.rmnode.AbstractRMNode)3 CommandLineBuilder (org.ow2.proactive.resourcemanager.utils.CommandLineBuilder)3 Permission (java.security.Permission)2 ArrayList (java.util.ArrayList)2 POST (javax.ws.rs.POST)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)2 RMProxyUserInterface (org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface)2