Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetCurrentTransfersCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetCurrentTransfersCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetCurrentTransfersCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetCurrentTransfersCliAction.java Tue Sep 8 04:25:17 2015 @@ -28,7 +28,7 @@ import org.apache.oodt.cas.filemgr.struc 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; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; //Google imports import com.google.common.collect.Lists; @@ -80,9 +80,9 @@ public class TestGetCurrentTransfersCliA public class MockGetCurrentTransfersCliAction extends GetCurrentTransfersCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public List<FileTransferStatus> getCurrentFileTransfers() { @@ -101,9 +101,9 @@ public class TestGetCurrentTransfersCliA public class NullStatusGetCurrentTransfersCliAction extends GetCurrentTransfersCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public List<FileTransferStatus> getCurrentFileTransfers() {
Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetFilePercentTransferredCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetFilePercentTransferredCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetFilePercentTransferredCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetFilePercentTransferredCliAction.java Tue Sep 8 04:25:17 2015 @@ -25,7 +25,7 @@ import org.apache.oodt.cas.cli.action.Cm import org.apache.oodt.cas.cli.exception.CmdLineActionException; 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; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; //JUnit imports import junit.framework.TestCase; @@ -73,9 +73,9 @@ public class TestGetFilePercentTransferr public class MockGetFilePercentTransferredCliAction extends GetFilePercentTransferredCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public double getRefPctTransferred(Reference reference) { Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetFirstPageCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetFirstPageCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetFirstPageCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetFirstPageCliAction.java Tue Sep 8 04:25:17 2015 @@ -27,7 +27,7 @@ import org.apache.oodt.cas.filemgr.struc import org.apache.oodt.cas.filemgr.structs.ProductPage; 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.system.FileManagerClient; //Google imports import com.google.common.collect.Lists; @@ -96,9 +96,9 @@ public class TestGetFirstPageCliAction e public class MockGetFirstPageCliAction extends GetFirstPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { @@ -128,9 +128,9 @@ public class TestGetFirstPageCliAction e public class NullPTGetFirstPageCliAction extends MockGetFirstPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { @@ -142,9 +142,9 @@ public class TestGetFirstPageCliAction e public class NullPPGetFirstPageCliAction extends MockGetFirstPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetLastPageCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetLastPageCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetLastPageCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetLastPageCliAction.java Tue Sep 8 04:25:17 2015 @@ -27,7 +27,7 @@ import org.apache.oodt.cas.filemgr.struc import org.apache.oodt.cas.filemgr.structs.ProductPage; 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.system.FileManagerClient; //Google imports import com.google.common.collect.Lists; @@ -96,9 +96,9 @@ public class TestGetLastPageCliAction ex public class MockGetLastPageCliAction extends GetLastPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { @@ -128,9 +128,9 @@ public class TestGetLastPageCliAction ex public class NullPTGetLastPageCliAction extends MockGetLastPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { @@ -142,9 +142,9 @@ public class TestGetLastPageCliAction ex public class NullPPGetLastPageCliAction extends MockGetLastPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetNextPageCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetNextPageCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetNextPageCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetNextPageCliAction.java Tue Sep 8 04:25:17 2015 @@ -27,7 +27,7 @@ import org.apache.oodt.cas.filemgr.struc import org.apache.oodt.cas.filemgr.structs.ProductPage; 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.system.FileManagerClient; //Google imports import com.google.common.collect.Lists; @@ -113,7 +113,7 @@ public class TestGetNextPageCliAction ex public class MockGetNextPageCliAction extends GetNextPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { return new MockXmlRpcFileManagerClient(); } @@ -121,7 +121,7 @@ public class TestGetNextPageCliAction ex public class NullPTGetNextPageCliAction extends MockGetNextPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { return new MockXmlRpcFileManagerClient() { @Override @@ -134,7 +134,7 @@ public class TestGetNextPageCliAction ex public class NullPPGetNextPageCliAction extends MockGetNextPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { return new MockXmlRpcFileManagerClient() { @Override @@ -147,7 +147,7 @@ public class TestGetNextPageCliAction ex public class NullNPGetNextPageCliAction extends MockGetNextPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { return new MockXmlRpcFileManagerClient() { @Override @@ -160,7 +160,7 @@ public class TestGetNextPageCliAction ex } public static class MockXmlRpcFileManagerClient extends - XmlRpcFileManagerClient { + DummyFileManagerClient { public MockXmlRpcFileManagerClient() throws MalformedURLException, ConnectionException { super(new URL("http://localhost:9000"), false); Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetNumProductsCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetNumProductsCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetNumProductsCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetNumProductsCliAction.java Tue Sep 8 04:25:17 2015 @@ -28,7 +28,7 @@ import org.apache.oodt.cas.cli.action.Cm 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.system.FileManagerClient; /** * Test class for {@link GetNumProductsCliAction}. @@ -63,9 +63,9 @@ public class TestGetNumProductsCliAction public class MockGetNumProductsCliAction extends GetNumProductsCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { @@ -83,9 +83,9 @@ public class TestGetNumProductsCliAction public class NullPTGetNumProductsCliAction extends MockGetNumProductsCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetPrevPageCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetPrevPageCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetPrevPageCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetPrevPageCliAction.java Tue Sep 8 04:25:17 2015 @@ -27,7 +27,7 @@ import org.apache.oodt.cas.filemgr.struc import org.apache.oodt.cas.filemgr.structs.ProductPage; 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.system.FileManagerClient; //Google imports import com.google.common.collect.Lists; @@ -107,7 +107,7 @@ public class TestGetPrevPageCliAction ex public class MockGetPrevPageCliAction extends GetPrevPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { return new MockXmlRpcFileManagerClient(); } @@ -115,7 +115,7 @@ public class TestGetPrevPageCliAction ex public class NullPTGetPrevPageCliAction extends MockGetPrevPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { return new MockXmlRpcFileManagerClient() { @Override @@ -128,7 +128,7 @@ public class TestGetPrevPageCliAction ex public class NullPPGetPrevPageCliAction extends MockGetPrevPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { return new MockXmlRpcFileManagerClient() { @Override @@ -141,7 +141,7 @@ public class TestGetPrevPageCliAction ex public class NullNPGetPrevPageCliAction extends MockGetPrevPageCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { return new MockXmlRpcFileManagerClient() { @Override @@ -153,7 +153,7 @@ public class TestGetPrevPageCliAction ex } } - public static class MockXmlRpcFileManagerClient extends XmlRpcFileManagerClient { + public static class MockXmlRpcFileManagerClient extends DummyFileManagerClient { public MockXmlRpcFileManagerClient() throws MalformedURLException, ConnectionException { super(new URL("http://localhost:9000"), false); Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductByIdCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductByIdCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductByIdCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductByIdCliAction.java Tue Sep 8 04:25:17 2015 @@ -27,7 +27,7 @@ import org.apache.oodt.cas.filemgr.struc import org.apache.oodt.cas.filemgr.structs.ProductType; 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; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; //Google imports import com.google.common.collect.Lists; @@ -110,9 +110,9 @@ public class TestGetProductByIdCliAction } public class MockGetProductByIdCliAction extends GetProductByIdCliAction { - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { public Product getProductById(String productId) { Product p = new Product(); @@ -134,9 +134,9 @@ public class TestGetProductByIdCliAction } public class NullProductGetProductByIdCliAction extends MockGetProductByIdCliAction { - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { public Product getProductById(String productId) { return null; Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductByNameCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductByNameCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductByNameCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductByNameCliAction.java Tue Sep 8 04:25:17 2015 @@ -27,7 +27,7 @@ import org.apache.oodt.cas.filemgr.struc import org.apache.oodt.cas.filemgr.structs.ProductType; 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; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; //Google imports import com.google.common.collect.Lists; @@ -110,9 +110,9 @@ public class TestGetProductByNameCliActi } public class MockGetProductByNameCliAction extends GetProductByNameCliAction { - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { public Product getProductByName(String name) { Product p = new Product(); @@ -134,9 +134,9 @@ public class TestGetProductByNameCliActi } public class NullProductGetProductByNameCliAction extends MockGetProductByNameCliAction { - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { public Product getProductByName(String name) { return null; Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductPercentTransferredCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductPercentTransferredCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductPercentTransferredCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductPercentTransferredCliAction.java Tue Sep 8 04:25:17 2015 @@ -26,7 +26,7 @@ import org.apache.oodt.cas.cli.exception import org.apache.oodt.cas.filemgr.structs.Product; 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.system.FileManagerClient; //JUnit imports import junit.framework.TestCase; @@ -69,9 +69,9 @@ public class TestGetProductPercentTransf public class MockGetProductPercentTransferredCliAction extends GetProductPercentTransferredCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { @@ -89,9 +89,9 @@ public class TestGetProductPercentTransf public class NullPTGetProductPercentTransferredCliAction extends MockGetProductPercentTransferredCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductTypeByNameCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductTypeByNameCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductTypeByNameCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestGetProductTypeByNameCliAction.java Tue Sep 8 04:25:17 2015 @@ -25,7 +25,7 @@ import org.apache.oodt.cas.cli.action.Cm 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.system.FileManagerClient; import org.apache.oodt.cas.filemgr.versioning.BasicVersioner; //JUnit imports @@ -71,9 +71,9 @@ public class TestGetProductTypeByNameCli public class MockGetProductTypeByNameCliAction extends GetProductTypeByNameCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { @@ -91,9 +91,9 @@ public class TestGetProductTypeByNameCli public class NullPTGetProductTypeByNameCliAction extends MockGetProductTypeByNameCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String name) { Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestHasProductCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestHasProductCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestHasProductCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestHasProductCliAction.java Tue Sep 8 04:25:17 2015 @@ -24,7 +24,7 @@ import java.net.URL; import org.apache.oodt.cas.cli.action.CmdLineAction.ActionMessagePrinter; import org.apache.oodt.cas.cli.exception.CmdLineActionException; import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; //JUnit imports import junit.framework.TestCase; @@ -63,9 +63,9 @@ public class TestHasProductCliAction ext public class MockHasProductCliAction extends HasProductCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public boolean hasProduct(String productName) { Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestIngestProductCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestIngestProductCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestIngestProductCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestIngestProductCliAction.java Tue Sep 8 04:25:17 2015 @@ -39,7 +39,7 @@ import org.apache.oodt.cas.filemgr.struc import org.apache.oodt.cas.filemgr.structs.ProductType; 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; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; import org.apache.oodt.cas.metadata.Metadata; //Google imports @@ -303,9 +303,9 @@ public class TestIngestProductCliAction public class MockIngestProductCliAction extends IngestProductCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String typeName) { @@ -330,9 +330,9 @@ public class TestIngestProductCliAction public class NullPTIngestProductCliAction extends MockIngestProductCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public ProductType getProductTypeByName(String typeName) { Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestLuceneQueryCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestLuceneQueryCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestLuceneQueryCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestLuceneQueryCliAction.java Tue Sep 8 04:25:17 2015 @@ -32,7 +32,7 @@ import org.apache.oodt.cas.filemgr.struc import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException; import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery; import org.apache.oodt.cas.filemgr.structs.query.QueryResult; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; import org.apache.oodt.cas.metadata.Metadata; //Google imports @@ -194,9 +194,9 @@ public class TestLuceneQueryCliAction ex public class MockLuceneQueryCliAction extends LuceneQueryCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public List<QueryResult> complexQuery(ComplexQuery complexQuery) { Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestSqlQueryCliAction.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestSqlQueryCliAction.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestSqlQueryCliAction.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/cli/action/TestSqlQueryCliAction.java Tue Sep 8 04:25:17 2015 @@ -32,7 +32,7 @@ import org.apache.oodt.cas.filemgr.struc import org.apache.oodt.cas.filemgr.structs.query.conv.VersionConverter; import org.apache.oodt.cas.filemgr.structs.query.filter.FilterAlgor; import org.apache.oodt.cas.filemgr.structs.query.filter.TimeEvent; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; import org.apache.oodt.cas.metadata.Metadata; //Google imports @@ -144,9 +144,9 @@ public class TestSqlQueryCliAction exten public class MockSqlQueryCliAction extends SqlQueryCliAction { @Override - public XmlRpcFileManagerClient getClient() throws MalformedURLException, + public FileManagerClient getClient() throws MalformedURLException, ConnectionException { - return new XmlRpcFileManagerClient(new URL("http://localhost:9000"), + return new DummyFileManagerClient(new URL("http://localhost:9000"), false) { @Override public List<QueryResult> complexQuery(ComplexQuery complexQuery) { Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestCachedIngester.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestCachedIngester.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestCachedIngester.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestCachedIngester.java Tue Sep 8 04:25:17 2015 @@ -21,7 +21,6 @@ package org.apache.oodt.cas.filemgr.inge //JDK imports import java.io.File; import java.io.FileInputStream; -import java.net.MalformedURLException; import java.net.URL; import java.util.Date; import java.util.List; @@ -32,8 +31,9 @@ import java.util.Vector; import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys; import org.apache.oodt.cas.filemgr.structs.Product; import org.apache.oodt.cas.filemgr.structs.exceptions.CacheException; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManager; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; +import org.apache.oodt.cas.filemgr.system.FileManagerServer; +import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory; import org.apache.oodt.cas.metadata.Metadata; import org.apache.oodt.cas.metadata.SerializableMetadata; @@ -51,9 +51,9 @@ import junit.framework.TestCase; */ public class TestCachedIngester extends TestCase { - private static final int FM_PORT = 50010; + private static final int FM_PORT = 50011; - private XmlRpcFileManager fm; + private FileManagerServer fm; private String luceneCatLoc; @@ -126,7 +126,7 @@ public class TestCachedIngester extends // now make sure that the file is ingested try { - XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient( + FileManagerClient fmClient = RpcCommunicationFactory.createClient( new URL("http://localhost:" + FM_PORT)); Product p = fmClient.getProductByName("test.txt"); assertNotNull(p); @@ -282,7 +282,8 @@ public class TestCachedIngester extends System.setProperties(properties); try { - fm = new XmlRpcFileManager(FM_PORT); + fm = RpcCommunicationFactory.createServer(FM_PORT); + fm.startUp(); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestLocalCache.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestLocalCache.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestLocalCache.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestLocalCache.java Tue Sep 8 04:25:17 2015 @@ -30,10 +30,9 @@ import java.util.Vector; //OODT imports import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys; import org.apache.oodt.cas.filemgr.structs.Product; -import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManager; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; -import org.apache.oodt.cas.filemgr.util.XmlRpcStructFactory; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; +import org.apache.oodt.cas.filemgr.system.FileManagerServer; +import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory; import org.apache.oodt.cas.metadata.Metadata; import org.apache.oodt.cas.metadata.SerializableMetadata; import org.apache.oodt.commons.util.DateConvert; @@ -55,7 +54,7 @@ public class TestLocalCache extends Test private static final int FM_PORT = 50010; - private XmlRpcFileManager fm; + private FileManagerServer fm; private String luceneCatLoc; @@ -136,9 +135,8 @@ public class TestLocalCache extends Test Product prod = null; try { - prod = XmlRpcStructFactory.getProductFromXmlRpc(fm - .getProductByName("test.txt")); - } catch (CatalogException e) { + prod = RpcCommunicationFactory.createClient(new URL("http://localhost:" + FM_PORT)).getProductByName("test.txt"); + } catch (Exception e) { fail(e.getMessage()); } assertTrue(cache.contains(prod.getProductId())); @@ -203,7 +201,7 @@ public class TestLocalCache extends Test // now make sure that the file is ingested try { - XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient( + FileManagerClient fmClient = RpcCommunicationFactory.createClient( new URL("http://localhost:" + FM_PORT)); Product p = fmClient.getProductByName("test.txt"); assertNotNull(p); @@ -293,7 +291,8 @@ public class TestLocalCache extends Test System.setProperties(properties); try { - fm = new XmlRpcFileManager(FM_PORT); + fm = RpcCommunicationFactory.createServer(FM_PORT); + fm.startUp(); } catch (Exception e) { fail(e.getMessage()); } Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestRmiCache.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestRmiCache.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestRmiCache.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestRmiCache.java Tue Sep 8 04:25:17 2015 @@ -21,10 +21,9 @@ package org.apache.oodt.cas.filemgr.inge //OODT imports import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys; import org.apache.oodt.cas.filemgr.structs.Product; -import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManager; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; -import org.apache.oodt.cas.filemgr.util.XmlRpcStructFactory; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; +import org.apache.oodt.cas.filemgr.system.FileManagerServer; +import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory; import org.apache.oodt.cas.metadata.Metadata; import org.apache.oodt.cas.metadata.SerializableMetadata; import org.apache.oodt.commons.util.DateConvert; @@ -62,7 +61,7 @@ public class TestRmiCache extends TestCa private static final String rmiServerURN = "rmi://localhost:" + RMI_PORT + "/RmiDatabaseServer"; - private XmlRpcFileManager fm; + private FileManagerServer fm; private String luceneCatLoc; @@ -143,9 +142,8 @@ public class TestRmiCache extends TestCa Product prod = null; try { - prod = XmlRpcStructFactory.getProductFromXmlRpc(fm - .getProductByName("test.txt")); - } catch (CatalogException e) { + prod = RpcCommunicationFactory.createClient(new URL("http://localhost:" + FM_PORT)).getProductByName("test.txt"); + } catch (Exception e) { fail(e.getMessage()); } assertTrue(cache.contains(prod.getProductId())); @@ -219,7 +217,7 @@ public class TestRmiCache extends TestCa // now make sure that the file is ingested try { - XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient( + FileManagerClient fmClient = RpcCommunicationFactory.createClient( new URL("http://localhost:" + FM_PORT)); Product p = fmClient.getProductByName("test.txt"); assertNotNull(p); @@ -309,7 +307,8 @@ public class TestRmiCache extends TestCa System.setProperties(properties); try { - fm = new XmlRpcFileManager(FM_PORT); + fm = RpcCommunicationFactory.createServer(FM_PORT); + fm.startUp(); } catch (Exception e) { fail(e.getMessage()); } Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestStdIngester.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestStdIngester.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestStdIngester.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/ingest/TestStdIngester.java Tue Sep 8 04:25:17 2015 @@ -26,8 +26,9 @@ import java.util.Properties; //OODT imports import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys; import org.apache.oodt.cas.filemgr.structs.Product; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManager; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; +import org.apache.oodt.cas.filemgr.system.FileManagerServer; +import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory; import org.apache.oodt.cas.metadata.Metadata; import org.apache.oodt.cas.metadata.SerializableMetadata; @@ -46,7 +47,7 @@ public class TestStdIngester extends Tes private static final int FM_PORT = 50010; - private XmlRpcFileManager fm; + private FileManagerServer fm; private String luceneCatLoc; @@ -84,7 +85,7 @@ public class TestStdIngester extends Tes // now make sure that the file is ingested try { - XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient(new URL("http://localhost:"+FM_PORT)); + FileManagerClient fmClient = RpcCommunicationFactory.createClient(new URL("http://localhost:" + FM_PORT)); Product p = fmClient.getProductByName("test.txt"); assertNotNull(p); assertEquals(Product.STATUS_RECEIVED, p.getTransferStatus()); @@ -201,7 +202,9 @@ public class TestStdIngester extends Tes System.setProperties(properties); try { - fm = new XmlRpcFileManager(FM_PORT); + + fm = RpcCommunicationFactory.createServer(FM_PORT); + fm.startUp(); } catch (Exception e) { fail(e.getMessage()); } Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestTikaAutoDetectExtractor.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestTikaAutoDetectExtractor.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestTikaAutoDetectExtractor.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestTikaAutoDetectExtractor.java Tue Sep 8 04:25:17 2015 @@ -58,5 +58,6 @@ public class TestTikaAutoDetectExtractor assertTrue(outputMetadata.getAllKeys().size() > 0); assertTrue(outputMetadata.containsKey("X-Parsed-By")); assertFalse(outputMetadata.getMetadata("X-Parsed-By") == "org.apache.tika.parser.EmptyParser"); + assertTrue(true); } } Modified: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/structs/type/TestTypeHandler.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/structs/type/TestTypeHandler.java?rev=1701724&r1=1701723&r2=1701724&view=diff ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/structs/type/TestTypeHandler.java (original) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/structs/type/TestTypeHandler.java Tue Sep 8 04:25:17 2015 @@ -17,6 +17,9 @@ package org.apache.oodt.cas.filemgr.structs.type; +import org.apache.oodt.cas.filemgr.system.FileManagerClient; +import org.apache.oodt.cas.filemgr.system.FileManagerServer; +import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory; import org.apache.oodt.commons.database.DatabaseConnectionBuilder; import org.apache.oodt.commons.database.SqlScript; import org.apache.oodt.commons.pagination.PaginationUtils; @@ -33,14 +36,10 @@ import org.apache.oodt.cas.filemgr.struc import org.apache.oodt.cas.filemgr.structs.TermQueryCriteria; import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException; -import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManager; -import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient; import org.apache.oodt.cas.filemgr.validation.ValidationLayer; import org.apache.oodt.cas.metadata.Metadata; import java.io.File; import java.io.FileInputStream; -import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.sql.Connection; @@ -55,7 +54,7 @@ import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.sql.DataSource; -import org.apache.xmlrpc.XmlRpcException; + import junit.framework.TestCase; public class TestTypeHandler extends TestCase { @@ -64,7 +63,7 @@ public class TestTypeHandler extends Tes DataSource publicDataSource; - XmlRpcFileManager fmServer; + FileManagerServer fmServer; int FILEMGR_PORT = 9999; @@ -152,7 +151,8 @@ public class TestTypeHandler extends Tes met.addMetadata("ProductName", "test"); Product testProduct = getTestProduct(); - XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient(new URL("http://localhost:" + FILEMGR_PORT)); + FileManagerClient fmClient = RpcCommunicationFactory.createClient( + new URL("http://localhost:" + FILEMGR_PORT)); try { testProduct.setProductType(fmClient.getProductTypeByName("GenericFile")); testProduct.setProductId(fmClient.ingestProduct(testProduct, met, false)); @@ -184,7 +184,7 @@ public class TestTypeHandler extends Tes Product testProduct = getTestProduct(); ProductType genericFile = null; - XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient(new URL("http://localhost:" + FILEMGR_PORT)); + FileManagerClient fmClient = RpcCommunicationFactory.createClient(new URL("http://localhost:" + FILEMGR_PORT)); try { testProduct.setProductType(genericFile = fmClient.getProductTypeByName("GenericFile")); testProduct.setProductId(fmClient.ingestProduct(testProduct, met, false)); @@ -203,13 +203,14 @@ public class TestTypeHandler extends Tes assertEquals(products.get(0).getProductId(), testProduct.getProductId()); } - public void testGetCatalogAndOrigValuesAndGetCatalogQuery() throws ConnectionException, RepositoryManagerException, XmlRpcException, IOException { + public void testGetCatalogAndOrigValuesAndGetCatalogQuery() throws Exception { Metadata met = new Metadata(); met.addMetadata("DataVersion", "4.0"); met.addMetadata("ProductName", "test"); Product testProduct = getTestProduct(); - XmlRpcFileManagerClient fmClient = new XmlRpcFileManagerClient(new URL("http://localhost:" + FILEMGR_PORT)); + FileManagerClient fmClient = RpcCommunicationFactory.createClient( + new URL("http://localhost:" + FILEMGR_PORT)); ProductType genericFile = fmClient.getProductTypeByName("GenericFile"); assertEquals("04.00", (met = fmClient.getCatalogValues(met, genericFile)).getMetadata("DataVersion")); assertEquals("4.0", fmClient.getOrigValues(met, genericFile).getMetadata("DataVersion")); @@ -299,7 +300,8 @@ public class TestTypeHandler extends Tes private void startXmlRpcFileManager() { try { - fmServer = new XmlRpcFileManager(FILEMGR_PORT); + fmServer = RpcCommunicationFactory.createServer(FILEMGR_PORT); + fmServer.startUp(); fmServer.setCatalog(new HsqlDbFriendlyDataSourceCatalogFatory().createCatalog()); } catch (Exception e) { fail(e.getMessage()); Added: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/MockFileManagerClient.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/MockFileManagerClient.java?rev=1701724&view=auto ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/MockFileManagerClient.java (added) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/MockFileManagerClient.java Tue Sep 8 04:25:17 2015 @@ -0,0 +1,293 @@ +/* + * 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.system; + +//JDK imports +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +//OODT imports +import org.apache.oodt.cas.filemgr.cli.action.DummyFileManagerClient; +import org.apache.oodt.cas.filemgr.structs.FileTransferStatus; +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.exceptions.ConnectionException; +import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException; +import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery; +import org.apache.oodt.cas.filemgr.structs.query.QueryResult; +import org.apache.oodt.cas.metadata.Metadata; + +//Google imports +import com.google.common.collect.Lists; + +/** + * A Mock {@link FileManagerClient}. + * + * @author bfoster (Brian Foster) + * changed by Radu Manole + */ +public class MockFileManagerClient extends DummyFileManagerClient { + + private MethodCallDetails lastMethodCallDetails; + + public MockFileManagerClient() throws ConnectionException, + MalformedURLException { + super(new URL("http://localhost:9000"), false); + } + + public MethodCallDetails getLastMethodCallDetails() { + return lastMethodCallDetails; + } + + @Override + public String addProductType(ProductType productType) { + lastMethodCallDetails = new MethodCallDetails("addProductType", + Lists.newArrayList((Object) productType)); + return "ProductTypeId"; + } + + @Override + public Product getProductById(String productId) { + lastMethodCallDetails = new MethodCallDetails("getProductById", + Lists.newArrayList((Object) productId)); + Product p = new Product(); + p.setProductId(productId); + p.setProductName("TestProductName"); + p.setProductReferences(Lists.newArrayList( + new Reference("file:/orig/file", "file:/ds/file", 3))); + p.setProductStructure(Product.STRUCTURE_FLAT); + p.setTransferStatus(Product.STATUS_RECEIVED); + ProductType pt = new ProductType(); + pt.setName("TestProductType"); + p.setProductType(pt); + return p; + } + + @Override + public Product getProductByName(String productName) { + lastMethodCallDetails = new MethodCallDetails("getProductByName", + Lists.newArrayList((Object) productName)); + Product p = new Product(); + p.setProductId("TestProductId"); + p.setProductName(productName); + p.setProductReferences(Lists.newArrayList( + new Reference("file:/orig/file", "file:/ds/file", 3))); + p.setProductStructure(Product.STRUCTURE_FLAT); + p.setTransferStatus(Product.STATUS_RECEIVED); + ProductType pt = new ProductType(); + pt.setName("TestProductType"); + p.setProductType(pt); + return p; + } + + @Override + public List<Reference> getProductReferences(Product product) { + lastMethodCallDetails = new MethodCallDetails("getProductReferences", + Lists.newArrayList((Object) product)); + return Lists.newArrayList(); + } + + @Override + public boolean removeProduct(Product product) { + lastMethodCallDetails = new MethodCallDetails("removeProduct", + Lists.newArrayList((Object) product)); + return true; + } + + @Override + public boolean removeFile(String file) { + lastMethodCallDetails = new MethodCallDetails("removeFile", + Lists.newArrayList((Object) file)); + return true; + } + + @Override + public byte[] retrieveFile(String filePath, int offset, int numBytes) + throws DataTransferException { + lastMethodCallDetails = new MethodCallDetails("removeFile", + Lists.newArrayList((Object) filePath, offset, numBytes)); + return new byte[0]; + } + + @Override + public FileTransferStatus getCurrentFileTransfer() { + lastMethodCallDetails = new MethodCallDetails("getCurrentFileTransfer", + Lists.newArrayList()); + FileTransferStatus status = new FileTransferStatus(); + status.setBytesTransferred(10); + status.setFileRef(new Reference("file:/orig/file", "file:/ds/file", 4)); + Product p = new Product(); + p.setProductId("TestProductId"); + status.setParentProduct(p); + return status; + } + + @Override + public List<FileTransferStatus> getCurrentFileTransfers() { + lastMethodCallDetails = new MethodCallDetails("getCurrentFileTransfers", + Lists.newArrayList()); + FileTransferStatus status = new FileTransferStatus(); + status.setBytesTransferred(10); + status.setFileRef(new Reference("file:/orig/file", "file:/ds/file", 4)); + Product p = new Product(); + p.setProductId("TestProductId"); + status.setParentProduct(p); + return Lists.newArrayList(status); + } + + @Override + public double getRefPctTransferred(Reference ref) { + lastMethodCallDetails = new MethodCallDetails("getRefPctTransferred", + Lists.newArrayList((Object) ref)); + return 0.6; + } + + @Override + public ProductType getProductTypeByName(String productTypeName) { + lastMethodCallDetails = new MethodCallDetails("getProductTypeByName", + Lists.newArrayList((Object) productTypeName)); + ProductType pt = new ProductType(); + pt.setName(productTypeName); + return pt; + } + + @Override + public ProductPage getFirstPage(ProductType type) { + lastMethodCallDetails = new MethodCallDetails("getFirstPage", + Lists.newArrayList((Object) type)); + ProductPage pp = new ProductPage(); + pp.setNumOfHits(0); + pp.setPageProducts(new ArrayList<Product>()); + pp.setPageSize(10); + pp.setTotalPages(0); + pp.setPageNum(1); + return pp; + } + + @Override + public ProductPage getLastPage(ProductType type) { + lastMethodCallDetails = new MethodCallDetails("getLastPage", + Lists.newArrayList((Object) type)); + ProductPage pp = new ProductPage(); + pp.setNumOfHits(0); + pp.setPageProducts(new ArrayList<Product>()); + pp.setPageSize(10); + pp.setTotalPages(0); + pp.setPageNum(1); + return pp; + } + + @Override + public ProductPage getNextPage(ProductType type, ProductPage curPage) { + lastMethodCallDetails = new MethodCallDetails("getNextPage", + Lists.newArrayList((Object) type, curPage)); + ProductPage pp = new ProductPage(); + pp.setNumOfHits(0); + pp.setPageProducts(new ArrayList<Product>()); + pp.setPageSize(10); + pp.setTotalPages(0); + pp.setPageNum(curPage.getPageNum() + 1); + return pp; + } + + @Override + public ProductPage getPrevPage(ProductType type, ProductPage curPage) { + lastMethodCallDetails = new MethodCallDetails("getPrevPage", + Lists.newArrayList((Object) type, curPage)); + ProductPage pp = new ProductPage(); + pp.setNumOfHits(0); + pp.setPageProducts(new ArrayList<Product>()); + pp.setPageSize(10); + pp.setTotalPages(0); + pp.setPageNum(curPage.getPageNum() - 1); + return pp; + } + + @Override + public int getNumProducts(ProductType type) { + lastMethodCallDetails = new MethodCallDetails("getNumProducts", + Lists.newArrayList((Object) type)); + return 0; + } + + @Override + public double getProductPctTransferred(Product product) { + lastMethodCallDetails = new MethodCallDetails("getProductPctTransferred", + Lists.newArrayList((Object) product)); + return 0.6; + } + + @Override + public boolean hasProduct(String productName) { + lastMethodCallDetails = new MethodCallDetails("hasProduct", + Lists.newArrayList((Object) productName)); + return true; + } + + @Override + public String ingestProduct(Product p, Metadata m, boolean clientTransfer) { + lastMethodCallDetails = new MethodCallDetails("ingestProduct", + Lists.newArrayList((Object) p, m, clientTransfer)); + return "TestProductId"; + } + + @Override + public List<ProductType> getProductTypes() { + lastMethodCallDetails = new MethodCallDetails("getProductTypes", + Lists.newArrayList()); + ProductType pt = new ProductType(); + pt.setName("TestProductType"); + return Lists.newArrayList(pt); + } + + @Override + public List<QueryResult> complexQuery(ComplexQuery query) { + lastMethodCallDetails = new MethodCallDetails("complexQuery", + Lists.newArrayList((Object) query)); + return Lists.newArrayList(); + } + + @Override + public Metadata getMetadata(Product p) { + lastMethodCallDetails = new MethodCallDetails("getMetadata", + Lists.newArrayList((Object) p)); + return new Metadata(); + } + + 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; + } + } +} Added: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/TestRpcFileManager.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/TestRpcFileManager.java?rev=1701724&view=auto ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/TestRpcFileManager.java (added) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/TestRpcFileManager.java Tue Sep 8 04:25:17 2015 @@ -0,0 +1,300 @@ +/** + * 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.system; + +//JDK imports +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.util.Collections; +import java.util.Properties; +//OODT imports +import org.apache.oodt.cas.filemgr.ingest.StdIngester; +import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys; +import org.apache.oodt.cas.filemgr.metadata.ProductMetKeys; +import org.apache.oodt.cas.filemgr.structs.Product; +import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException; +import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory; +import org.apache.oodt.cas.metadata.Metadata; +import org.apache.oodt.cas.metadata.SerializableMetadata; + +//Junit imports +import junit.framework.TestCase; + +/** + * + * Test harness for the XmlRpcFileManagerServer. + * + * @since OODT-72 + * + */ +public class TestRpcFileManager extends TestCase { + + private static final int FM_PORT = 50002; + + private FileManagerServer fm; + + private String luceneCatLoc; + + private static final String transferServiceFacClass = "org.apache.oodt.cas." + + "filemgr.datatransfer.LocalDataTransferFactory"; + + private Properties initialProperties = new Properties( + System.getProperties()); + + /** + * @since OODT-72 + */ + public void testExpandProductMet() { + FileManagerClient fmc = null; + try { + fmc = RpcCommunicationFactory.createClient(new URL("http://localhost:" + FM_PORT)); + } catch (Exception e) { + fail(e.getMessage()); + } + + Metadata met = null; + try { + met = fmc.getMetadata(fmc.getProductByName("test.txt")); + } catch (CatalogException e) { + e.printStackTrace(); + fail(e.getMessage()); + } + + assertNotNull(met); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_ID)); + assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_ID)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_NAME)); + assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_NAME)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_STRUCTURE)); + assertEquals("Flat", met.getMetadata(ProductMetKeys.PRODUCT_STRUCTURE)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_TRANSFER_STATUS)); + assertEquals(Product.STATUS_RECEIVED, met + .getMetadata(ProductMetKeys.PRODUCT_TRANSFER_STATUS)); + + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_ORIG_REFS)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_DATASTORE_REFS)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_FILE_SIZES)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_MIME_TYPES)); + + assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_ORIG_REFS).size()); + assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_DATASTORE_REFS) + .size()); + assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_FILE_SIZES) + .size()); + assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_MIME_TYPES) + .size()); + + URL refUrl = this.getClass().getResource("/ingest/test.txt"); + + String origPath = null; + try { + origPath = new File(refUrl.getFile()).getCanonicalPath(); + } catch (IOException e) { + fail(e.getMessage()); + } + assertEquals(origPath, met.getMetadata(ProductMetKeys.PRODUCT_ORIG_REFS)); + assertEquals("/tmp/test.txt/test.txt", met + .getMetadata(ProductMetKeys.PRODUCT_DATASTORE_REFS)); + + assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_FILE_SIZES)); + assertEquals("text/plain", met + .getMetadata(ProductMetKeys.PRODUCT_MIME_TYPES)); + + try { + met = fmc.getReducedMetadata(fmc.getProductByName("test.txt"), + Collections.EMPTY_LIST); + } catch (CatalogException e) { + e.printStackTrace(); + fail(e.getMessage()); + } + + assertNotNull(met); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_ID)); + assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_ID)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_NAME)); + assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_NAME)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_STRUCTURE)); + assertEquals("Flat", met.getMetadata(ProductMetKeys.PRODUCT_STRUCTURE)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_TRANSFER_STATUS)); + assertEquals(Product.STATUS_RECEIVED, met + .getMetadata(ProductMetKeys.PRODUCT_TRANSFER_STATUS)); + + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_ORIG_REFS)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_DATASTORE_REFS)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_FILE_SIZES)); + assertTrue(met.containsKey(ProductMetKeys.PRODUCT_MIME_TYPES)); + + assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_ORIG_REFS).size()); + assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_DATASTORE_REFS) + .size()); + assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_FILE_SIZES) + .size()); + assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_MIME_TYPES) + .size()); + + origPath = null; + try { + origPath = new File(refUrl.getFile()).getCanonicalPath(); + } catch (IOException e) { + fail(e.getMessage()); + } + assertEquals(origPath, met.getMetadata(ProductMetKeys.PRODUCT_ORIG_REFS)); + assertEquals("/tmp/test.txt/test.txt", met + .getMetadata(ProductMetKeys.PRODUCT_DATASTORE_REFS)); + + assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_FILE_SIZES)); + assertEquals("text/plain", met + .getMetadata(ProductMetKeys.PRODUCT_MIME_TYPES)); + + } + + /* + * (non-Javadoc) + * + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + startXmlRpcFileManager(); + ingestTestFile(); + } + + /* + * (non-Javadoc) + * + * @see junit.framework.TestCase#tearDown() + */ + protected void tearDown() throws Exception { + fm.shutdown(); + fm = null; + + // blow away lucene cat + deleteAllFiles(luceneCatLoc); + + // blow away test file + deleteAllFiles("/tmp/test.txt"); + + // Reset the System properties to initial values. + System.setProperties(initialProperties); + } + + private void deleteAllFiles(String startDir) { + File startDirFile = new File(startDir); + File[] delFiles = startDirFile.listFiles(); + + if (delFiles != null && delFiles.length > 0) { + for (int i = 0; i < delFiles.length; i++) { + delFiles[i].delete(); + } + } + + startDirFile.delete(); + + } + + private void ingestTestFile() { + Metadata prodMet = null; + StdIngester ingester = new StdIngester(transferServiceFacClass); + + try { + URL ingestUrl = this.getClass().getResource("/ingest"); + URL refUrl = this.getClass().getResource("/ingest/test.txt"); + URL metUrl = this.getClass().getResource("/ingest/test.txt.met"); + + prodMet = new SerializableMetadata(new FileInputStream( + new File(metUrl.getFile()))); + // now add the right file location + prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(ingestUrl.getFile()).getCanonicalPath()); + prodMet.addMetadata(CoreMetKeys.FILENAME, "test.txt"); + prodMet.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile"); + ingester.ingest(new URL("http://localhost:" + FM_PORT), new File(refUrl.getFile()), prodMet); + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } + + private void startXmlRpcFileManager() { + + Properties properties = new Properties(System.getProperties()); + + // first make sure to load properties for the file manager + // and make sure to load logging properties as well + + // set the log levels + URL loggingPropertiesUrl = this.getClass().getResource( + "/test.logging.properties"); + properties.setProperty("java.util.logging.config.file", new File( + loggingPropertiesUrl.getFile()).getAbsolutePath()); + + // first load the example configuration + try { + URL filemgrPropertiesUrl = this.getClass().getResource( + "/filemgr.properties"); + properties.load( + new FileInputStream(new File(filemgrPropertiesUrl.getFile()))); + } catch (Exception e) { + fail(e.getMessage()); + } + + // override the catalog to use: we'll use lucene + try { + URL ingestUrl = this.getClass().getResource("/ingest"); + luceneCatLoc = new File(ingestUrl.getFile()).getCanonicalPath() + "/cat"; + } catch (Exception e) { + fail(e.getMessage()); + } + + properties.setProperty("filemgr.catalog.factory", + "org.apache.oodt.cas.filemgr.catalog.LuceneCatalogFactory"); + properties.setProperty("org.apache.oodt.cas.filemgr.catalog.lucene.idxPath", + luceneCatLoc); + + // now override the repo mgr policy + URL fmpolicyUrl = this.getClass().getResource("/ingest/fmpolicy"); + try { + properties.setProperty("org.apache.oodt.cas.filemgr.repositorymgr.dirs", + "file://" + new File(fmpolicyUrl.getFile()).getCanonicalPath()); + } catch (Exception e) { + fail(e.getMessage()); + } + + // now override the val layer ones + properties.setProperty("org.apache.oodt.cas.filemgr.validation.dirs", + "file://" + new File(fmpolicyUrl.getFile()).getAbsolutePath()); + + // set up mime repo path + URL mimeTypesUrl = this.getClass().getResource("/mime-types.xml"); + properties.setProperty("org.apache.oodt.cas.filemgr.mime.type.repository", + new File(mimeTypesUrl.getFile()).getAbsolutePath()); + + // override expand product met + properties.setProperty("org.apache.oodt.cas.filemgr.metadata.expandProduct", + "true"); + + System.setProperties(properties); + + try { + fm = RpcCommunicationFactory.createServer(FM_PORT); + fm.startUp(); + } catch (Exception e) { + fail(e.getMessage()); + } + } +} Added: oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/TestRpcFileManagerClient.java URL: http://svn.apache.org/viewvc/oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/TestRpcFileManagerClient.java?rev=1701724&view=auto ============================================================================== --- oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/TestRpcFileManagerClient.java (added) +++ oodt/branches/avro_rpc/filemgr/src/test/java/org/apache/oodt/cas/filemgr/system/TestRpcFileManagerClient.java Tue Sep 8 04:25:17 2015 @@ -0,0 +1,353 @@ +/* + * 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.system; + +//OODT imports +import org.apache.oodt.cas.filemgr.ingest.StdIngester; +import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys; +import org.apache.oodt.cas.filemgr.structs.Product; +import org.apache.oodt.cas.filemgr.structs.ProductType; +import org.apache.oodt.cas.filemgr.structs.query.ComplexQuery; +import org.apache.oodt.cas.filemgr.structs.query.QueryResult; +import org.apache.oodt.cas.filemgr.util.RpcCommunicationFactory; +import org.apache.oodt.cas.filemgr.util.SqlParser; +import org.apache.oodt.cas.metadata.Metadata; +import org.apache.oodt.cas.metadata.SerializableMetadata; + +//JDK imports +import java.io.File; +import java.io.FileInputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; +import java.util.Vector; + +//Junit imports +import junit.framework.TestCase; + +/** + * @author mattmann + * @version $Revision$ + * + * <p> + * Test suite for the {@link XmlRpcFileManagerClient} + * </p>. + */ +public class TestRpcFileManagerClient extends TestCase { + + private static int FM_PORT = 50001; + + private FileManagerServer fm; + + private String luceneCatLoc; + + private static final String transferServiceFacClass = "org.apache.oodt.cas." + + "filemgr.datatransfer.LocalDataTransferFactory"; + + private Properties initialProperties = new Properties( + System.getProperties()); + + public TestRpcFileManagerClient() { + } + + + /** + * @since OODT-161 + * + */ + public void testGetReducedMetadata() { + List arrayListElems = new ArrayList(); + List vectorElemList = new Vector(); + List linkedListElemList = new LinkedList(); + + arrayListElems.add(CoreMetKeys.FILENAME); + vectorElemList.add(CoreMetKeys.FILENAME); + linkedListElemList.add(CoreMetKeys.FILENAME); + + try { + FileManagerClient fmc = RpcCommunicationFactory.createClient(new URL( + "http://localhost:" + FM_PORT)); + Metadata reducedMet = null; + List pTypes = fmc.getProductTypes(); + assertNotNull(pTypes); + assertTrue(pTypes.size() > 0); + ProductType genericFileType = fmc.getProductTypeByName("GenericFile"); + + assertNotNull(genericFileType); + List products = fmc.getProductsByProductType(genericFileType); + assertNotNull(products); + assertTrue(products.size() > 0); + Product product = (Product) products.get(0); + assertNotNull(product); + + reducedMet = fmc.getReducedMetadata(product, arrayListElems); + assertNotNull(reducedMet); + assertTrue(reducedMet.containsKey(CoreMetKeys.FILENAME)); + assertEquals(reducedMet.getHashtable().keySet().size(), 1); + + reducedMet = fmc.getReducedMetadata(product, vectorElemList); + assertNotNull(reducedMet); + assertTrue(reducedMet.containsKey(CoreMetKeys.FILENAME)); + assertEquals(reducedMet.getHashtable().keySet().size(), 1); + + reducedMet = fmc.getReducedMetadata(product, linkedListElemList); + assertNotNull(reducedMet); + assertTrue(reducedMet.containsKey(CoreMetKeys.FILENAME)); + assertEquals(reducedMet.getHashtable().keySet().size(), 1); + + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + }finally { + fm.shutdown(); + + } + + } + + public void testIngest() throws Exception { + URL ingestUrl = this.getClass().getResource("/ingest"); + URL refUrl = this.getClass().getResource("/ingest/test.txt"); + + Metadata prodMet = new Metadata(); + prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File( + ingestUrl.getFile()).getCanonicalPath()); + prodMet.addMetadata(CoreMetKeys.FILENAME, "test.txt"); + prodMet.addMetadata(CoreMetKeys.PRODUCT_NAME, "TestFile"); + prodMet.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile"); + + StdIngester ingester = new StdIngester(transferServiceFacClass); + String productId = ingester.ingest( + new URL("http://localhost:" + FM_PORT), + new File(refUrl.getFile()), prodMet); + FileManagerClient fmc = RpcCommunicationFactory.createClient(new URL( + "http://localhost:" + FM_PORT)); + Metadata m = fmc.getMetadata(fmc.getProductById(productId)); + assertEquals(m.getMetadata("Filename"), "test.txt"); + deleteAllFiles("/tmp/test-type"); + } + + /** + * @since OODT-404 + * + */ + public void testMetadataPersistence() throws Exception { + URL ingestUrl = this.getClass().getResource("/ingest"); + URL refUrl = this.getClass().getResource("/ingest/test-file-3.txt"); + URL metUrl = this.getClass().getResource("/ingest/test-file-3.txt.met"); + + Metadata prodMet = null; + StdIngester ingester = new StdIngester(transferServiceFacClass); + prodMet = new SerializableMetadata(new FileInputStream( + metUrl.getFile())); + // now add the right file location + prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File( + ingestUrl.getFile()).getCanonicalPath()); + String productId = ingester.ingest( + new URL("http://localhost:" + FM_PORT), + new File(refUrl.getFile()), prodMet); + FileManagerClient fmc = RpcCommunicationFactory.createClient(new URL( + "http://localhost:" + FM_PORT)); + Metadata m = fmc.getMetadata(fmc.getProductById(productId)); + assertEquals(m.getAllMetadata("TestElement").size(), 4); + assertEquals(m.getMetadata("TestElement"), "fe"); + } + + + public void testComplexQuery() throws Exception { + URL ingestUrl = this.getClass().getResource("/ingest"); + URL refUrl1 = this.getClass().getResource("/ingest/test-file-1.txt"); + URL refUrl2 = this.getClass().getResource("/ingest/test-file-2.txt"); + + StdIngester ingester = new StdIngester(transferServiceFacClass); + + //ingest first file + Metadata prodMet = new Metadata(); + prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File( + ingestUrl.getFile()).getCanonicalPath()); + prodMet.addMetadata(CoreMetKeys.FILENAME, "test-file-1.txt"); + prodMet.addMetadata(CoreMetKeys.PRODUCT_NAME, "TestFile1"); + prodMet.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile"); + ingester.ingest(new URL("http://localhost:" + FM_PORT), new File( + refUrl1.getFile()), prodMet); + + //ingest second file + prodMet.replaceMetadata(CoreMetKeys.FILENAME, "test-file-2.txt"); + prodMet.replaceMetadata(CoreMetKeys.PRODUCT_NAME, "TestFile2"); + ingester.ingest(new URL("http://localhost:" + FM_PORT), new File( + refUrl2.getFile()), prodMet); + + //perform complex query + ComplexQuery complexQuery = new ComplexQuery(); + List<String> reducedMetadata = new Vector<String>(); + reducedMetadata.add(CoreMetKeys.FILENAME); + complexQuery.setReducedMetadata(reducedMetadata); + List<String> productTypeNames = new Vector<String>(); + productTypeNames.add("GenericFile"); + complexQuery.setReducedProductTypeNames(productTypeNames); + complexQuery.setSortByMetKey(CoreMetKeys.FILENAME); + complexQuery.setToStringResultFormat("$" + CoreMetKeys.FILENAME); + complexQuery.addCriterion(SqlParser.parseSqlWhereClause("Filename != 'test.txt'")); + FileManagerClient fmc = RpcCommunicationFactory.createClient(new URL( + "http://localhost:" + FM_PORT)); + List<QueryResult> queryResults = fmc.complexQuery(complexQuery); + assertEquals("[test-file-1.txt, test-file-2.txt]", queryResults.toString()); + } + + /* + * (non-Javadoc) + * + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + FM_PORT++; + startFileManager(); + ingestTestFile(); + } + + /* + * (non-Javadoc) + * + * @see junit.framework.TestCase#tearDown() + */ + protected void tearDown() throws Exception { + fm.shutdown(); + fm = null; + + // blow away lucene cat + deleteAllFiles(luceneCatLoc); + + // blow away test file + deleteAllFiles("/tmp/test.txt"); + + // Reset the System properties to initial values. + System.setProperties(initialProperties); + } + + private void deleteAllFiles(String startDir) { + File startDirFile = new File(startDir); + File[] delFiles = startDirFile.listFiles(); + + if (delFiles != null && delFiles.length > 0) { + for (int i = 0; i < delFiles.length; i++) { + delFiles[i].delete(); + } + } + + startDirFile.delete(); + + } + + private void ingestTestFile() { + Metadata prodMet = null; + StdIngester ingester = new StdIngester(transferServiceFacClass); + + try { + URL ingestUrl = this.getClass().getResource("/ingest"); + URL refUrl = this.getClass().getResource("/ingest/test.txt"); + URL metUrl = this.getClass().getResource("/ingest/test.txt.met"); + + prodMet = new SerializableMetadata(new FileInputStream( + new File(metUrl.getFile()))); + + // now add the right file location + prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File( + ingestUrl.getFile()).getCanonicalPath()); + prodMet.addMetadata(CoreMetKeys.FILENAME, "test.txt"); + prodMet.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile"); + ingester.ingest(new URL("http://localhost:" + FM_PORT), new File( + refUrl.getFile()), prodMet); + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } + + + private void startFileManager() { + + Properties properties = new Properties(System.getProperties()); + + // first make sure to load properties for the file manager + // and make sure to load logging properties as well + + // set the log levels + URL loggingPropertiesUrl = this.getClass().getResource( + "/test.logging.properties"); + properties.setProperty("java.util.logging.config.file", new File( + loggingPropertiesUrl.getFile()).getAbsolutePath()); + + // first load the example configuration + try { + URL filemgrPropertiesUrl = this.getClass().getResource( + "/filemgr.properties"); + properties.load( + new FileInputStream(new File(filemgrPropertiesUrl.getFile()))); + } catch (Exception e) { + fail(e.getMessage()); + } + + // override the catalog to use: we'll use lucene + try { + URL ingestUrl = this.getClass().getResource("/ingest"); + luceneCatLoc = new File(ingestUrl.getFile()).getCanonicalPath() + + "/cat"; + } catch (Exception e) { + fail(e.getMessage()); + } + + properties.setProperty("filemgr.catalog.factory", + "org.apache.oodt.cas.filemgr.catalog.LuceneCatalogFactory"); + properties.setProperty( + "org.apache.oodt.cas.filemgr.catalog.lucene.idxPath", + luceneCatLoc); + + // now override the repo mgr policy + URL fmpolicyUrl = this.getClass().getResource("/ingest/fmpolicy"); + try { + properties.setProperty( + "org.apache.oodt.cas.filemgr.repositorymgr.dirs", + "file://" + new File(fmpolicyUrl.getFile()).getCanonicalPath()); + } catch (Exception e) { + fail(e.getMessage()); + } + + // now override the val layer ones + properties.setProperty("org.apache.oodt.cas.filemgr.validation.dirs", + "file://" + new File(fmpolicyUrl.getFile()).getAbsolutePath()); + + // set up mime repo path + URL mimeTypesUrl = this.getClass().getResource("/mime-types.xml"); + properties.setProperty( + "org.apache.oodt.cas.filemgr.mime.type.repository", + new File(mimeTypesUrl.getFile()).getAbsolutePath()); + + System.setProperties(properties); + + try { + fm = RpcCommunicationFactory.createServer(FM_PORT); + fm.startUp(); + } catch (Exception e) { + fail(e.getMessage()); + } + } + +}
