You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by bf...@apache.org on 2011/12/04 21:17:55 UTC
svn commit: r1210199 [3/5] - in /oodt/trunk/filemgr: ./ src/main/assembly/
src/main/bin/ src/main/java/org/apache/oodt/cas/filemgr/cli/
src/main/java/org/apache/oodt/cas/filemgr/cli/action/
src/main/java/org/apache/oodt/cas/filemgr/system/ src/main/jav...
Added: oodt/trunk/filemgr/src/main/resources/cmd-line-options.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/main/resources/cmd-line-options.xml?rev=1210199&view=auto
==============================================================================
--- oodt/trunk/filemgr/src/main/resources/cmd-line-options.xml (added)
+++ oodt/trunk/filemgr/src/main/resources/cmd-line-options.xml Sun Dec 4 20:17:53 2011
@@ -0,0 +1,1016 @@
+<?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="addProductType" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="deleteProductById" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="deleteProductByName" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="ingestProduct" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="hasProduct" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getProductTypeByName" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getNumProducts" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getFirstPage" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getNextPage" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getPrevPage" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getLastPage" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getCurrentTransfer" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getCurrentTransfers" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getProductById" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getProductByName" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getProductPctTransferred" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="getFilePctTransferred" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="sqlQuery" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="dumpMetadata" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="luceneQuery" p:required="false" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- AddProductType Options -->
+ <bean id="addProductType" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="addPT" />
+ <property name="longOption" value="addProductType" />
+ <property name="description" value="Triggers AddProductType Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>AddProductType</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddProductType" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="typeName" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="tn" />
+ <property name="longOption" value="typeName" />
+ <property name="description" value="ProductType name" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="product-type-name" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddProductType" 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="AddProductType" p:methodName="setProductTypeName" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="typeDesc" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="td" />
+ <property name="longOption" value="typeDesc" />
+ <property name="description" value="ProductType description" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="description" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddProductType" 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="AddProductType" p:methodName="setProductTypeDescription" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="repository" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="repo" />
+ <property name="longOption" value="repository" />
+ <property name="description" value="ProductType repository" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="file-path" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddProductType" 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="AddProductType" p:methodName="setFileRepositoryPath" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="versionClass" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="vc" />
+ <property name="longOption" value="versionClass" />
+ <property name="description" value="ProductType versioner class" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="classpath" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="AddProductType" 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="AddProductType" p:methodName="setVersioner" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- IngestProduct Options -->
+ <bean id="ingestProduct" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="ingest" />
+ <property name="longOption" value="ingestProduct" />
+ <property name="description" value="Triggers IngestProduct Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>IngestProduct</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="IngestProduct" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="productStructure" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="ps" />
+ <property name="longOption" value="productStructure" />
+ <property name="description" value="Hierarchical | Flat" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="structure-type" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="IngestProduct" 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="IngestProduct" p:methodName="setProductStructure" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="metadataFile" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="mf" />
+ <property name="longOption" value="metadataFile" />
+ <property name="description" value="Metadata XML file path or URL" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="file-path-or-url" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="IngestProduct" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="clientTransfer" class="org.apache.oodt.cas.cli.option.GroupCmdLineOption">
+ <property name="shortOption" value="ct" />
+ <property name="longOption" value="clientTransfer" />
+ <property name="description" value="User client transferer" />
+ <property name="hasArgs" value="false" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="IngestProduct" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="subOptions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="dataTransfer" p:required="true" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="dataTransfer" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="dt" />
+ <property name="longOption" value="dataTransfer" />
+ <property name="description" value="DataTransferer factory class" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="classpath" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="IngestProduct" 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="IngestProduct" p:methodName="setDataTransferer" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="refs" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="rs" />
+ <property name="longOption" value="refs" />
+ <property name="description" value="Data file path or URL" />
+ <property name="type" value="java.util.List" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="file-path-or-url" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="IngestProduct" 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="IngestProduct" p:methodName="setReferences" />
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- HasProduct Options -->
+ <bean id="hasProduct" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="product" />
+ <property name="longOption" value="hasProduct" />
+ <property name="description" value="Triggers HasProduct Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>HasProduct</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="HasProduct" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetProductTypeByName Options -->
+ <bean id="getProductTypeByName" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="ptbyn" />
+ <property name="longOption" value="getProductTypeByName" />
+ <property name="description" value="Triggers GetProductTypeByName Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetProductTypeByName</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetProductTypeByName" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetNumProducts Options -->
+ <bean id="getNumProducts" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="num" />
+ <property name="longOption" value="getNumProducts" />
+ <property name="description" value="Triggers GetNumProducts Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetNumProducts</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNumProducts" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetFirstPage Options -->
+ <bean id="getFirstPage" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="page1" />
+ <property name="longOption" value="getFirstPage" />
+ <property name="description" value="Triggers GetFirstPage Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetFirstPage</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetFirstPage" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetNextPage Options -->
+ <bean id="getNextPage" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="next" />
+ <property name="longOption" value="getNextPage" />
+ <property name="description" value="Triggers GetNextPage Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetNextPage</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNextPage" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetPrevPage Options -->
+ <bean id="getPrevPage" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="prev" />
+ <property name="longOption" value="getPrevPage" />
+ <property name="description" value="Triggers GetPrevPage Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetPrevPage</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetPrevPage" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetLastPage Options -->
+ <bean id="getLastPage" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="last" />
+ <property name="longOption" value="getLastPage" />
+ <property name="description" value="Triggers GetLastPage Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetLastPage</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetLastPage" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetCurrentTransfer Options -->
+ <bean id="getCurrentTransfer" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="curTran" />
+ <property name="longOption" value="getCurrentTransfer" />
+ <property name="description" value="Triggers GetCurrentTransfer Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetCurrentTransfer</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetCurrentTransfer" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetCurrentTransfers Options -->
+ <bean id="getCurrentTransfers" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="curTrans" />
+ <property name="longOption" value="getCurrentTransfers" />
+ <property name="description" value="Triggers GetCurrentTransfers Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetCurrentTransfers</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetCurrentTransfers" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetProductPercentTransferred Options -->
+ <bean id="getProductPctTransferred" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="pctTrans" />
+ <property name="longOption" value="getProductPctTransferred" />
+ <property name="description" value="Triggers GetProductPercentTransferred Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetProductPercentTransferred</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetProductPercentTransferred" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetFilePercentTransferred Options -->
+ <bean id="getFilePctTransferred" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="filePctTrans" />
+ <property name="longOption" value="getFilePctTransferred" />
+ <property name="description" value="Triggers GetFilePercentTransferred Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetFilePercentTransferred</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetFilePercentTransferred" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="origRef" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="or" />
+ <property name="longOption" value="origRef" />
+ <property name="description" value="Original reference" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="file-path-or-url" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetFilePercentTransferred" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <!-- SqlQuery Options -->
+ <bean id="sqlQuery" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="sql" />
+ <property name="longOption" value="sqlQuery" />
+ <property name="description" value="Triggers SqlQuery Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>SqlQuery</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="sortBy" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="sb" />
+ <property name="longOption" value="sortBy" />
+ <property name="description" value="Metadata field to sort query results by" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="metadata field" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="outputFormat" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="of" />
+ <property name="longOption" value="outputFormat" />
+ <property name="description" value="Output format string (i.e. Filename = $Filename)" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="output-format-string" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="delimiter" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="dlmtr" />
+ <property name="longOption" value="delimiter" />
+ <property name="description" value="String to use the separate query results" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="delimiter-string" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="filter" class="org.apache.oodt.cas.cli.option.GroupCmdLineOption">
+ <property name="shortOption" value="f" />
+ <property name="longOption" value="filter" />
+ <property name="description" value="Query filter" />
+ <property name="hasArgs" value="false" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="subOptions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="algor" p:required="true" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="converter" p:required="false" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="startDateTimeMetKey" p:required="true" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="endDateTimeMetKey" p:required="true" />
+ <bean class="org.apache.oodt.cas.cli.option.GroupSubOption"
+ p:option-ref="priorityMetKey" p:required="true" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="algor" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="algor" />
+ <property name="longOption" value="algor" />
+ <property name="description" value="FilterAlgor class" />
+ <property name="type" value="org.apache.oodt.cas.filemgr.structs.query.filter.FilterAlgor" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="classpath" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="converter" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="conv" />
+ <property name="longOption" value="converter" />
+ <property name="description" value="VersionConverter class" />
+ <property name="type" value="org.apache.oodt.cas.filemgr.structs.query.conv.VersionConverter" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="classpath" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="startDateTimeMetKey" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="sdtMetKey" />
+ <property name="longOption" value="startDateTimeMetKey" />
+ <property name="description" value="Start date time metadata key" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="metadata-key" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="endDateTimeMetKey" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="edtMetKey" />
+ <property name="longOption" value="endDateTimeMetKey" />
+ <property name="description" value="End date time metadata key" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="metadata-key" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="priorityMetKey" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="prMetKey" />
+ <property name="longOption" value="priorityMetKey" />
+ <property name="description" value="Priority metadata key" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="metadata-key" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <!-- GetProductById Options -->
+ <bean id="getProductById" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="pbyid" />
+ <property name="longOption" value="getProductById" />
+ <property name="description" value="Triggers GetProductById Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetProductById</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetProductById" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- GetProductByName Options -->
+ <bean id="getProductByName" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="pbyn" />
+ <property name="longOption" value="getProductByName" />
+ <property name="description" value="Triggers GetProductByName Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>GetProductByName</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetProductByName" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- DeleteProductById Options -->
+ <bean id="deleteProductById" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="dbyid" />
+ <property name="longOption" value="deleteProductById" />
+ <property name="description" value="Triggers DeleteProductById Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>DeleteProductById</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="DeleteProductById" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- DeleteProductByName Options -->
+ <bean id="deleteProductByName" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="dbyn" />
+ <property name="longOption" value="deleteProductByName" />
+ <property name="description" value="Triggers DeleteProductByName Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>DeleteProductByName</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="DeleteProductByName" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- DumpMetadata Options -->
+ <bean id="dumpMetadata" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="dmet" />
+ <property name="longOption" value="dumpMetadata" />
+ <property name="description" value="Triggers DumpMetadata Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>DumpMetadata</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="DumpMetadata" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <bean id="outputDir" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="out" />
+ <property name="longOption" value="outputDir" />
+ <property name="description" value="Output directory" />
+ <property name="type" value="java.io.File" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="file-dir" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="DumpMetadata" p:relation="OPTIONAL" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <!-- LuceneQuery Options -->
+ <bean id="luceneQuery" class="org.apache.oodt.cas.cli.option.ActionCmdLineOption"
+ p:isSubOption="true">
+ <property name="shortOption" value="lucene" />
+ <property name="longOption" value="luceneQuery" />
+ <property name="description" value="Triggers LuceneQuery Action" />
+ <property name="hasArgs" value="false" />
+ <property name="staticArgs">
+ <list>
+ <value>LuceneQuery</value>
+ </list>
+ </property>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="LuceneQuery" p:relation="REQUIRED" />
+ </list>
+ </property>
+ </bean>
+
+ <!-- Options used for multiple Actions -->
+ <bean id="productId" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="pid" />
+ <property name="longOption" value="productId" />
+ <property name="description" value="Product ID" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="product-id" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetProductPercentTransferred" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetProductById" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="DeleteProductById" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="DumpMetadata" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="productName" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="pn" />
+ <property name="longOption" value="productName" />
+ <property name="description" value="Product name" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="product-name" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="IngestProduct" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="HasProduct" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetProductByName" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="DeleteProductByName" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="productTypeName" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="ptn" />
+ <property name="longOption" value="productTypeName" />
+ <property name="description" value="ProductType name" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="product-type-name" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="IngestProduct" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetProductTypeByName" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNumProducts" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetFirstPage" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNextPage" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetPrevPage" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetLastPage" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetProductPercentTransferred" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="currentPageNum" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="curPage" />
+ <property name="longOption" value="currentPageNum" />
+ <property name="description" value="Current Page Number" />
+ <property name="type" value="int" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="page-number" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetNextPage" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="GetPrevPage" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+
+ <bean id="query" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="q" />
+ <property name="longOption" value="query" />
+ <property name="description" value="File Manager query" />
+ <property name="hasArgs" value="true" />
+ <property name="argsDescription" value="query" />
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="SqlQuery" p:relation="REQUIRED" />
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="LuceneQuery" p:relation="REQUIRED" />
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler" />
+ </property>
+ </bean>
+</beans>
Propchange: oodt/trunk/filemgr/src/main/resources/cmd-line-options.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: oodt/trunk/filemgr/src/main/resources/logging.properties
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/main/resources/logging.properties?rev=1210199&r1=1210198&r2=1210199&view=diff
==============================================================================
--- oodt/trunk/filemgr/src/main/resources/logging.properties (original)
+++ oodt/trunk/filemgr/src/main/resources/logging.properties Sun Dec 4 20:17:53 2011
@@ -63,3 +63,11 @@ org.apache.commons.httpclient.level = IN
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/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/TestFileManagerCli.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/TestFileManagerCli.java?rev=1210199&view=auto
==============================================================================
--- oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/TestFileManagerCli.java (added)
+++ oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/TestFileManagerCli.java Sun Dec 4 20:17:53 2011
@@ -0,0 +1,330 @@
+/*
+ * 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.filemgr.cli;
+
+//JDK imports
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+//JUnit imports
+import junit.framework.TestCase;
+
+//Apache imports
+import org.apache.commons.io.FileUtils;
+
+//OODT imports
+import org.apache.oodt.cas.cli.CmdLineUtility;
+import org.apache.oodt.cas.filemgr.datatransfer.InPlaceDataTransferFactory;
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.ProductPage;
+import org.apache.oodt.cas.filemgr.structs.ProductType;
+import org.apache.oodt.cas.filemgr.structs.Query;
+import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.filemgr.structs.TermQueryCriteria;
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.MockXmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.system.MockXmlRpcFileManagerClient.MethodCallDetails;
+import org.apache.oodt.cas.metadata.Metadata;
+
+/**
+ * Tests File Manager Clients Command-line interface.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class TestFileManagerCli 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");
+ }
+
+ private CmdLineUtility cmdLineUtility;
+ private MockXmlRpcFileManagerClient client;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ cmdLineUtility = new CmdLineUtility();
+ UseMockClientCmdLineActionStore actionStore = new UseMockClientCmdLineActionStore();
+ client = actionStore.getClient();
+ cmdLineUtility.setActionStore(actionStore);
+ }
+
+ public void testAddProductType() throws MalformedURLException,
+ ConnectionException {
+ String productTypeName = "TestProductType";
+ String productTypeDesc = "ProductTypeDesc";
+ String productTypeRepo = "ProductTypeRepo";
+ String productTypeVersioner = "ProductTypeVersioner";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --addProductType"
+ + " --typeName " + productTypeName + " --typeDesc "
+ + productTypeDesc + " --repository " + productTypeRepo
+ + " --versionClass " + productTypeVersioner).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("addProductType", methodCallDetails.getMethodName());
+ assertEquals(1, methodCallDetails.getArgs().size());
+ ProductType pt = (ProductType) methodCallDetails.getArgs().get(0);
+ assertEquals(productTypeName, pt.getName());
+ assertEquals(productTypeDesc, pt.getDescription());
+ assertEquals(productTypeRepo, pt.getProductRepositoryPath());
+ assertEquals(productTypeVersioner, pt.getVersioner());
+ }
+
+ public void testDeleteProductById() {
+ String productId = "TestProductId";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --deleteProductById"
+ + " --productId " + productId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("removeProduct", methodCallDetails.getMethodName());
+ assertEquals(1, methodCallDetails.getArgs().size());
+ assertEquals(productId,
+ ((Product) methodCallDetails.getArgs().get(0)).getProductId());
+ }
+
+ public void testDeleteProductByName() {
+ String productName = "TestProductName";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --deleteProductByName"
+ + " --productName " + productName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("removeProduct", methodCallDetails.getMethodName());
+ assertEquals(1, methodCallDetails.getArgs().size());
+ assertEquals(productName,
+ ((Product) methodCallDetails.getArgs().get(0)).getProductName());
+ }
+
+ public void testGetCurrentTransfer() {
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getCurrentTransfer")
+ .split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getCurrentFileTransfer", methodCallDetails.getMethodName());
+ assertEquals(0, methodCallDetails.getArgs().size());
+ }
+
+ public void testGetCurrentTransfers() {
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getCurrentTransfers")
+ .split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getCurrentFileTransfers", methodCallDetails.getMethodName());
+ assertEquals(0, methodCallDetails.getArgs().size());
+ }
+
+ public void testGetFilePercentTransferred() {
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getFilePctTransferred"
+ + " --origRef src/testdata/test.txt").split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getRefPctTransferred", methodCallDetails.getMethodName());
+ assertTrue(((Reference) methodCallDetails.getArgs().get(0))
+ .getOrigReference().endsWith("src/testdata/test.txt"));
+ }
+
+ public void testGetFirstPage() {
+ String productTypeName = "ProductTypeName";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getFirstPage"
+ + " --productTypeName " + productTypeName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getFirstPage", methodCallDetails.getMethodName());
+ assertEquals(productTypeName, ((ProductType) methodCallDetails.getArgs()
+ .get(0)).getName());
+ }
+
+ public void testGetLastPage() {
+ String productTypeName = "ProductTypeName";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getLastPage"
+ + " --productTypeName " + productTypeName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getLastPage", methodCallDetails.getMethodName());
+ assertEquals(productTypeName, ((ProductType) methodCallDetails.getArgs()
+ .get(0)).getName());
+ }
+
+ public void testGetNextPage() {
+ String productTypeName = "ProductTypeName";
+ int curPage = 1;
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getNextPage"
+ + " --productTypeName " + productTypeName + " --curPage " + curPage)
+ .split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getNextPage", methodCallDetails.getMethodName());
+ assertEquals(productTypeName, ((ProductType) methodCallDetails.getArgs()
+ .get(0)).getName());
+ assertEquals(curPage,
+ ((ProductPage) methodCallDetails.getArgs().get(1)).getPageNum());
+ }
+
+ public void testGetPrevPage() {
+ String productTypeName = "ProductTypeName";
+ int curPage = 1;
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getPrevPage"
+ + " --productTypeName " + productTypeName + " --curPage " + curPage)
+ .split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getPrevPage", methodCallDetails.getMethodName());
+ assertEquals(productTypeName, ((ProductType) methodCallDetails.getArgs()
+ .get(0)).getName());
+ assertEquals(curPage,
+ ((ProductPage) methodCallDetails.getArgs().get(1)).getPageNum());
+ }
+
+ public void testGetNumProducts() {
+ String productTypeName = "ProductTypeName";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getNumProducts"
+ + " --productTypeName " + productTypeName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getNumProducts", methodCallDetails.getMethodName());
+ assertEquals(productTypeName, ((ProductType) methodCallDetails.getArgs()
+ .get(0)).getName());
+ }
+
+ public void testGetProductById() {
+ String productId = "TestProductId";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getProductById"
+ + " --productId " + productId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getProductById", methodCallDetails.getMethodName());
+ assertEquals(productId, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetProductByName() {
+ String productName = "TestProductName";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getProductByName"
+ + " --productName " + productName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getProductByName", methodCallDetails.getMethodName());
+ assertEquals(productName, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testGetProductPercnetTransferred() {
+ String productId = "TestProductId";
+ String productTypeName = "TestProductType";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getProductPctTransferred"
+ + " --productId " + productId + " --productTypeName " + productTypeName)
+ .split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getProductPctTransferred",
+ methodCallDetails.getMethodName());
+ assertEquals(productId,
+ ((Product) methodCallDetails.getArgs().get(0)).getProductId());
+ }
+
+ public void testGetProductTypeByName() {
+ String productTypeName = "TestProductType";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --getProductTypeByName"
+ + " --productTypeName " + productTypeName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getProductTypeByName", methodCallDetails.getMethodName());
+ assertEquals(productTypeName, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testHasProduct() {
+ String productName = "TestProductName";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --hasProduct"
+ + " --productName " + productName).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("hasProduct", methodCallDetails.getMethodName());
+ assertEquals(productName, methodCallDetails.getArgs().get(0));
+ }
+
+ public void testIngestProduct() {
+ String productName = "TestProductName";
+ String structure = Product.STRUCTURE_FLAT;
+ String productTypeName = "TestProductType";
+ String metadataFile = "src/testdata/ingest/test.txt.met";
+ String dataTransferer = InPlaceDataTransferFactory.class
+ .getCanonicalName();
+ String ref = "src/testdata/test.txt";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --ingestProduct"
+ + " --productName " + productName + " --productStructure "
+ + structure + " --productTypeName " + productTypeName
+ + " --metadataFile " + metadataFile + " --refs " + ref
+ + " --clientTransfer --dataTransfer " + dataTransferer)
+ .split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("ingestProduct", methodCallDetails.getMethodName());
+ assertEquals(productName,
+ ((Product) methodCallDetails.getArgs().get(0)).getProductName());
+ assertEquals(structure,
+ ((Product) methodCallDetails.getArgs().get(0))
+ .getProductStructure());
+ assertEquals(productTypeName,
+ ((Product) methodCallDetails.getArgs().get(0)).getProductType()
+ .getName());
+ assertTrue(((Product) methodCallDetails.getArgs().get(0))
+ .getProductReferences().get(0).getOrigReference().endsWith(ref));
+
+ assertEquals("test.txt",
+ ((Metadata) methodCallDetails.getArgs().get(1))
+ .getMetadata("Filename"));
+ assertEquals("GenericFile", ((Metadata) methodCallDetails.getArgs()
+ .get(1)).getMetadata("ProductType"));
+ assertEquals(true, methodCallDetails.getArgs().get(2));
+ }
+
+ public void testDumpMetadata() throws IOException {
+ String productId = "TestProductId";
+ File bogusFile = File.createTempFile("bogus", "bogus");
+ File tmpFile = new File(bogusFile.getParentFile(), "CliDumpMetadata");
+ tmpFile.mkdirs();
+ bogusFile.delete();
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --dumpMetadata"
+ + " --productId " + productId).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("getMetadata", methodCallDetails.getMethodName());
+ assertEquals(productId,
+ ((Product) methodCallDetails.getArgs().get(0)).getProductId());
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --dumpMetadata"
+ + " --productId " + productId + " --outputDir " + tmpFile
+ .getAbsolutePath()).split(" "));
+ FileUtils.forceDelete(tmpFile);
+ }
+
+ public void testLuceneQuery() {
+ String query = "ProductId:TestProductId";
+ cmdLineUtility
+ .run(("--url http://localhost:9000 --operation --luceneQuery"
+ + " --query " + query).split(" "));
+ MethodCallDetails methodCallDetails = client.getLastMethodCallDetails();
+ assertEquals("query", methodCallDetails.getMethodName());
+ assertEquals("ProductId", ((TermQueryCriteria) ((Query) methodCallDetails
+ .getArgs().get(0)).getCriteria().get(0)).getElementName());
+ assertEquals("TestProductId",
+ ((TermQueryCriteria) ((Query) methodCallDetails.getArgs().get(0))
+ .getCriteria().get(0)).getValue());
+ }
+}
Propchange: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/TestFileManagerCli.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/UseMockClientCmdLineActionStore.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/UseMockClientCmdLineActionStore.java?rev=1210199&view=auto
==============================================================================
--- oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/UseMockClientCmdLineActionStore.java (added)
+++ oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/UseMockClientCmdLineActionStore.java Sun Dec 4 20:17:53 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.filemgr.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.filemgr.cli.action.FileManagerCliAction;
+import org.apache.oodt.cas.filemgr.system.MockXmlRpcFileManagerClient;
+
+/**
+ * A {@link SpringCmdLineActionStore} which sets {@link WorkflowCliAction}s
+ * to use a {@link MockXmlRpcWorkflowManagerClient}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class UseMockClientCmdLineActionStore extends SpringCmdLineActionStore {
+
+ private MockXmlRpcFileManagerClient client;
+
+ public UseMockClientCmdLineActionStore() {
+ super(System.getProperty("org.apache.oodt.cas.cli.action.spring.config"));
+ try {
+ client = new MockXmlRpcFileManagerClient();
+ } 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 FileManagerCliAction) {
+ ((FileManagerCliAction) action).setClient(client);
+ }
+ }
+ return actions;
+ }
+
+ public MockXmlRpcFileManagerClient getClient() {
+ return client;
+ }
+}
Propchange: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/UseMockClientCmdLineActionStore.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestAddProductTypeCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestAddProductTypeCliAction.java?rev=1210199&view=auto
==============================================================================
--- oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestAddProductTypeCliAction.java (added)
+++ oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestAddProductTypeCliAction.java Sun Dec 4 20:17:53 2011
@@ -0,0 +1,114 @@
+/*
+ * 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.filemgr.cli.action;
+
+//JDK imports
+import java.net.MalformedURLException;
+import java.net.URL;
+
+//OODT imports
+import org.apache.oodt.cas.cli.action.CmdLineAction.ActionMessagePrinter;
+import org.apache.oodt.cas.cli.exception.CmdLineActionException;
+import org.apache.oodt.cas.filemgr.structs.ProductType;
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.versioning.BasicVersioner;
+
+//JUnit imports
+import junit.framework.TestCase;
+
+/**
+ * Test class for {@link AddProductTypeCliAction}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class TestAddProductTypeCliAction extends TestCase {
+
+ private static final String PRODUCT_TYPE_NAME = "TestProductTypeName";
+ private static final String PRODUCT_TYPE_ID = "TestProductTypeId";
+ private static final String PRODUCT_TYPE_DESC = "TestProductTypeDesc";
+ private static final String PRODUCT_TYPE_REPO = "TestProductTypeRepo";
+ private static final String PRODUCT_TYPE_VERSIONER = BasicVersioner.class
+ .getCanonicalName();
+
+ private static ProductType productTypePassedToClient;
+
+ public void testValidateErrors() throws CmdLineActionException {
+ ActionMessagePrinter printer = new ActionMessagePrinter();
+ MockAddProductTypeCliAction cliAction = new MockAddProductTypeCliAction();
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ cliAction.setProductTypeName(PRODUCT_TYPE_NAME);
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ cliAction.setProductTypeDescription(PRODUCT_TYPE_DESC);
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ cliAction.setFileRepositoryPath(PRODUCT_TYPE_REPO);
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ cliAction.setVersioner(PRODUCT_TYPE_VERSIONER);
+ cliAction.execute(printer); // Should not throw exception.
+ }
+
+ public void testDataFlow() throws CmdLineActionException {
+ MockAddProductTypeCliAction cliAction = new MockAddProductTypeCliAction();
+ cliAction.setProductTypeName(PRODUCT_TYPE_NAME);
+ cliAction.setProductTypeDescription(PRODUCT_TYPE_DESC);
+ cliAction.setFileRepositoryPath(PRODUCT_TYPE_REPO);
+ cliAction.setVersioner(PRODUCT_TYPE_VERSIONER);
+ ActionMessagePrinter printer = new ActionMessagePrinter();
+ cliAction.execute(printer);
+ assertEquals(2, printer.getPrintedMessages().size());
+ assertEquals("addProductType: Result: " + PRODUCT_TYPE_ID, printer
+ .getPrintedMessages().get(0));
+ assertEquals("\n", printer.getPrintedMessages().get(1));
+
+ assertEquals(PRODUCT_TYPE_NAME, productTypePassedToClient.getName());
+ assertEquals(PRODUCT_TYPE_DESC,
+ productTypePassedToClient.getDescription());
+ assertEquals(PRODUCT_TYPE_REPO,
+ productTypePassedToClient.getProductRepositoryPath());
+ assertEquals(PRODUCT_TYPE_VERSIONER,
+ productTypePassedToClient.getVersioner());
+ }
+
+ public class MockAddProductTypeCliAction extends AddProductTypeCliAction {
+ public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ ConnectionException {
+ return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ false) {
+ public String addProductType(ProductType type) {
+ productTypePassedToClient = type;
+ return PRODUCT_TYPE_ID;
+ }
+ };
+ }
+ }
+}
Propchange: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestAddProductTypeCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByIdCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByIdCliAction.java?rev=1210199&view=auto
==============================================================================
--- oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByIdCliAction.java (added)
+++ oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByIdCliAction.java Sun Dec 4 20:17:53 2011
@@ -0,0 +1,208 @@
+/*
+ * 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.filemgr.cli.action;
+
+//JDK imports
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.cli.action.CmdLineAction.ActionMessagePrinter;
+import org.apache.oodt.cas.cli.exception.CmdLineActionException;
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+
+//Google imports
+import com.google.common.collect.Lists;
+
+//JUnit imports
+import junit.framework.TestCase;
+
+/**
+ * Test class for {@link DeleteProductByIdCliAction}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class TestDeleteProductByIdCliAction extends TestCase {
+
+ private static final String PRODUCT_ID = "TestProductId";
+ private static final String PRODUCT_NAME = "TestProductName";
+ private static final String REF_1 = "file:/ds/ref/1/path";
+ private static final String REF_2 = "file:/ds/ref/2/path";
+
+ private Product clientSetProduct;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ clientSetProduct = null;
+ }
+
+ public void testValidateErrors() throws CmdLineActionException {
+ ActionMessagePrinter printer = new ActionMessagePrinter();
+ MockDeleteProductByIdCliAction cliAction = new MockDeleteProductByIdCliAction();
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ cliAction.setProductId(PRODUCT_ID);
+ cliAction.execute(printer); // Should not throw exception.
+ cliAction = new NullProductDeleteProductByIdCliAction();
+ cliAction.setProductId(PRODUCT_ID);
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ cliAction = new FalseDeleteProductByIdCliAction();
+ cliAction.setProductId(PRODUCT_ID);
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ cliAction = new NullRefsDeleteProductByIdCliAction();
+ cliAction.setProductId(PRODUCT_ID);
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ }
+
+ public void testDataFlow() throws CmdLineActionException {
+ ActionMessagePrinter printer = new ActionMessagePrinter();
+ MockDeleteProductByIdCliAction cliAction = new MockDeleteProductByIdCliAction();
+ cliAction.setProductId(PRODUCT_ID);
+ cliAction.execute(printer);
+ assertEquals(2, printer.getPrintedMessages().size());
+ assertEquals("Successfully deleted product '" + PRODUCT_NAME + "'",
+ printer.getPrintedMessages().get(0));
+ assertEquals("\n", printer.getPrintedMessages().get(1));
+ assertEquals(PRODUCT_ID, clientSetProduct.getProductId());
+ assertEquals(PRODUCT_NAME, clientSetProduct.getProductName());
+ assertEquals(2, clientSetProduct.getProductReferences().size());
+ assertEquals(REF_1, clientSetProduct.getProductReferences().get(0)
+ .getDataStoreReference());
+ assertEquals(REF_2, clientSetProduct.getProductReferences().get(1)
+ .getDataStoreReference());
+ }
+
+ public class MockDeleteProductByIdCliAction extends
+ DeleteProductByIdCliAction {
+ @Override
+ public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ ConnectionException {
+ return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ false) {
+ @Override
+ public Product getProductById(String productId) {
+ Product p = new Product();
+ p.setProductId(productId);
+ p.setProductName(PRODUCT_NAME);
+ return p;
+ }
+ @Override
+ public List<Reference> getProductReferences(Product product) {
+ product.setProductReferences(Lists.newArrayList(new Reference(
+ "file:/file/path", REF_1, 2), new Reference(
+ "file:/file/path", REF_2, 2)));
+ return product.getProductReferences();
+ }
+ @Override
+ public boolean removeProduct(Product p) {
+ clientSetProduct = p;
+ return true;
+ }
+ @Override
+ public boolean removeFile(String file) {
+ return true;
+ }
+ };
+ }
+ }
+
+ public class NullProductDeleteProductByIdCliAction extends
+ MockDeleteProductByIdCliAction {
+ @Override
+ public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ ConnectionException {
+ return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ false) {
+ @Override
+ public Product getProductById(String productId) {
+ return null;
+ }
+ };
+ }
+ }
+
+ public class NullRefsDeleteProductByIdCliAction extends
+ MockDeleteProductByIdCliAction {
+ @Override
+ public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ ConnectionException {
+ return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ false) {
+ @Override
+ public Product getProductById(String productId) {
+ Product p = new Product();
+ p.setProductId(productId);
+ p.setProductName(PRODUCT_NAME);
+ return p;
+ }
+ @Override
+ public List<Reference> getProductReferences(Product product) {
+ return null;
+ }
+ };
+ }
+ }
+
+ public class FalseDeleteProductByIdCliAction extends
+ MockDeleteProductByIdCliAction {
+ @Override
+ public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ ConnectionException {
+ return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ false) {
+ @Override
+ public Product getProductById(String productId) {
+ Product p = new Product();
+ p.setProductId(productId);
+ p.setProductName(PRODUCT_NAME);
+ return p;
+ }
+ @Override
+ public List<Reference> getProductReferences(Product product) {
+ product.setProductReferences(Lists.newArrayList(new Reference(
+ "file:/file/path", REF_1, 2), new Reference(
+ "file:/file/path", REF_2, 2)));
+ return product.getProductReferences();
+ }
+ @Override
+ public boolean removeProduct(Product p) {
+ return false;
+ }
+ };
+ }
+ }
+}
Propchange: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByIdCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByNameCliAction.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByNameCliAction.java?rev=1210199&view=auto
==============================================================================
--- oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByNameCliAction.java (added)
+++ oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByNameCliAction.java Sun Dec 4 20:17:53 2011
@@ -0,0 +1,184 @@
+/*
+ * 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.filemgr.cli.action;
+
+//JDK imports
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.cli.action.CmdLineAction.ActionMessagePrinter;
+import org.apache.oodt.cas.cli.exception.CmdLineActionException;
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+
+//Google imports
+import com.google.common.collect.Lists;
+
+//JUnit imports
+import junit.framework.TestCase;
+
+/**
+ * Test class for {@link DeleteProductByNameCliAction}.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class TestDeleteProductByNameCliAction extends TestCase {
+
+ private static final String PRODUCT_ID = "TestProductId";
+ private static final String PRODUCT_NAME = "TestProductName";
+ private static final String REF_1 = "file:/ds/ref/1/path";
+ private static final String REF_2 = "file:/ds/ref/2/path";
+
+ private Product clientSetProduct;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ clientSetProduct = null;
+ }
+
+ public void testValidateErrors() throws CmdLineActionException {
+ ActionMessagePrinter printer = new ActionMessagePrinter();
+ MockDeleteProductByNameCliAction cliAction = new MockDeleteProductByNameCliAction();
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ cliAction.setProductName(PRODUCT_NAME);
+ cliAction.execute(printer); // Should not throw exception.
+ cliAction = new NullProductDeleteProductByNameCliAction();
+ cliAction.setProductName(PRODUCT_NAME);
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ cliAction = new FalseDeleteProductByNameCliAction();
+ cliAction.setProductName(PRODUCT_NAME);
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ cliAction = new NullRefsDeleteProductByNameCliAction();
+ cliAction.setProductName(PRODUCT_ID);
+ try {
+ cliAction.execute(printer);
+ fail("Expected throw CmdLineActionException");
+ } catch (CmdLineActionException ignore) {
+ }
+ }
+
+ public void testDataFlow() throws CmdLineActionException {
+ ActionMessagePrinter printer = new ActionMessagePrinter();
+ MockDeleteProductByNameCliAction cliAction = new MockDeleteProductByNameCliAction();
+ cliAction.setProductName(PRODUCT_NAME);
+ cliAction.execute(printer);
+ assertEquals(2, printer.getPrintedMessages().size());
+ assertEquals("Successfully deleted product '" + PRODUCT_NAME + "'",
+ printer.getPrintedMessages().get(0));
+ assertEquals("\n", printer.getPrintedMessages().get(1));
+ assertEquals(PRODUCT_ID, clientSetProduct.getProductId());
+ assertEquals(PRODUCT_NAME, clientSetProduct.getProductName());
+ assertEquals(2, clientSetProduct.getProductReferences().size());
+ assertEquals(REF_1, clientSetProduct.getProductReferences().get(0)
+ .getDataStoreReference());
+ assertEquals(REF_2, clientSetProduct.getProductReferences().get(1)
+ .getDataStoreReference());
+ }
+
+ public class MockDeleteProductByNameCliAction extends DeleteProductByNameCliAction {
+ @Override
+ public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ ConnectionException {
+ return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ false) {
+ @Override
+ public Product getProductByName(String productName) {
+ Product p = new Product();
+ p.setProductId(PRODUCT_ID);
+ p.setProductName(productName);
+ return p;
+ }
+ @Override
+ public List<Reference> getProductReferences(Product product) {
+ product.setProductReferences(Lists.newArrayList(new Reference(
+ "file:/file/path", REF_1, 2), new Reference(
+ "file:/file/path", REF_2, 2)));
+ return product.getProductReferences();
+ }
+ @Override
+ public boolean removeProduct(Product p) {
+ clientSetProduct = p;
+ return true;
+ }
+ @Override
+ public boolean removeFile(String file) {
+ return true;
+ }
+ };
+ }
+ }
+
+ public class NullProductDeleteProductByNameCliAction extends MockDeleteProductByNameCliAction {
+ @Override
+ public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ ConnectionException {
+ return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ false) {
+ @Override
+ public Product getProductByName(String productName) {
+ return null;
+ }
+ };
+ }
+ }
+
+ public class NullRefsDeleteProductByNameCliAction extends
+ MockDeleteProductByNameCliAction {
+ @Override
+ public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ ConnectionException {
+ return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ false) {
+ @Override
+ public List<Reference> getProductReferences(Product product) {
+ return null;
+ }
+ };
+ }
+ }
+
+ public class FalseDeleteProductByNameCliAction extends MockDeleteProductByNameCliAction {
+ @Override
+ public XmlRpcFileManagerClient getClient() throws MalformedURLException,
+ ConnectionException {
+ return new XmlRpcFileManagerClient(new URL("http://localhost:9000"),
+ false) {
+ @Override
+ public boolean removeProduct(Product p) {
+ return false;
+ }
+ };
+ }
+ }
+}
Propchange: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/cli/action/TestDeleteProductByNameCliAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain