Added: oodt/trunk/resource/src/main/resources/cmd-line-options.xml
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/resources/cmd-line-options.xml?rev=1202844&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/resources/cmd-line-options.xml (added)
+++ oodt/trunk/resource/src/main/resources/cmd-line-options.xml Wed Nov 16
19:13:49 2011
@@ -0,0 +1,601 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ Author: bfoster (Brian Foster)
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+ <bean id="url"
class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="u" />
+ <property name="longOption" value="url" />
+ <property name="description" value="Workflow Manager URL" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="url" />
+ <property name="required" value="true" />
+ <property name="handler">
+ <bean
+
class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
+ <property name="propertyNames">
+ <list>
+
<value>org.apache.oodt.cas.workflow.url</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="operation"
class="org.apache.oodt.cas.cli.option.GroupCmdLineOption">
+ <property name="shortOption" value="op" />
+ <property name="longOption" value="operation" />
+ <property name="description"
+ value="Declare that you wish to present an operation" />
+ <property name="hasArgs" value="false" />
+ <property name="required" value="true" />
+ <property name="subOptions">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getNodeById"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getNodes"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getQueues"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="addNode"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="removeNode"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="setNodeCapacity"
p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getExecNode" p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="addQueue"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="removeQueue"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="addNodeToQueue"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getNodesInQueue"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getQueuesWithNode"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="removeNodeFromQueue"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getNodeLoad"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="submitJob"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getJobInfo"
p:required="false" />
+ <bean
class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="kill" p:required="false"
/>
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetNodeById Options -->
+ <bean id="getNodeById"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="nbyid" />
+ <property name="longOption" value="getNodeById" />
+ <property name="description" value="Triggers GetNodeById
Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetNodeById</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNodeById"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetNodes Options -->
+ <bean id="getNodes"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="nodes" />
+ <property name="longOption" value="getNodes" />
+ <property name="description" value="Triggers GetNodes Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetNodes</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNodes"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetQueues Options -->
+ <bean id="getQueues"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="queues" />
+ <property name="longOption" value="getQueues" />
+ <property name="description" value="Triggers GetQueues Action"
/>
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetQueues</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetQueues"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- AddNode Options -->
+ <bean id="addNode"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="an" />
+ <property name="longOption" value="addNode" />
+ <property name="description" value="Triggers AddNode Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>AddNode</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddNode"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="ipAddr"
class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="addr" />
+ <property name="longOption" value="ipAddr" />
+ <property name="description" value="Node IP Address" />
+ <property name="type" value="java.net.URL" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="ip-addr" />
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddNode"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean
class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="AddNode"
p:methodName="setNodeUrl" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- RemoveNode Options -->
+ <bean id="removeNode"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="rn" />
+ <property name="longOption" value="removeNode" />
+ <property name="description" value="Triggers RemoveNode Action"
/>
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>RemoveNode</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="RemoveNode"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- SetNodeCapacity Options -->
+ <bean id="setNodeCapacity"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="sncap" />
+ <property name="longOption" value="setNodeCapacity" />
+ <property name="description" value="Triggers SetNodeCapacity
Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>SetNodeCapacity</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SetNodeCapacity"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- SetNodeCapacity Options -->
+ <bean id="getExecNode"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="exeNode" />
+ <property name="longOption" value="getExecNode" />
+ <property name="description" value="Triggers GetExecNode Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetExecNode</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetExecNode" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- AddQueue Options -->
+ <bean id="addQueue"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="aq" />
+ <property name="longOption" value="addQueue" />
+ <property name="description" value="Triggers AddQueue Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>AddQueue</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddQueue"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- RemoveQueue Options -->
+ <bean id="removeQueue"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="rq" />
+ <property name="longOption" value="removeQueue" />
+ <property name="description" value="Triggers RemoveQueue
Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>RemoveQueue</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="RemoveQueue"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- AddNodeToQueue Options -->
+ <bean id="addNodeToQueue"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="antq" />
+ <property name="longOption" value="addNodeToQueue" />
+ <property name="description" value="Triggers AddNodeToQueue
Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>AddNodeToQueue</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddNodeToQueue"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetNodesInQueue Options -->
+ <bean id="getNodesInQueue"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="ninq" />
+ <property name="longOption" value="getNodesInQueue" />
+ <property name="description" value="Triggers GetNodesInQueue
Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetNodesInQueue</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNodesInQueue"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetQueuesWithNode Options -->
+ <bean id="getQueuesWithNode"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="qwn" />
+ <property name="longOption" value="getQueuesWithNode" />
+ <property name="description" value="Triggers GetQueuesWithNode
Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetQueuesWithNode</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetQueuesWithNode"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- RemoveNodeFromQueue Options -->
+ <bean id="removeNodeFromQueue"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="rnfq" />
+ <property name="longOption" value="removeNodeFromQueue" />
+ <property name="description" value="Triggers
RemoveNodeFromQueue Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>RemoveNodeFromQueue</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="RemoveNodeFromQueue"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetNodeLoad Options -->
+ <bean id="getNodeLoad"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="load" />
+ <property name="longOption" value="getNodeLoad" />
+ <property name="description" value="Triggers GetNodeLoad
Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetNodeLoad</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNodeLoad"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- SubmitJob Options -->
+ <bean id="submitJob"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="submit" />
+ <property name="longOption" value="submitJob" />
+ <property name="description" value="Triggers SubmitJob Action"
/>
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>SubmitJob</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SubmitJob"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="def"
class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="d" />
+ <property name="longOption" value="def" />
+ <property name="description" value="Job Definition File" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="xml-file" />
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SubmitJob"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean
class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+
p:actionName="SubmitJob" p:methodName="setJobDefinitionFile" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="nodeUrl"
class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="nu" />
+ <property name="longOption" value="nodeUrl" />
+ <property name="description" value="Node URL" />
+ <property name="type" value="java.net.URL" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="url" />
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SubmitJob" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean
class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="SubmitJob" p:methodName="setUrl" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- GetJobInfo Options -->
+ <bean id="getJobInfo"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="info" />
+ <property name="longOption" value="getJobInfo" />
+ <property name="description" value="Triggers GetJobInfo Action"
/>
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetJobInfo</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetJobInfo"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- Kill Options -->
+ <bean id="kill"
class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="k" />
+ <property name="longOption" value="kill" />
+ <property name="description" value="Triggers Kill Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>Kill</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="Kill"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- Options used for multiple Actions -->
+ <bean id="nodeId"
class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="nid" />
+ <property name="longOption" value="nodeId" />
+ <property name="description" value="Node ID" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="node-id" />
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNodeById"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddNode"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="RemoveNode"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SetNodeCapacity"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddNodeToQueue"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetQueuesWithNode"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="RemoveNodeFromQueue"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNodeLoad"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean
class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="capacity"
class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="cap" />
+ <property name="longOption" value="capacity" />
+ <property name="description" value="Node Capacity" />
+ <property name="type" value="int" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="capacity" />
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddNode"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SetNodeCapacity"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean
class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="queueName"
class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="qn" />
+ <property name="longOption" value="queueName" />
+ <property name="description" value="Queue name" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="queue-name" />
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddQueue"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="RemoveQueue"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddNodeToQueue"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNodesInQueue"
p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="RemoveNodeFromQueue"
p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean
class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="jobId"
class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="jid" />
+ <property name="longOption" value="jobId" />
+ <property name="description" value="Job ID" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="job-id" />
+ <property name="requirementRules">
+ <list>
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetJobInfo" p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetExecNode" p:relation="REQUIRED" />
+ <bean
class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="Kill" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean
class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+</beans>
Propchange: oodt/trunk/resource/src/main/resources/cmd-line-options.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: oodt/trunk/resource/src/main/resources/logging.properties
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/resources/logging.properties?rev=1202844&r1=1202843&r2=1202844&view=diff
==============================================================================
--- oodt/trunk/resource/src/main/resources/logging.properties (original)
+++ oodt/trunk/resource/src/main/resources/logging.properties Wed Nov 16
19:13:49 2011
@@ -57,3 +57,11 @@ org.apache.oodt.cas.resource.system.leve
org.apache.commons.httpclient.level = INFO
httpclient.wire.header.level = INFO
httpclient.wire.level = INFO
+
+# spring framework logging
+org.springframework.beans.level = WARNING
+org.springframework.core.level = WARNING
+org.springframework.level = WARNING
+org.springframework.beans.factory.level = WARNING
+org.springframework.beans.factory.config.level = WARNING
+org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.level =
WARNING
Added:
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/cli/TestResourceCli.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/cli/TestResourceCli.java?rev=1202844&view=auto
==============================================================================
---
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/cli/TestResourceCli.java
(added)
+++
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/cli/TestResourceCli.java
Wed Nov 16 19:13:49 2011
@@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.resource.cli;
+
+//JDK imports
+import java.net.MalformedURLException;
+import java.net.URL;
+
+//OODT imports
+import org.apache.oodt.cas.cli.CmdLineUtility;
+import org.apache.oodt.cas.resource.structs.Job;
+import org.apache.oodt.cas.resource.structs.JobInput;
+import org.apache.oodt.cas.resource.structs.JobSpec;
+import org.apache.oodt.cas.resource.structs.ResourceNode;
+import org.apache.oodt.cas.resource.system.MockXmlRpcResourceManagerClient;
+import
org.apache.oodt.cas.resource.system.MockXmlRpcResourceManagerClient.MethodCallDetails;
+import org.apache.oodt.cas.resource.util.JobBuilder;
+
+//JUnit imports
+import junit.framework.TestCase;
+
+/**
+ * Test class for cas-cli command line for resource manager.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class TestResourceCli extends TestCase {
+
+ static {
+ System.setProperty("org.apache.oodt.cas.cli.debug", "true");
+ System.setProperty("org.apache.oodt.cas.cli.action.spring.config",
"src/main/resources/cmd-line-actions.xml");
+ System.setProperty("org.apache.oodt.cas.cli.option.spring.config",
"src/main/resources/cmd-line-options.xml");
+ System.setProperty("resource.scheduler.factory",
"org.apache.oodt.cas.resource.MockScheduler");
+ }
+
+ private CmdLineUtility cmdLineUtility;
+ private MockXmlRpcResourceManagerClient client;
+
+ public void setUp() {
+ cmdLineUtility = new CmdLineUtility();
+ UseMockClientCmdLineActionStore actionStore = new
UseMockClientCmdLineActionStore();
+ client = actionStore.getClient();
+ cmdLineUtility.setActionStore(actionStore);
+ }
+
+ public void testAddNode() throws MalformedURLException {
+ int capacity = 10;
+ String nodeId = "TestNodeId";
+ String ipAddr = "http://localhost:9999";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --addNode --capacity " + capacity + " --nodeId "
+ + nodeId + " --ipAddr " + ipAddr).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("addNode", methodCallDetails.getMethodName());
+ ResourceNode actualNode = (ResourceNode)
methodCallDetails.getArgs().get(0);
+ ResourceNode expectedNode = new ResourceNode(nodeId, new URL(ipAddr),
capacity);
+ assertEquals(expectedNode.getIpAddr(), actualNode.getIpAddr());
+ assertEquals(expectedNode.getCapacity(), actualNode.getCapacity());
+ assertEquals(expectedNode.getNodeId(), actualNode.getNodeId());
+ }
+
+ public void testAddNodeToQueue() {
+ String queueName = "TestQueueName";
+ String nodeId = "TestNodeId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --addNodeToQueue --queueName " + queueName + "
--nodeId "
+ + nodeId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("addNodeToQueue", methodCallDetails.getMethodName());
+ assertEquals(nodeId, methodCallDetails.getArgs().get(0));
+ assertEquals(queueName, methodCallDetails.getArgs().get(1));
+ }
+
+ public void testAddQueue() {
+ String queueName = "TestQueueName";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --addQueue --queueName " + queueName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("addQueue", methodCallDetails.getMethodName());
+ assertEquals(queueName, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetExecNode() {
+ String jobId = "TestJobId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getExecNode --jobId " + jobId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getExecutionNode", methodCallDetails.getMethodName());
+ assertEquals(jobId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetJobInfo() {
+ String jobId ="TestJobId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getJobInfo --jobId " + jobId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getJobInfo", methodCallDetails.getMethodName());
+ assertEquals(jobId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetNodeById() {
+ String nodeId = "TestNodeId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getNodeById --nodeId " + nodeId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getNodeById", methodCallDetails.getMethodName());
+ assertEquals(nodeId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetNodeLoad() {
+ String nodeId = "TestNodeId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getNodeLoad --nodeId " + nodeId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getNodeLoad", methodCallDetails.getMethodName());
+ assertEquals(nodeId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetNodes() {
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getNodes").split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getNodes", methodCallDetails.getMethodName());
+ assertEquals(0, methodCallDetails.getArgs().size());
+ }
+
+ public void testGetNodesInQueue() {
+ String queueName = "TestQueueName";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getNodesInQueue --queueName "
+ + queueName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getNodesInQueue", methodCallDetails.getMethodName());
+ assertEquals(queueName, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetQueues() {
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getQueues").split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getQueues", methodCallDetails.getMethodName());
+ assertEquals(0, methodCallDetails.getArgs().size());
+ }
+
+ public void testGetQueuesWithNode() {
+ String nodeId = "TestNodeId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --getQueuesWithNode --nodeId "
+ + nodeId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getQueuesWithNode", methodCallDetails.getMethodName());
+ assertEquals(nodeId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testKill() {
+ String jobId = "TestJobId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --kill --jobId "
+ + jobId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("killJob", methodCallDetails.getMethodName());
+ assertEquals(jobId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testRemoveNode() {
+ String nodeId = "TestNodeId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --removeNode --nodeId "
+ + nodeId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("removeNode", methodCallDetails.getMethodName());
+ assertEquals(nodeId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testRemoveNodeFromQueue() {
+ String nodeId = "TestNodeId";
+ String queueName = "TestQueueNames";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --removeNodeFromQueue --nodeId "
+ + nodeId + " --queueName " + queueName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("removeNodeFromQueue", methodCallDetails.getMethodName());
+ assertEquals(nodeId, methodCallDetails.getArgs().get(0));
+ assertEquals(queueName, methodCallDetails.getArgs().get(1));
+ }
+
+ public void testRemoveQueue() {
+ String queueName = "TestQueueName";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --removeQueue --queueName "
+ + queueName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("removeQueue", methodCallDetails.getMethodName());
+ assertEquals(queueName, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testSetNodeCapacity() {
+ int capacity = 4;
+ String nodeId = "TestNodeId";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --setNodeCapacity --capacity "
+ + capacity + " --nodeId " + nodeId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("setNodeCapacity", methodCallDetails.getMethodName());
+ assertEquals(nodeId, methodCallDetails.getArgs().get(0));
+ assertEquals(capacity, methodCallDetails.getArgs().get(1));
+ }
+
+ public void testSubmitJob() throws MalformedURLException {
+ String jobDefinitionFile = "src/main/resources/examples/jobs/exJob.xml";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --submitJob --def "
+ + jobDefinitionFile).split(" "));
+ JobSpec spec = JobBuilder.buildJobSpec(jobDefinitionFile);
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("submitJob", methodCallDetails.getMethodName());
+ Job actualJob = (Job) methodCallDetails.getArgs().get(0);
+ assertEquals(spec.getJob().getJobInstanceClassName(),
actualJob.getJobInstanceClassName());
+ assertEquals(spec.getJob().getJobInputClassName(),
actualJob.getJobInputClassName());
+ assertEquals(spec.getJob().getQueueName(), actualJob.getQueueName());
+ assertEquals(spec.getJob().getLoadValue(), actualJob.getLoadValue());
+ JobInput actualJobInput = (JobInput) methodCallDetails.getArgs().get(1);
+ assertEquals(spec.getIn().getClass(), actualJobInput.getClass());
+ assertEquals(2, methodCallDetails.getArgs().size());
+
+ String url = "http://localhost:9000";
+ cmdLineUtility.run(("--url http://localhost:9000"
+ + " --operation --submitJob --def "
+ + jobDefinitionFile + " --nodeUrl " + url).split(" "));
+ methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("submitJob", methodCallDetails.getMethodName());
+ actualJob = (Job) methodCallDetails.getArgs().get(0);
+ assertEquals(spec.getJob().getJobInstanceClassName(),
actualJob.getJobInstanceClassName());
+ assertEquals(spec.getJob().getJobInputClassName(),
actualJob.getJobInputClassName());
+ assertEquals(spec.getJob().getQueueName(), actualJob.getQueueName());
+ assertEquals(spec.getJob().getLoadValue(), actualJob.getLoadValue());
+ actualJobInput = (JobInput) methodCallDetails.getArgs().get(1);
+ assertEquals(spec.getIn().getClass(), actualJobInput.getClass());
+ assertEquals(new URL(url), methodCallDetails.getArgs().get(2));
+ assertEquals(3, methodCallDetails.getArgs().size());
+ }
+}
Propchange:
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/cli/TestResourceCli.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/cli/UseMockClientCmdLineActionStore.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/cli/UseMockClientCmdLineActionStore.java?rev=1202844&view=auto
==============================================================================
---
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/cli/UseMockClientCmdLineActionStore.java
(added)
+++
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/cli/UseMockClientCmdLineActionStore.java
Wed Nov 16 19:13:49 2011
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.resource.cli;
+
+//JDK imports
+import java.util.Set;
+
+//OODT imports
+import org.apache.oodt.cas.cli.action.CmdLineAction;
+import org.apache.oodt.cas.cli.action.store.spring.SpringCmdLineActionStore;
+import org.apache.oodt.cas.cli.exception.CmdLineActionStoreException;
+import org.apache.oodt.cas.resource.cli.action.ResourceCliAction;
+import org.apache.oodt.cas.resource.system.MockXmlRpcResourceManagerClient;
+
+/**
+ * A {@link SpringCmdLineActionStore} which sets {@link WorkflowCliAction}s
+ * to use a {@link MockXmlRpcWorkflowManagerClient}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class UseMockClientCmdLineActionStore extends SpringCmdLineActionStore {
+
+ private MockXmlRpcResourceManagerClient client;
+
+ public UseMockClientCmdLineActionStore() {
+
super(System.getProperty("org.apache.oodt.cas.cli.action.spring.config"));
+ try {
+ client = new MockXmlRpcResourceManagerClient();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Set<CmdLineAction> loadSupportedActions() throws
CmdLineActionStoreException {
+ Set<CmdLineAction> actions = super.loadSupportedActions();
+ for (CmdLineAction action : actions) {
+ if (action instanceof ResourceCliAction) {
+ ((ResourceCliAction) action).setClient(client);
+ }
+ }
+ return actions;
+ }
+
+ public MockXmlRpcResourceManagerClient getClient() {
+ return client;
+ }
+}
Propchange:
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/cli/UseMockClientCmdLineActionStore.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/schedule/MockScheduler.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/schedule/MockScheduler.java?rev=1202844&view=auto
==============================================================================
---
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/schedule/MockScheduler.java
(added)
+++
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/schedule/MockScheduler.java
Wed Nov 16 19:13:49 2011
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.resource.schedule;
+
+//OODT imports
+import org.apache.oodt.cas.resource.batchmgr.Batchmgr;
+import org.apache.oodt.cas.resource.jobqueue.JobQueue;
+import org.apache.oodt.cas.resource.monitor.Monitor;
+import org.apache.oodt.cas.resource.scheduler.QueueManager;
+import org.apache.oodt.cas.resource.scheduler.Scheduler;
+import org.apache.oodt.cas.resource.structs.JobSpec;
+import org.apache.oodt.cas.resource.structs.ResourceNode;
+import org.apache.oodt.cas.resource.structs.exceptions.SchedulerException;
+
+/**
+ * A Mock {@link Scheduler}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class MockScheduler implements Scheduler {
+
+ public void run() {
+ // Do nothing.
+ }
+
+ public boolean schedule(JobSpec spec) throws SchedulerException {
+ return false;
+ }
+
+ public ResourceNode nodeAvailable(JobSpec spec) throws SchedulerException {
+ return null;
+ }
+
+ public Monitor getMonitor() {
+ return null;
+ }
+
+ public Batchmgr getBatchmgr() {
+ return null;
+ }
+
+ public JobQueue getJobQueue() {
+ return null;
+ }
+
+ public QueueManager getQueueManager() {
+ return null;
+ }
+}
Propchange:
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/schedule/MockScheduler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/system/MockXmlRpcResourceManagerClient.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/system/MockXmlRpcResourceManagerClient.java?rev=1202844&view=auto
==============================================================================
---
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/system/MockXmlRpcResourceManagerClient.java
(added)
+++
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/system/MockXmlRpcResourceManagerClient.java
Wed Nov 16 19:13:49 2011
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.resource.system;
+
+//JDK imports
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.resource.examples.HelloWorldJob;
+import org.apache.oodt.cas.resource.structs.Job;
+import org.apache.oodt.cas.resource.structs.JobInput;
+import org.apache.oodt.cas.resource.structs.NameValueJobInput;
+import org.apache.oodt.cas.resource.structs.ResourceNode;
+import org.apache.oodt.cas.resource.structs.exceptions.JobExecutionException;
+import org.apache.oodt.cas.resource.structs.exceptions.JobRepositoryException;
+import org.apache.oodt.cas.resource.structs.exceptions.MonitorException;
+import org.apache.oodt.cas.resource.structs.exceptions.QueueManagerException;
+
+//Google imports
+import com.google.common.collect.Lists;
+
+/**
+ * Mock implementation of {@link XmlRpcResourceManagerClient}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class MockXmlRpcResourceManagerClient extends
+ XmlRpcResourceManagerClient {
+
+ private MethodCallDetails lastMethodCallDetails;
+
+ public MockXmlRpcResourceManagerClient() throws MalformedURLException {
+ super(new URL("http://localhost:9000"));
+ }
+
+ public MethodCallDetails getLastMethodCallDetails() {
+ return lastMethodCallDetails;
+ }
+
+ public void addNode(ResourceNode node) throws MonitorException {
+ lastMethodCallDetails = new MethodCallDetails("addNode",
+ Lists.newArrayList((Object) node));
+ }
+
+ public void addNodeToQueue(String nodeId, String queueName)
+ throws QueueManagerException {
+ lastMethodCallDetails = new MethodCallDetails("addNodeToQueue",
+ Lists.newArrayList((Object) nodeId, queueName));
+ }
+
+ public void addQueue(String queueName) throws QueueManagerException {
+ lastMethodCallDetails = new MethodCallDetails("addQueue",
+ Lists.newArrayList((Object) queueName));
+ }
+
+ public String getExecutionNode(String jobId) {
+ lastMethodCallDetails = new MethodCallDetails("getExecutionNode",
+ Lists.newArrayList((Object) jobId));
+ return "TestNodeId";
+ }
+
+ public Job getJobInfo(String jobId) throws JobRepositoryException {
+ lastMethodCallDetails = new MethodCallDetails("getJobInfo",
+ Lists.newArrayList((Object) jobId));
+ Job job = new Job();
+ job.setId(jobId);
+ job.setName("TestJobName");
+ job.setJobInputClassName(NameValueJobInput.class.getCanonicalName());
+ job.setJobInstanceClassName(HelloWorldJob.class.getCanonicalName());
+ job.setLoadValue(4);
+ job.setQueueName("TestQueueName");
+ job.setStatus("DONE");
+ return job;
+ }
+
+ public ResourceNode getNodeById(String nodeId) throws MonitorException {
+ lastMethodCallDetails = new MethodCallDetails("getNodeById",
+ Lists.newArrayList((Object) nodeId));
+ try {
+ return new ResourceNode(nodeId, new URL("http://localhost:9999"), 5);
+ } catch (Exception e) {
+ throw new MonitorException(e);
+ }
+ }
+
+ public String getNodeLoad(String nodeId) throws MonitorException {
+ lastMethodCallDetails = new MethodCallDetails("getNodeLoad",
+ Lists.newArrayList((Object) nodeId));
+ return "10";
+ }
+
+ public List<ResourceNode> getNodes() throws MonitorException {
+ lastMethodCallDetails = new MethodCallDetails("getNodes",
+ Lists.newArrayList());
+ return Lists.newArrayList();
+ }
+
+ public List<String> getNodesInQueue(String queueName)
+ throws QueueManagerException {
+ lastMethodCallDetails = new MethodCallDetails("getNodesInQueue",
+ Lists.newArrayList((Object) queueName));
+ return Lists.newArrayList();
+ }
+
+ public List<String> getQueues() throws QueueManagerException {
+ lastMethodCallDetails = new MethodCallDetails("getQueues",
+ Lists.newArrayList());
+ return Lists.newArrayList();
+ }
+
+ public List<String> getQueuesWithNode(String nodeId) throws
QueueManagerException {
+ lastMethodCallDetails = new MethodCallDetails("getQueuesWithNode",
+ Lists.newArrayList((Object) nodeId));
+ return Lists.newArrayList();
+ }
+
+ public boolean killJob(String jobId) {
+ lastMethodCallDetails = new MethodCallDetails("killJob",
+ Lists.newArrayList((Object) jobId));
+ return true;
+ }
+
+ public void removeNode(String nodeId) throws MonitorException {
+ lastMethodCallDetails = new MethodCallDetails("removeNode",
+ Lists.newArrayList((Object) nodeId));
+ }
+
+ public void removeNodeFromQueue(String nodeId, String queueName) throws
QueueManagerException {
+ lastMethodCallDetails = new MethodCallDetails("removeNodeFromQueue",
+ Lists.newArrayList((Object) nodeId, queueName));
+ }
+
+ public void removeQueue(String queueName) throws QueueManagerException {
+ lastMethodCallDetails = new MethodCallDetails("removeQueue",
+ Lists.newArrayList((Object) queueName));
+ }
+
+ public void setNodeCapacity(String nodeId, int capacity) throws
MonitorException{
+ lastMethodCallDetails = new MethodCallDetails("setNodeCapacity",
+ Lists.newArrayList((Object) nodeId, capacity));
+ }
+
+ public String submitJob(Job exec, JobInput in) throws JobExecutionException
{
+ lastMethodCallDetails = new MethodCallDetails("submitJob",
+ Lists.newArrayList((Object) exec, in));
+ return "TestJobId";
+ }
+
+ public boolean submitJob(Job exec, JobInput in, URL url) throws
JobExecutionException {
+ lastMethodCallDetails = new MethodCallDetails("submitJob",
+ Lists.newArrayList((Object) exec, in, url));
+ return true;
+ }
+
+ public class MethodCallDetails {
+ private String methodName;
+ private List<Object> args;
+
+ public MethodCallDetails(String methodName, List<Object> args) {
+ this.methodName = methodName;
+ this.args = args;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public List<Object> getArgs() {
+ return args;
+ }
+ }
+}
Propchange:
oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/system/MockXmlRpcResourceManagerClient.java
------------------------------------------------------------------------------
svn:mime-type = text/plain