You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by rl...@apache.org on 2013/07/25 18:50:00 UTC

svn commit: r1507062 [2/4] - in /oodt/trunk/webapp/fmprod: ./ src/main/java/org/apache/oodt/cas/product/data/ src/main/java/org/apache/oodt/cas/product/service/configurations/ src/main/java/org/apache/oodt/cas/product/service/exceptions/ src/main/java/...

Added: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ProductResourceTest.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ProductResourceTest.java?rev=1507062&view=auto
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ProductResourceTest.java (added)
+++ oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ProductResourceTest.java Thu Jul 25 16:49:58 2013
@@ -0,0 +1,194 @@
+/*
+ * 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.product.service.resources;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.transport.local.LocalConduit;
+import org.apache.cxf.transport.local.LocalTransportFactory;
+import org.easymock.EasyMock;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Implements tests for methods in the {@link ProductResource} class.
+ * @author rlaidlaw
+ * @version $Revision$
+ */
+public class ProductResourceTest extends ResourceTestBase
+{
+  // The web server.
+  private static Server server;
+
+
+
+  /**
+   * Starts a web server using the local transport protocol.  Uses a mock
+   * servlet context to inject context parameters into the JAX-RS resource.
+   */
+  @BeforeClass
+  public static void startWebServer()
+  {
+    // The JAX-RS resource to test.
+    ProductResource resource = new ProductResource();
+
+    // Create a web server for testing using local transport.
+    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+    sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
+    sf.setServiceBean(resource);
+    sf.setAddress("local://service");
+    server = sf.create();
+
+    // Use a mock servlet context for the resource.
+    // This is done after creating the server to avoid being overwritten by
+    // the server's default context.
+    ServletContext mockContext = EasyMock.createNiceMock(ServletContext.class);
+    EasyMock.expect(mockContext.getInitParameter("filemgr.url"))
+      .andReturn(getFileManagerUrl()).anyTimes();
+    EasyMock.expect(mockContext.getInitParameter("filemgr.working.dir"))
+      .andReturn(getWorkingDirLocation()).anyTimes();
+    EasyMock.replay(mockContext);
+    resource.setServletContext(mockContext);
+  }
+
+
+
+  /**
+   * Shuts down the web server.
+   */
+  @AfterClass
+  public static void stopWebServer()
+  {
+    // Stop the server.
+    server.stop();
+    server.destroy();
+  }
+
+
+
+  /**
+   * Tests the response for a request to the 'product' URL with query
+   * parameters specifying a 'file' response format.
+   */
+  @Test
+  public void testGetFileResponseFlatProduct()
+  {
+    String contentType = MediaType.TEXT_PLAIN;
+    WebClient client = WebClient.create("local://service");
+    WebClient.getConfig(client).getRequestContext()
+      .put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+    client.accept(contentType);
+    client.path("/product");
+    client.query("productID", getGenericFileFlatProductId());
+    client.query("refIndex", "0");
+    client.query("format", "file");
+
+    Response response = client.get();
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      contentType, response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.txt\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+  }
+
+
+
+  /**
+   * Tests the response for a request to the 'product' URL with query
+   * parameters specifying a 'file' response format.
+   */
+  @Test
+  public void testGetFileResponseHierarchicalProduct()
+  {
+    String contentType = MediaType.TEXT_PLAIN;
+    WebClient client = WebClient.create("local://service");
+    WebClient.getConfig(client).getRequestContext()
+      .put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+    client.accept(contentType);
+    client.path("/product");
+    client.query("productID", getGenericFileHierarchicalProductId());
+    client.query("refIndex", "1");
+    client.query("format", "file");
+
+    Response response = client.get();
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      contentType, response.getMetadata().get("Content-Type").get(0));
+  }
+
+
+
+  /**
+   * Tests the response for a request to the 'product' URL with query
+   * parameters specifying a 'zip' response format.
+   */
+  @Test
+  public void testGetZipResponse()
+  {
+    WebClient client = WebClient.create("local://service");
+    WebClient.getConfig(client).getRequestContext()
+      .put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+    client.accept("application/zip");
+    client.path("/product");
+    client.query("productID", getGenericFileFlatProductId());
+    client.query("format", "zip");
+
+    Response response = client.get();
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "application/zip", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.txt.zip\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+  }
+
+
+
+  /**
+   * Tests the response for a request to the 'data' URL with query
+   * parameters specifying a 'zip' response format.
+   */
+  @Test
+  public void testGetZipResponseDataUrl()
+  {
+    WebClient client = WebClient.create("local://service");
+    WebClient.getConfig(client).getRequestContext()
+      .put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+    client.accept("application/zip");
+    client.path("/data");
+    client.query("productID", getGenericFileFlatProductId());
+    client.query("format", "zip");
+
+    Response response = client.get();
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "application/zip", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.txt.zip\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+  }
+}

Propchange: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ProductResourceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ReferenceResourceTest.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ReferenceResourceTest.java?rev=1507062&view=auto
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ReferenceResourceTest.java (added)
+++ oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ReferenceResourceTest.java Thu Jul 25 16:49:58 2013
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership.  The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.oodt.cas.product.service.resources;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.core.Response;
+
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.transport.local.LocalConduit;
+import org.apache.cxf.transport.local.LocalTransportFactory;
+import org.easymock.EasyMock;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Implements tests for methods in the {@link ReferenceResource} class.
+ * @author rlaidlaw
+ * @version $Revision$
+ */
+public class ReferenceResourceTest extends ResourceTestBase
+{
+  // The web server.
+  private static Server server;
+
+
+
+  /**
+   * Starts a web server using the local transport protocol.  Uses a mock
+   * servlet context to inject context parameters into the JAX-RS resource.
+   */
+  @BeforeClass
+  public static void startWebServer()
+  {
+    ReferenceResource resource = new ReferenceResource();
+
+    // Create a web server for testing using local transport.
+    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+    sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
+    sf.setServiceBean(resource);
+    sf.setAddress("local://service");
+    server = sf.create();
+
+    // Use a mock servlet context for the resource.
+    // This is done after creating the server to avoid being overwritten by
+    // the server's default context.
+    ServletContext mockContext = EasyMock.createNiceMock(ServletContext.class);
+    EasyMock.expect(mockContext.getInitParameter("filemgr.url"))
+      .andReturn(getFileManagerUrl()).anyTimes();
+    EasyMock.expect(mockContext.getInitParameter("filemgr.working.dir"))
+      .andReturn(getWorkingDirLocation()).anyTimes();
+    EasyMock.replay(mockContext);
+    resource.setServletContext(mockContext);
+  }
+
+
+
+  /**
+   * Shuts down the web server.
+   */
+  @AfterClass
+  public static void stopWebServer()
+  {
+    // Stop the server.
+    server.stop();
+    server.destroy();
+  }
+
+
+
+  /**
+   * Tests the response for a request to the 'reference' URL with query
+   * parameters specifying a 'file' response format.
+   */
+  @Test
+  public void testGetFileResponseFlatProduct()
+  {
+    WebClient client = WebClient.create("local://service");
+    WebClient.getConfig(client).getRequestContext()
+      .put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+    client.accept("text/plain");
+    client.path("/reference");
+    client.query("productID", getGenericFileFlatProductId());
+    client.query("refIndex", "0");
+    client.query("format", "file");
+
+    Response response = client.get();
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "text/plain", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.txt\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+  }
+
+
+
+  /**
+   * Tests the response for a request to the 'reference' URL with query
+   * parameters specifying a 'file' response format.
+   */
+  @Test
+  public void testGetFileResponseHierarchicalProduct()
+  {
+    WebClient client = WebClient.create("local://service");
+    WebClient.getConfig(client).getRequestContext()
+      .put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+    client.accept("text/plain");
+    client.path("/reference");
+    client.query("productID", getGenericFileHierarchicalProductId());
+    client.query("refIndex", "1");
+    client.query("format", "file");
+
+    Response response = client.get();
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "text/plain", response.getMetadata().get("Content-Type").get(0));
+  }
+
+
+
+  /**
+   * Tests the default response for a request to the 'reference' URL where no
+   * query parameters are specified other than the product ID.
+   */
+  @Test
+  public void testGetDefaultResponseHierarchicalProduct()
+  {
+    WebClient client = WebClient.create("local://service");
+    WebClient.getConfig(client).getRequestContext()
+      .put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+    client.accept("text/plain");
+    client.path("/reference");
+    client.query("productID", getGenericFileHierarchicalProductId());
+
+    Response response = client.get();
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+      "Format not specified.",
+      response.getEntity().toString());
+  }
+
+
+
+  /**
+   * Tests the response for a request to the 'reference' URL with query
+   * parameters specifying a 'zip' response format.
+   */
+  @Test
+  public void testGetZipResponse()
+  {
+    WebClient client = WebClient.create("local://service");
+    WebClient.getConfig(client).getRequestContext()
+      .put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+    client.accept("application/zip");
+    client.path("/reference");
+    client.query("productID", getGenericFileFlatProductId());
+    client.query("refIndex", "0");
+    client.query("format", "zip");
+
+    Response response = client.get();
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "application/zip", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.txt.zip\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+  }
+}

Propchange: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ReferenceResourceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ResourceTestBase.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ResourceTestBase.java?rev=1507062&view=auto
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ResourceTestBase.java (added)
+++ oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ResourceTestBase.java Thu Jul 25 16:49:58 2013
@@ -0,0 +1,280 @@
+/*
+ * 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.product.service.resources;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.net.URL;
+import java.util.Hashtable;
+
+import org.apache.commons.io.FileUtils;
+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.system.XmlRpcFileManager;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.SerializableMetadata;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * Base setup for JUnit test classes for JAX-RS resources.  On startup, it sets
+ * up a local transport server with mock context and starts a file manager and
+ * ingests some test products.  On teardown it stops the file manager and
+ * deletes the ingested products.
+ * @author rlaidlaw
+ * @version $Revision$
+ */
+public class ResourceTestBase
+{
+  // The URL of the file manager.
+  private static final int FM_PORT = 50001;
+  private static final String FM_URL = "http://localhost:" + FM_PORT;
+
+  // The file manager.
+  private static XmlRpcFileManager fileManager;
+
+  // The location of the file manager's catalog.
+  private static String catalogLocation;
+  private static String repositoryLocation;
+  private static String workingDirLocation;
+  private static String logsLocation;
+
+  // The type of data transfer factory used by the ingester.
+  private static final String TRANSFER_FACTORY =
+    "org.apache.oodt.cas.filemgr.datatransfer.LocalDataTransferFactory";
+
+  // Strings used to store IDs of ingested products.
+  private static String genericFileFlatProductId;
+  private static String genericFileHierarchicalProductId;
+  private static String locationAwareFlatProductId;
+
+
+
+  /**
+   * Sets up a file manager and ingests test data into the file manager catalog.
+   * @throws Exception exceptions such as MalformedURLException, IOException
+   * and IngestException could occur when setting up the file manager and
+   * ingesting data.  Any such exception is considered an overall failure and
+   * is therefore propagated upwards for JUnit to handle
+   */
+  @BeforeClass
+  public static void startUpFileManager() throws Exception
+  {
+    startFileManager();
+    ingestTestData();
+  }
+
+
+
+  /**
+   * Shuts down the web server, stops the file manager and destroys the ingested
+   * test data.
+   * @throws Exception An IOException is thrown if the file manager catalog
+   * cannot be deleted.  This is considered an overall failure and so it is
+   * propagated upwards for JUnit to handle
+   */
+  @AfterClass
+  public static void shutDownFileManager() throws Exception
+  {
+    // Shut down the file manager.
+    fileManager.shutdown();
+
+    // Destroy the ingested test data.
+    FileUtils.deleteDirectory(new File(catalogLocation));
+
+    // Clean up the repository, workingDir and logs directories.
+    FileUtils.cleanDirectory(new File(repositoryLocation));
+    FileUtils.cleanDirectory(new File(workingDirLocation));
+    FileUtils.cleanDirectory(new File(logsLocation));
+  }
+
+
+
+  /**
+   * Sets up and starts a file manager.
+   * @throws FileNotFoundException, IOException, Exception
+   */
+  private static void startFileManager() throws Exception
+  {
+    catalogLocation = new File("./src/test/resources/filemgr/catalog")
+      .getCanonicalPath();
+    repositoryLocation = new File("./src/test/resources/filemgr/repository")
+      .getCanonicalPath();
+    workingDirLocation = new File("./src/test/resources/filemgr/workingDir")
+      .getCanonicalPath();
+    logsLocation = new File("./src/test/resources/filemgr/logs")
+      .getCanonicalPath();
+
+    // Set properties for the file manager.
+    FileInputStream fis = new FileInputStream(
+      "./src/test/resources/filemgr/etc/filemgr.properties");
+    System.getProperties().load(fis);
+    fis.close();
+
+    System.setProperty("java.util.logging.config.file",
+      new File("./src/test/resources/filemgr/etc/logging.properties")
+        .getCanonicalPath());
+    System.setProperty("org.apache.oodt.cas.filemgr.repositorymgr.dirs",
+      "file://" + new File("./src/test/resources/filemgr/policy/core")
+        .getCanonicalPath());
+    System.setProperty("org.apache.oodt.cas.filemgr.validation.dirs",
+      "file://" + new File("./src/test/resources/filemgr/policy/core")
+        .getCanonicalPath());
+    System.setProperty("org.apache.oodt.cas.filemgr.mime.type.repository",
+      new File("./src/test/resources/filemgr/etc/mime-types.xml")
+        .getCanonicalPath());
+    System.setProperty("filemgr.catalog.factory",
+      "org.apache.oodt.cas.filemgr.catalog.LuceneCatalogFactory");
+    System.setProperty("org.apache.oodt.cas.filemgr.catalog.lucene.idxPath",
+      catalogLocation);
+
+    // Start the file manager.
+    fileManager = new XmlRpcFileManager(FM_PORT);
+
+    // Overwrite the repository path for the GenericFile product type defined in
+    // product-types.xml with a dynamically constructed repository location.
+    Hashtable<String, Object> genericTypeHash = fileManager
+      .getProductTypeByName("GenericFile");
+    genericTypeHash.put("repositoryPath", "file://" + repositoryLocation);
+    fileManager.addProductType(genericTypeHash);
+
+
+    // Overwrite the repository path for the LocationAwareProduct product type
+    // defined in product-types.xml with a dynamically constructed repository location.
+    Hashtable<String, Object> locationAwareTypeHash = fileManager
+      .getProductTypeByName("LocationAwareProduct");
+    locationAwareTypeHash.put("repositoryPath", "file://" + repositoryLocation);
+    fileManager.addProductType(locationAwareTypeHash);
+  }
+
+
+
+  /**
+   * Ingests test data into the file manager repository.
+   * @throws FileNotFoundException, IOException, MalformedURLException,
+   * IngestException
+   */
+  private static void ingestTestData() throws Exception
+  {
+    StdIngester ingester = new StdIngester(TRANSFER_FACTORY);
+
+    // Ingest a flat product of type GenericFile.
+    FileInputStream ffis = new FileInputStream(
+      "./src/test/resources/filemgr/ingest/flat/test.txt.met");
+    Metadata fMeta = new SerializableMetadata(ffis);
+    ffis.close();
+    fMeta.addMetadata(CoreMetKeys.FILE_LOCATION,
+      new File("./src/test/resources/filemgr/ingest/flat").getCanonicalPath());
+    fMeta.addMetadata(CoreMetKeys.FILENAME, "test.txt");
+    fMeta.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile");
+    fMeta.addMetadata(CoreMetKeys.PRODUCT_STRUCTURE, Product.STRUCTURE_FLAT);
+
+    genericFileFlatProductId = ingester.ingest(new URL(FM_URL),
+      new File("./src/test/resources/filemgr/ingest/flat/test.txt"), fMeta);
+
+
+    // Ingest a hierarchical product of type GenericFile.
+    FileInputStream hfis = new FileInputStream(
+      "./src/test/resources/filemgr/ingest/hierarchical/test.met");
+    Metadata hMeta = new SerializableMetadata(hfis);
+    hfis.close();
+    hMeta.addMetadata(CoreMetKeys.FILE_LOCATION,
+      new File("./src/test/resources/filemgr/ingest/hierarchical")
+        .getCanonicalPath());
+    hMeta.addMetadata(CoreMetKeys.FILENAME, "test");
+    hMeta.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile");
+    hMeta.addMetadata(CoreMetKeys.PRODUCT_STRUCTURE,
+      Product.STRUCTURE_HIERARCHICAL);
+
+    genericFileHierarchicalProductId = ingester.ingest(new URL(FM_URL),
+      new File("./src/test/resources/filemgr/ingest/hierarchical/test"),
+        hMeta);
+
+
+    // Ingest a flat product of type LocationAwareProduct.
+    FileInputStream lfis = new FileInputStream(
+      "./src/test/resources/filemgr/ingest/flat/location.txt.met");
+    Metadata lMeta = new SerializableMetadata(lfis);
+    lfis.close();
+    lMeta.addMetadata(CoreMetKeys.FILE_LOCATION,
+      new File("./src/test/resources/filemgr/ingest/flat").getCanonicalPath());
+    lMeta.addMetadata(CoreMetKeys.FILENAME, "location.txt");
+    lMeta.addMetadata(CoreMetKeys.PRODUCT_TYPE, "LocationAwareProduct");
+    lMeta.addMetadata(CoreMetKeys.PRODUCT_STRUCTURE, Product.STRUCTURE_FLAT);
+
+    locationAwareFlatProductId = ingester.ingest(new URL(FM_URL),
+      new File("./src/test/resources/filemgr/ingest/flat/location.txt"), lMeta);
+  }
+
+
+
+  /**
+   * Gets the product ID for the flat product of type GenericFile.
+   * @return the genericFileFlatProductId
+   */
+  public static String getGenericFileFlatProductId()
+  {
+    return genericFileFlatProductId;
+  }
+
+
+
+  /**
+   * Gets the product ID for the hierarchical product of type GenericFile.
+   * @return the genericFileHierarchicalProductId
+   */
+  public static String getGenericFileHierarchicalProductId()
+  {
+    return genericFileHierarchicalProductId;
+  }
+
+
+
+  /**
+   * Gets the product ID for the flat product of type Location Aware Product.
+   * @return the locationAwareFlatProductId
+   */
+  public static String getLocationAwareFlatProductId()
+  {
+    return locationAwareFlatProductId;
+  }
+
+
+
+  /**
+   * Gets the file manager's URL.
+   * @return the file manager's URL.
+   */
+  public static String getFileManagerUrl()
+  {
+    return FM_URL;
+  }
+
+
+
+  /**
+   * Gets the file manager's working directory location.
+   * @return the file manager's working directory location
+   */
+  public static String getWorkingDirLocation()
+  {
+    return workingDirLocation;
+  }
+}

Propchange: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/resources/ResourceTestBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/FileResponderTest.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/FileResponderTest.java?rev=1507062&view=auto
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/FileResponderTest.java (added)
+++ oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/FileResponderTest.java Thu Jul 25 16:49:58 2013
@@ -0,0 +1,288 @@
+/*
+ * 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.product.service.responders;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.product.service.resources.DatasetResource;
+import org.apache.oodt.cas.product.service.resources.ProductResource;
+import org.apache.oodt.cas.product.service.resources.ReferenceResource;
+import org.apache.oodt.cas.product.service.resources.TransferResource;
+import org.junit.Test;
+
+/**
+ * Implements tests for methods in the {@link FileResponder} class.
+ * @author rlaidlaw
+ * @version $Revision$
+ */
+public class FileResponderTest
+{
+  /**
+   * Tests the {@link Response} returned by the createResponse method when a
+   * {@link ReferenceResource} is supplied as the argument, where the reference
+   * has both a file extension and a MIME type.
+   * @throws Exception (IOException) if getCanonicalPath fails.  This would be
+   * considered a test failure, so it is propagated upwards for JUnit to handle
+   */
+  @Test
+  public void testCreateResponseReferenceResourceWithMimeTypeAndExtension()
+    throws Exception
+  {
+    Reference reference = new Reference();
+    reference.setMimeType("text/plain");
+    reference.setDataStoreReference("file:"
+      + new File("./src/test/resources/filemgr/ingest/flat/test.txt")
+        .getCanonicalPath());
+
+    ReferenceResource resource = new ReferenceResource();
+    resource.setReference(reference);
+
+    Responder responder = new FileResponder();
+    Response response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "text/plain", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.txt\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+  }
+
+
+
+  /**
+   * Tests the {@link Response} returned by the createResponse method when a
+   * {@link ReferenceResource} is supplied as the argument, where the reference
+   * has a file extension but no MIME type.
+   * @throws Exception (IOException) if getCanonicalPath fails.  This would be
+   * considered a test failure, so it is propagated upwards for JUnit to handle
+   */
+  @Test
+  public void testCreateResponseReferenceResourceWithExtensionNoMimeType()
+    throws Exception
+  {
+    Reference reference = new Reference();
+    reference.setDataStoreReference("file:"
+      + new File("./src/test/resources/filemgr/ingest/flat/test.txt")
+        .getCanonicalPath());
+
+    ReferenceResource resource = new ReferenceResource();
+    resource.setReference(reference);
+
+    Responder responder = new FileResponder();
+    Response response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "text/plain", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.txt\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+  }
+
+
+
+  /**
+   * Tests the {@link Response} returned by the createResponse method when a
+   * {@link ReferenceResource} is supplied as the argument, where the reference
+   * has a MIME type but no file extension.
+   * @throws Exception (IOException) if getCanonicalPath fails.  This would be
+   * considered a test failure, so it is propagated upwards for JUnit to handle
+   */
+  @Test
+  public void testCreateResponseReferenceResourceWithMimeTypeNoExtension()
+    throws Exception
+  {
+    Reference reference = new Reference();
+    reference.setMimeType("text/plain");
+    reference.setDataStoreReference("file:"
+      + new File("./src/test/resources/filemgr/ingest/flat/test")
+        .getCanonicalPath());
+
+    ReferenceResource resource = new ReferenceResource();
+    resource.setReference(reference);
+
+    Responder responder = new FileResponder();
+    Response response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "text/plain", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+  }
+
+
+
+  /**
+   * Tests the {@link Response} returned by the createResponse method when a
+   * {@link ReferenceResource} is supplied as the argument, where the reference
+   * has neither a MIME type nor a file extension.
+   * @throws Exception (IOException) if getCanonicalPath fails.  This would be
+   * considered a test failure, so it is propagated upwards for JUnit to handle
+   */
+  @Test
+  public void testCreateResponseReferenceResourceNoMimeTypeOrExtension()
+    throws Exception
+  {
+    Reference reference = new Reference();
+    reference.setDataStoreReference("file:"
+      + new File("./src/test/resources/filemgr/ingest/flat/test")
+        .getCanonicalPath());
+
+    ReferenceResource resource = new ReferenceResource();
+    resource.setReference(reference);
+
+    Responder responder = new FileResponder();
+    Response response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "application/octet-stream",
+      response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+  }
+
+
+
+  /**
+   * Tests the status code and content of the {@link Response} returned by the
+   * createResponse method when a {@link ProductResource} is supplied as the
+   * argument.
+   * @throws Exception (IOException) if getCanonicalPath fails.  This would be
+   * considered a test failure, so it is propagated upwards for JUnit to handle
+   */
+  @Test
+  public void testCreateResponseProductResource() throws Exception
+  {
+    String topDirPath = "./src/test/resources/filemgr/ingest/hierarchical/test";
+    Reference reference1 = new Reference();
+    reference1.setMimeType("text/plain");
+    reference1.setDataStoreReference("file:" + new File(topDirPath +
+      "/file.txt").getCanonicalPath());
+
+    Reference reference2 = new Reference();
+    reference2.setMimeType("text/plain");
+    reference2.setDataStoreReference("file:" + new File(topDirPath +
+      "/subdirectory/sub-file.txt").getCanonicalPath());
+
+    List<Reference> references = new ArrayList<Reference>();
+    references.add(reference1);
+    references.add(reference2);
+
+    Product product = new Product();
+    product.setProductReferences(references);
+
+    ProductResource resource = new ProductResource();
+    resource.setProduct(product);
+    resource.setIndex(0);
+
+    Responder responder = new FileResponder();
+    Response response = responder.createResponse(resource);
+
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "text/plain", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"file.txt\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+
+    resource.setIndex(1);
+    response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "text/plain", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"sub-file.txt\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+  }
+
+
+
+  /**
+   * Tests the status code and message of the {@link Response} returned by the
+   * createResponse method when a {@link ProductResource} is supplied as the
+   * argument and the requested reference does not exist.
+   */
+  @Test
+  public void testCreateResponseProductResourceNoReferences()
+  {
+    List<Reference> references = new ArrayList<Reference>();
+    Product product = new Product();
+    product.setProductReferences(references);
+
+    ProductResource resource = new ProductResource();
+    resource.setProduct(product);
+    resource.setIndex(-1);
+
+    Responder responder = new FileResponder();
+    Response response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+      "Index out of range.", response.getEntity().toString());
+
+    resource.setIndex(0);
+    response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+      "Index out of range.", response.getEntity().toString());
+  }
+
+
+
+  /**
+   * Tests the status code and message of the {@link Response} returned by the
+   * createResponse method when a {@link DatasetResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseDatasetResource()
+  {
+    Responder responder = new FileResponder();
+    Response response = responder.createResponse(new DatasetResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+      "Format not valid for this resource type.",
+      response.getEntity().toString());
+  }
+
+
+
+  /**
+   * Tests the status code and message of the {@link Response} returned by the
+   * createResponse method when a {@link TransferResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseTransferResource()
+  {
+    Responder responder = new FileResponder();
+    Response response = responder.createResponse(new TransferResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+      "Format not valid for this resource type.",
+      response.getEntity().toString());
+  }
+}

Propchange: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/FileResponderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/NullResponderTest.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/NullResponderTest.java?rev=1507062&view=auto
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/NullResponderTest.java (added)
+++ oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/NullResponderTest.java Thu Jul 25 16:49:58 2013
@@ -0,0 +1,102 @@
+/*
+ * 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.product.service.responders;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.oodt.cas.product.service.resources.DatasetResource;
+import org.apache.oodt.cas.product.service.resources.ProductResource;
+import org.apache.oodt.cas.product.service.resources.ReferenceResource;
+import org.apache.oodt.cas.product.service.resources.TransferResource;
+import org.junit.Test;
+
+/**
+ * Implements tests for methods in the {@link NullResponder} class.
+ * @author rlaidlaw
+ * @version $Revision$
+ */
+public class NullResponderTest
+{
+  /**
+   * Tests the status code of the {@link Response} returned by the
+   * createResponse method when a {@link ReferenceResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseReferenceResource()
+  {
+    Responder responder = new NullResponder();
+    Response response = responder.createResponse(new ReferenceResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+        "Format not specified.", response.getEntity().toString());
+  }
+
+
+
+  /**
+   * Tests the status code of the {@link Response} returned by the
+   * createResponse method when a {@link ProductResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseProductResource()
+  {
+    Responder responder = new NullResponder();
+    Response response = responder.createResponse(new ProductResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+        "Format not specified.", response.getEntity().toString());
+  }
+
+
+
+  /**
+   * Tests the status code of the {@link Response} returned by the
+   * createResponse method when a {@link DatasetResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseDatasetResource()
+  {
+    Responder responder = new NullResponder();
+    Response response = responder.createResponse(new DatasetResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+        "Format not specified.", response.getEntity().toString());
+  }
+
+
+
+  /**
+   * Tests the status code of the {@link Response} returned by the
+   * createResponse method when a {@link TransferResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseTransferResource()
+  {
+    Responder responder = new NullResponder();
+    Response response = responder.createResponse(new TransferResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+        "Format not specified.", response.getEntity().toString());
+  }
+}

Propchange: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/NullResponderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ResponderFactoryTest.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ResponderFactoryTest.java?rev=1507062&view=auto
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ResponderFactoryTest.java (added)
+++ oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ResponderFactoryTest.java Thu Jul 25 16:49:58 2013
@@ -0,0 +1,82 @@
+/*
+ * 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.product.service.responders;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+/**
+ * Implements tests for methods in the {@link ResponderFactory} class.
+ * @author rlaidlaw
+ * @version $Revision$
+ */
+public class ResponderFactoryTest
+{
+  /**
+   * Tests that the createResponder method returns a {@link NullResponder} when
+   * null is supplied as the argument.
+   */
+  @Test
+  public void testCreateNullResponder()
+  {
+    assertEquals("ResponderFactory didn't return the correct type.",
+      NullResponder.class, ResponderFactory.createResponder(null).getClass());
+  }
+
+
+
+  /**
+   * Tests that the createResponder method returns an
+   * {@link UnrecognizedFormatResponder} when an unrecognized string is supplied
+   * as the argument.
+   */
+  @Test
+  public void testCreateUnrecognizedFormatResponder()
+  {
+    assertEquals("ResponderFactory didn't return the correct type.",
+      UnrecognizedFormatResponder.class,
+      ResponderFactory.createResponder("xyz").getClass());
+  }
+
+
+
+  /**
+   * Tests that the createResponder method returns a {@link FileResponder} when
+   * "file" is supplied as the argument.
+   */
+  @Test
+  public void testCreateFileResponder()
+  {
+    assertEquals("ResponderFactory didn't return the correct type.",
+      FileResponder.class, ResponderFactory.createResponder("file").getClass());
+  }
+
+
+
+  /**
+   * Tests that the createResponder method returns a {@link ZipResponder} when
+   * "zip" is supplied as the argument.
+   */
+  @Test
+  public void testCreateZipResponder()
+  {
+    assertEquals("ResponderFactory didn't return the correct type.",
+      ZipResponder.class, ResponderFactory.createResponder("zip").getClass());
+  }
+}

Propchange: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ResponderFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/UnrecognizedFormatResponderTest.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/UnrecognizedFormatResponderTest.java?rev=1507062&view=auto
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/UnrecognizedFormatResponderTest.java (added)
+++ oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/UnrecognizedFormatResponderTest.java Thu Jul 25 16:49:58 2013
@@ -0,0 +1,103 @@
+/*
+ * 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.product.service.responders;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.oodt.cas.product.service.resources.DatasetResource;
+import org.apache.oodt.cas.product.service.resources.ProductResource;
+import org.apache.oodt.cas.product.service.resources.ReferenceResource;
+import org.apache.oodt.cas.product.service.resources.TransferResource;
+import org.junit.Test;
+
+/**
+ * Implements tests for methods in the {@link UnrecognizedFormatResponder}
+ * class.
+ * @author rlaidlaw
+ * @version $Revision$
+ */
+public class UnrecognizedFormatResponderTest
+{
+  /**
+   * Tests the status code of the {@link Response} returned by the
+   * createResponse method when a {@link ReferenceResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseReferenceResource()
+  {
+    Responder responder = new UnrecognizedFormatResponder();
+    Response response = responder.createResponse(new ReferenceResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+      "Unrecognized format.", response.getEntity().toString());
+  }
+
+
+
+  /**
+   * Tests the status code of the {@link Response} returned by the
+   * createResponse method when a {@link ProductResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseProductResource()
+  {
+    Responder responder = new UnrecognizedFormatResponder();
+    Response response = responder.createResponse(new ProductResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+      "Unrecognized format.", response.getEntity().toString());
+  }
+
+
+
+  /**
+   * Tests the status code of the {@link Response} returned by the
+   * createResponse method when a {@link DatasetResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseDatasetResource()
+  {
+    Responder responder = new UnrecognizedFormatResponder();
+    Response response = responder.createResponse(new DatasetResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+      "Unrecognized format.", response.getEntity().toString());
+  }
+
+
+
+  /**
+   * Tests the status code of the {@link Response} returned by the
+   * createResponse method when a {@link TransferResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseTransferResource()
+  {
+    Responder responder = new UnrecognizedFormatResponder();
+    Response response = responder.createResponse(new TransferResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+      "Unrecognized format.", response.getEntity().toString());
+  }
+}

Propchange: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/UnrecognizedFormatResponderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java?rev=1507062&view=auto
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java (added)
+++ oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java Thu Jul 25 16:49:58 2013
@@ -0,0 +1,414 @@
+/*
+ * 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.product.service.responders;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import net.lingala.zip4j.core.ZipFile;
+import net.lingala.zip4j.model.FileHeader;
+
+import org.apache.commons.io.FileUtils;
+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.Reference;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.SerializableMetadata;
+import org.apache.oodt.cas.product.service.resources.DatasetResource;
+import org.apache.oodt.cas.product.service.resources.ProductResource;
+import org.apache.oodt.cas.product.service.resources.ReferenceResource;
+import org.apache.oodt.cas.product.service.resources.TransferResource;
+
+/**
+ * Implements tests for methods in the {@link ZipResponder} class.
+ * @author rlaidlaw
+ * @version $Revision$
+ */
+public class ZipResponderTest
+{
+  /**
+   * Tests the status code and message of the {@link Response} returned by the
+   * createResponse method when a {@link ReferenceResource} is supplied as the
+   * argument.
+   * @throws Exception (IOException) and this would be considered a test
+   * failure, so it's propagated upwards for JUnit to handle
+   */
+  @Test
+  public void testCreateResponseFlatReferenceResource() throws Exception
+  {
+    File workingDir = new File("./src/test/resources/filemgr/workingDir");
+
+    Reference reference = new Reference();
+    reference.setMimeType("text/plain");
+    reference.setDataStoreReference("file:"
+      + new File("./src/test/resources/filemgr/ingest/flat/test.txt")
+        .getCanonicalPath());
+
+    ReferenceResource resource = new ReferenceResource();
+    resource.setReference(reference);
+    resource.setWorkingDirPath(workingDir.getCanonicalPath());
+
+    Responder responder = new ZipResponder();
+    Response response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "application/zip", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.txt.zip\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+
+    // Clean the working directory.
+    FileUtils.cleanDirectory(workingDir);
+  }
+
+
+
+  /**
+   * Tests the status code and message of the {@link Response} returned by the
+   * createResponse method when a {@link ReferenceResource} is supplied as the
+   * argument.
+   * @throws Exception (IOException) and this would be considered a test
+   * failure, so it's propagated upwards for JUnit to handle
+   */
+  @Test
+  public void testCreateResponseHierarchicalReferenceResource() throws Exception
+  {
+    File workingDir = new File("./src/test/resources/filemgr/workingDir");
+
+    Reference reference = new Reference();
+    reference.setMimeType("text/plain");
+    reference.setDataStoreReference("file:"
+      + new File("./src/test/resources/filemgr/ingest/hierarchical/test")
+        .getCanonicalPath());
+
+    ReferenceResource resource = new ReferenceResource();
+    resource.setReference(reference);
+    resource.setWorkingDirPath(workingDir.getCanonicalPath());
+
+    Responder responder = new ZipResponder();
+    Response response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "application/zip", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.zip\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+
+    // Clean the working directory.
+    FileUtils.cleanDirectory(workingDir);
+  }
+
+
+
+  /**
+   * Tests the status code and message of the {@link Response} returned by the
+   * createResponse method when a {@link ProductResource} is supplied as the
+   * argument.
+   * @throws Exception (FileNotFoundException, IOException, ZipException) and
+   * any of these would be considered test failures, so they're propagated
+   * upwards for JUnit to handle
+   */
+  @Test
+  public void testCreateResponseFlatProductResource() throws Exception
+  {
+    File workingDir = new File("./src/test/resources/filemgr/workingDir");
+
+    // Create a reference.
+    File file = new File("./src/test/resources/filemgr/ingest/flat/test.txt");
+    Reference reference = new Reference();
+    reference.setMimeType("text/plain");
+    reference.setDataStoreReference("file:" + file.getCanonicalPath());
+    List<Reference> references = new ArrayList<Reference>();
+    references.add(reference);
+
+    // Create metadata for the product.
+    FileInputStream fis = new FileInputStream(
+      "./src/test/resources/filemgr/ingest/flat/test.txt.met");
+    Metadata metadata = new SerializableMetadata(fis);
+    fis.close();
+    metadata.addMetadata(CoreMetKeys.FILE_LOCATION,
+      new File("./src/test/resources/filemgr/ingest/flat").getCanonicalPath());
+    metadata.addMetadata(CoreMetKeys.FILENAME, "test.txt");
+    metadata.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile");
+    metadata.addMetadata(CoreMetKeys.PRODUCT_STRUCTURE, Product.STRUCTURE_FLAT);
+
+    // Create a product and add the reference.
+    Product product = new Product();
+    product.setProductName(file.getName());
+    product.setProductReferences(references);
+
+    // Add the product and metadata to the product resource.
+    ProductResource resource = new ProductResource();
+    resource.setProduct(product);
+    resource.setMetadata(metadata);
+    resource.setWorkingDirPath(workingDir.getCanonicalPath());
+
+    // Test the response.
+    Responder responder = new ZipResponder();
+    Response response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "application/zip", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.txt.zip\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+
+    // Test the returned zip file.
+    File returnFile = (File) response.getEntity();
+    ZipFile zipFile = new ZipFile(returnFile);
+    List<FileHeader> fileHeaders = zipFile.getFileHeaders();
+    assertEquals("Zip file does not contain the expected entries.",
+      fileHeaders.size(), 2);
+    assertEquals("Reference not found in zip file.", "test.txt",
+      fileHeaders.get(0).getFileName());
+    assertEquals("Metadata not found in zip file.", "test.txt.met",
+      fileHeaders.get(1).getFileName());
+
+    // Clean the working directory.
+    FileUtils.cleanDirectory(workingDir);
+  }
+
+
+
+  /**
+   * Tests the status code and message of the {@link Response} returned by the
+   * createResponse method when a {@link ProductResource} is supplied as the
+   * argument.
+   * @throws Exception (FileNotFoundException, IOException, ZipException) and
+   * any of these would be considered test failures, so they're propagated
+   * upwards for JUnit to handle
+   */
+  @Test
+  public void testCreateResponseHierarchicalProductResource() throws Exception
+  {
+    File workingDir = new File("./src/test/resources/filemgr/workingDir");
+
+    // Create references.
+    String topDirPath = "./src/test/resources/filemgr/ingest/hierarchical/test";
+    File topDir = new File(topDirPath);
+
+    Reference reference = new Reference();
+    reference.setMimeType("text/plain");
+    reference.setDataStoreReference("file:" + topDir.getCanonicalPath());
+    List<Reference> references = new ArrayList<Reference>();
+    references.add(reference);
+
+    // Create metadata for the product.
+    FileInputStream fis = new FileInputStream(
+      "./src/test/resources/filemgr/ingest/hierarchical/test.met");
+    Metadata metadata = new SerializableMetadata(fis);
+    fis.close();
+    metadata.addMetadata(CoreMetKeys.FILE_LOCATION,
+      new File("./src/test/resources/filemgr/ingest/hierarchical")
+        .getCanonicalPath());
+    metadata.addMetadata(CoreMetKeys.FILENAME, "test");
+    metadata.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile");
+    metadata.addMetadata(CoreMetKeys.PRODUCT_STRUCTURE,
+      Product.STRUCTURE_HIERARCHICAL);
+
+    // Create a product and add the references.
+    Product product = new Product();
+    product.setProductName(topDir.getName());
+    product.setProductReferences(references);
+
+    // Add the product and metadata to the product resource.
+    ProductResource resource = new ProductResource();
+    resource.setProduct(product);
+    resource.setMetadata(metadata);
+    resource.setWorkingDirPath(workingDir.getCanonicalPath());
+
+    // Test the response.
+    Responder responder = new ZipResponder();
+    Response response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "application/zip", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"test.zip\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+
+    // Test the returned zip file.
+    ZipFile zipFile = new ZipFile((File) response.getEntity());
+    List<FileHeader> fileHeaders = zipFile.getFileHeaders();
+    List<String> fileNames = new ArrayList<String>();
+    for (FileHeader header : fileHeaders)
+    {
+      fileNames.add(header.getFileName());
+    }
+    Collections.sort(fileNames);
+
+    assertEquals("Zip file does not contain the expected entries.",
+      fileHeaders.size(), 5);
+    assertEquals("Metadata not found in zip file.", "test.met",
+      fileNames.get(0));
+    assertEquals("Reference not found in zip file.", "test/",
+      fileNames.get(1));
+    assertEquals("Reference not found in zip file.", "test/file.txt",
+      fileNames.get(2));
+    assertEquals("Reference not found in zip file.", "test/subdirectory/",
+      fileNames.get(3));
+    assertEquals("Reference not found in zip file.",
+      "test/subdirectory/sub-file.txt", fileNames.get(4));
+
+    // Clean the working directory.
+    FileUtils.cleanDirectory(workingDir);
+  }
+
+
+
+  /**
+   * Tests the status code and message of the {@link Response} returned by the
+   * createResponse method when a {@link DatasetResource} is supplied as the
+   * argument.
+   * @throws Exception (FileNotFoundException, IOException, ZipException) and
+   * any of these would be considered test failures, so they're propagated
+   * upwards for JUnit to handle
+   */
+  @Test
+  public void testCreateResponseDatasetResource() throws Exception
+  {
+    File workingDir = new File("./src/test/resources/filemgr/workingDir");
+
+    // Create a product type.
+    ProductType productType = new ProductType();
+    productType.setName("GenericFile");
+    productType.setProductTypeId("urn:oodt:GenericFile");
+
+
+    // Create a hierarchical product.
+    String topDirPath = "./src/test/resources/filemgr/ingest/hierarchical/test";
+    File topDir = new File(topDirPath);
+
+    Reference hRef = new Reference();
+    hRef.setMimeType("text/plain");
+    hRef.setDataStoreReference("file:" + topDir.getCanonicalPath());
+    List<Reference> hRefs = new ArrayList<Reference>();
+    hRefs.add(hRef);
+
+    FileInputStream hfis = new FileInputStream(
+      "./src/test/resources/filemgr/ingest/hierarchical/test.met");
+    Metadata hMeta = new SerializableMetadata(hfis);
+    hfis.close();
+    hMeta.addMetadata(CoreMetKeys.FILE_LOCATION,
+      new File("./src/test/resources/filemgr/ingest/hierarchical")
+        .getCanonicalPath());
+    hMeta.addMetadata(CoreMetKeys.FILENAME, "test");
+    hMeta.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile");
+    hMeta.addMetadata(CoreMetKeys.PRODUCT_STRUCTURE,
+      Product.STRUCTURE_HIERARCHICAL);
+
+    Product hProd = new Product();
+    hProd.setProductName(topDir.getName());
+    hProd.setProductReferences(hRefs);
+
+
+    // Create a flat product.
+    File file = new File("./src/test/resources/filemgr/ingest/flat/test.txt");
+    Reference fRef = new Reference();
+    fRef.setMimeType("text/plain");
+    fRef.setDataStoreReference("file:" + file.getCanonicalPath());
+    List<Reference> fRefs = new ArrayList<Reference>();
+    fRefs.add(fRef);
+
+    FileInputStream ffis = new FileInputStream(
+      "./src/test/resources/filemgr/ingest/flat/test.txt.met");
+    Metadata fMeta = new SerializableMetadata(ffis);
+    ffis.close();
+    fMeta.addMetadata(CoreMetKeys.FILE_LOCATION,
+      new File("./src/test/resources/filemgr/ingest/flat").getCanonicalPath());
+    fMeta.addMetadata(CoreMetKeys.FILENAME, "test.txt");
+    fMeta.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile");
+    fMeta.addMetadata(CoreMetKeys.PRODUCT_STRUCTURE, Product.STRUCTURE_FLAT);
+
+    Product fProd = new Product();
+    fProd.setProductName(file.getName());
+    fProd.setProductReferences(fRefs);
+
+
+    // Create a dataset resource and add the products to it.
+    DatasetResource resource = new DatasetResource();
+    resource.setProductType(productType);
+    resource.setWorkingDirPath(workingDir.getCanonicalPath());
+    String productDirPath = resource.getWorkingDirPath() + "/"
+      + productType.getName();
+
+    List<ProductResource> resources = new ArrayList<ProductResource>();
+    resources.add(new ProductResource(hProd, hMeta, productDirPath));
+    resources.add(new ProductResource(fProd, fMeta, productDirPath));
+    resource.setProductResources(resources);
+
+    // Test the zip response for the dataset product.
+    Responder responder = new ZipResponder();
+    Response response = responder.createResponse(resource);
+    assertEquals("Incorrect response status.", 200, response.getStatus());
+    assertEquals("Incorrect content type in response.",
+      "application/zip", response.getMetadata().get("Content-Type").get(0));
+    assertEquals("Incorrect content disposition in response",
+      "attachment; filename=\"GenericFile.zip\"",
+      response.getMetadata().get("Content-Disposition").get(0));
+
+    // Test the returned zip file.
+    ZipFile zipFile = new ZipFile((File) response.getEntity());
+    List<FileHeader> fileHeaders = zipFile.getFileHeaders();
+    List<String> fileNames = new ArrayList<String>();
+    for (FileHeader header : fileHeaders)
+    {
+      fileNames.add(header.getFileName());
+    }
+    Collections.sort(fileNames);
+    assertEquals("Zip file does not contain the expected entries.",
+      fileHeaders.size(), 3);
+    assertEquals("Metadata not found in zip file.", "GenericFile.met",
+      fileNames.get(0));
+    assertEquals("Reference not found in zip file.", "test.txt.zip",
+      fileNames.get(1));
+    assertEquals("Reference not found in zip file.", "test.zip",
+      fileNames.get(2));
+
+    // Clean the working directory.
+    FileUtils.cleanDirectory(workingDir);
+  }
+
+
+
+  /**
+   * Tests the status code and message of the {@link Response} returned by the
+   * createResponse method when a {@link TransferResource} is supplied as the
+   * argument.
+   */
+  @Test
+  public void testCreateResponseTransferResource()
+  {
+    Responder responder = new ZipResponder();
+    Response response = responder.createResponse(new TransferResource());
+    assertEquals("Incorrect response status.", 400, response.getStatus());
+    assertEquals("Incorrect response message.",
+      "Format not valid for this resource type.",
+      response.getEntity().toString());
+  }
+}

Propchange: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: oodt/trunk/webapp/fmprod/src/test/resources/filemgr/etc/filemgr.properties
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/resources/filemgr/etc/filemgr.properties?rev=1507062&view=auto
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/resources/filemgr/etc/filemgr.properties (added)
+++ oodt/trunk/webapp/fmprod/src/test/resources/filemgr/etc/filemgr.properties Thu Jul 25 16:49:58 2013
@@ -0,0 +1,132 @@
+#  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.
+
+# Configuration properties for the File Manager
+
+# repository factory
+filemgr.repository.factory=org.apache.oodt.cas.filemgr.repository.XMLRepositoryManagerFactory
+
+# catalog factory
+filemgr.catalog.factory=org.apache.oodt.cas.filemgr.catalog.LuceneCatalogFactory
+
+# data transfer factory
+filemgr.datatransfer.factory=org.apache.oodt.cas.filemgr.datatransfer.LocalDataTransferFactory
+
+# validation layer factory
+filemgr.validationLayer.factory=org.apache.oodt.cas.filemgr.validation.XMLValidationLayerFactory
+
+# xml rpc client configuration
+org.apache.oodt.cas.filemgr.system.xmlrpc.connectionTimeout.minutes=20
+org.apache.oodt.cas.filemgr.system.xmlrpc.requestTimeout.minutes=60
+#org.apache.oodt.cas.filemgr.system.xmlrpc.connection.retries=0
+#org.apache.oodt.cas.filemgr.system.xmlrpc.connection.retry.interval.seconds=3
+
+# data source catalog configuration
+org.apache.oodt.cas.filemgr.catalog.datasource.jdbc.url=some_jdbc_url
+org.apache.oodt.cas.filemgr.catalog.datasource.jdbc.user=user
+org.apache.oodt.cas.filemgr.catalog.datasource.jdbc.pass=pass
+org.apache.oodt.cas.filemgr.catalog.datasource.jdbc.driver=driver.class.name
+org.apache.oodt.cas.filemgr.catalog.datasource.quoteFields=false
+org.apache.oodt.cas.filemgr.catalog.datasource.pageSize=20
+org.apache.oodt.cas.filemgr.catalog.datasource.cacheUpdateMinutes=5
+org.apache.oodt.cas.filemgr.catalog.datasource.orderedValues=false
+# set the following property to 'true' to allow dynamic metadata fields,
+# effectively bypassing the validation layer.
+# by default the property is false
+#org.apache.oodt.cas.filemgr.catalog.datasource.lenientFields=true
+# set the following property to true to enable the column "product_id"
+# in table "products" to be of type string
+#org.apache.oodt.cas.filemgr.catalog.datasource.productId.string=false
+
+
+# mapped data source catalog configuration
+org.apache.oodt.cas.filemgr.catalog.mappeddatasource.mapFile=/path/to/ops.catalog.typemap.properties
+
+# science data catalog configuration
+org.apache.oodt.cas.filemgr.catalog.science.jdbc.url=some_jdbc_url
+org.apache.oodt.cas.filemgr.catalog.science.jdbc.user=user
+org.apache.oodt.cas.filemgr.catalog.science.jdbc.pass=pass
+org.apache.oodt.cas.filemgr.catalog.science.jdbc.driver=driver.class.name
+
+# lucene catalog configuration
+org.apache.oodt.cas.filemgr.catalog.lucene.idxPath=/path/to/catalog
+org.apache.oodt.cas.filemgr.catalog.lucene.pageSize=20
+org.apache.oodt.cas.filemgr.catalog.lucene.commitLockTimeout.seconds=60
+org.apache.oodt.cas.filemgr.catalog.lucene.writeLockTimeout.seconds=60
+org.apache.oodt.cas.filemgr.catalog.lucene.mergeFactor=20
+
+# data source repository manager configuration
+org.apache.oodt.cas.filemgr.repositorymgr.datasource.jdbc.url=some_jdbc_url
+org.apache.oodt.cas.filemgr.repositorymgr.datasource.jdbc.user=user
+org.apache.oodt.cas.filemgr.repositorymgr.datasource.jdbc.pass=pass
+org.apache.oodt.cas.filemgr.repositorymgr.datasource.jdbc.driver=driver.class.name
+
+# science data repository manager configuration
+org.apache.oodt.cas.filemgr.repositorymgr.science.jdbc.url=some_jdbc_url
+org.apache.oodt.cas.filemgr.repositorymgr.science.jdbc.user=user
+org.apache.oodt.cas.filemgr.repositorymgr.science.jdbc.pass=pass
+org.apache.oodt.cas.filemgr.repositorymgr.science.jdbc.driver=driver.class.name
+
+# XML repository manager configuration
+org.apache.oodt.cas.filemgr.repositorymgr.dirs=file:///path/to/policy
+
+# XML validation layer configuration
+org.apache.oodt.cas.filemgr.validation.dirs=file:///path/to/policy
+
+# set the following property to 'true' to allow dynamic metadata fields,
+# effectively bypassing the validation layer.
+# by default the property is false
+#org.apache.oodt.cas.filemgr.catalog.lucene.lenientFields=true
+
+# data source validation layer configuration
+org.apache.oodt.cas.filemgr.validation.datasource.jdbc.url=some_jdbc_url
+org.apache.oodt.cas.filemgr.validation.datasource.jdbc.user=user
+org.apache.oodt.cas.filemgr.validation.datasource.jdbc.pass=pass
+org.apache.oodt.cas.filemgr.validation.datasource.jdbc.driver=driver.class.name
+org.apache.oodt.cas.filemgr.validation.datasource.quoteFields=false
+
+# science data validation layer configuration
+org.apache.oodt.cas.filemgr.validation.science.jdbc.url=some_jdbc_url
+org.apache.oodt.cas.filemgr.validation.science.jdbc.user=user
+org.apache.oodt.cas.filemgr.validation.science.jdbc.pass=pass
+org.apache.oodt.cas.filemgr.validation.science.jdbc.driver=driver.class.name
+
+# remote data transfer configuration
+org.apache.oodt.cas.filemgr.datatransfer.remote.chunkSize=1024
+
+# location of Mime-Type repository
+org.apache.oodt.cas.filemgr.mime.type.repository=/path/to/mime-types.xml
+
+# tells the file manager system layer to include product instance metadata
+# NOTE: here are the expected field mappings
+#
+#      product.getProductId() -> ProductId
+#      product.getProductName() -> ProductName
+#      product.getProductStructure() -> ProductStructure
+#      product.getTransferStatus() -> ProductTransferStatus
+#      product.getRootRef() -> ProductRootReference
+
+# for the references returned by product.getProductReferences() the following
+# metadata fields will be added (order will be maintained, such that data store
+# ref at index 0 will map to orig ref at index 0, etc.)
+#
+#      ProductDataStoreReferences (list of all data store references:
+#       note already translated into path, not URI)
+#      ProductOrigReferences (list of all orig references:
+#       note already translated into path, not URI)
+#      ProductMimeType (list of all references' mime-types)
+#      ProductFileSize (list of all references' file sizes)
+
+org.apache.oodt.cas.filemgr.metadata.expandProduct=false

Propchange: oodt/trunk/webapp/fmprod/src/test/resources/filemgr/etc/filemgr.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: oodt/trunk/webapp/fmprod/src/test/resources/filemgr/etc/logging.properties
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/resources/filemgr/etc/logging.properties?rev=1507062&view=auto
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/resources/filemgr/etc/logging.properties (added)
+++ oodt/trunk/webapp/fmprod/src/test/resources/filemgr/etc/logging.properties Thu Jul 25 16:49:58 2013
@@ -0,0 +1,73 @@
+#  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.
+
+# Specify the handlers to create in the root logger
+# (all loggers are children of the root logger)
+# The following creates two handlers
+handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
+
+# Set the default logging level for the root logger
+.level = ALL
+
+# Set the default logging level for new ConsoleHandler instances
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.FileHandler.level = ALL
+
+# Set the default formatter for new ConsoleHandler instances
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = ./src/test/resources/filemgr/logs/cas_filemgr%g.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 5
+java.util.logging.FileHandler.append = true
+java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
+
+# Set the default logging level for the subsystems
+
+# catalog subsystem
+org.apache.oodt.cas.filemgr.catalog.level = INFO
+
+# repository subsystem
+org.apache.oodt.cas.filemgr.repository.level = FINE
+
+# system subsystem
+org.apache.oodt.cas.filemgr.system.level = INFO
+
+# versioning subsystem
+org.apache.oodt.cas.filemgr.versioning.level = INFO
+
+# data transfer subsystem
+org.apache.oodt.cas.filemgr.datatransfer.level = FINE
+
+# util
+org.apache.oodt.cas.filemgr.util.level = INFO
+
+# validation
+org.apache.oodt.cas.filemgr.validation.level = INFO
+
+# control the underlying commons-httpclient transport layer for xmlrpc
+org.apache.commons.httpclient.level = INFO
+httpclient.wire.header.level = INFO
+httpclient.wire.level = INFO
+
+# spring framework logging
+org.springframework.beans.level = SEVERE
+org.springframework.core.level = SEVERE
+org.springframework.level = SEVERE
+org.springframework.beans.factory.level = SEVERE
+org.springframework.beans.factory.config.level = SEVERE
+org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.level = SEVERE
+

Propchange: oodt/trunk/webapp/fmprod/src/test/resources/filemgr/etc/logging.properties
------------------------------------------------------------------------------
    svn:eol-style = native