oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattm...@apache.org
Subject svn commit: r1053799 [3/3] - in /oodt/trunk: ./ filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/ filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/ filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/ f...
Date Thu, 30 Dec 2010 05:45:25 GMT
Added: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestMimeTypeExtractor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestMimeTypeExtractor.java?rev=1053799&view=auto
==============================================================================
--- oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestMimeTypeExtractor.java
(added)
+++ oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestMimeTypeExtractor.java
Thu Dec 30 05:45:24 2010
@@ -0,0 +1,72 @@
+/**
+ * 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.metadata.extractors.examples;
+
+//Junit imports
+import java.io.File;
+
+//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.Reference;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
+
+//Junit imports
+import junit.framework.TestCase;
+
+/**
+ * 
+ * Test harness for the {@link MimeTypeExtractor}.
+ * 
+ * @since OODT-58
+ * 
+ */
+public class TestMimeTypeExtractor extends TestCase implements CoreMetKeys {
+
+  public TestMimeTypeExtractor() {
+    System.setProperty("org.apache.oodt.cas.filemgr.mime.type.repository",
+        new File("./src/main/resources/mime-types.xml").getAbsolutePath());
+  }
+
+  /**
+   * @since OODT-58
+   */
+  public void testExtract() {
+    MimeTypeExtractor extractor = new MimeTypeExtractor();
+    Product p = Product.getDefaultFlatProduct("test", "urn:oodt:GenericFile");
+    Reference r = new Reference("file:///tmp/test.he5",
+        "file:///archive/test.he5/test.he5", 0L);
+    p.getProductReferences().add(r);
+    Metadata met = new Metadata();
+    try {
+      met = extractor.doExtract(p, met);
+    } catch (MetExtractionException e) {
+      fail(e.getMessage());
+    }
+
+    assertNotNull(met);
+    assertNotNull(met.getAllMetadata(MIME_TYPE));
+    assertEquals(3, met.getAllMetadata(MIME_TYPE).size());
+    System.out.println(met.getAllMetadata(MIME_TYPE));
+    assertEquals("application/x-hdf", met.getAllMetadata(MIME_TYPE).get(0));
+    assertEquals("application", met.getAllMetadata(MIME_TYPE).get(1));
+    assertEquals("x-hdf", met.getAllMetadata(MIME_TYPE).get(2));
+  }
+
+}

Propchange: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/metadata/extractors/examples/TestMimeTypeExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java?rev=1053799&view=auto
==============================================================================
--- oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java (added)
+++ oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java Thu
Dec 30 05:45:24 2010
@@ -0,0 +1,52 @@
+/**
+ * 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.structs;
+
+//JDK imports
+import java.io.File;
+
+//Junit imports
+import junit.framework.TestCase;
+
+/**
+ * 
+ * Test harness for the Product {@link Reference} class. Currently 
+ * exercises that MIME type detection properly occurs.
+ * 
+ * @since OODT-58
+ * 
+ */
+public class TestReference extends TestCase {
+
+  public TestReference() {
+    System.setProperty("org.apache.oodt.cas.filemgr.mime.type.repository",
+        new File("./src/main/resources/mime-types.xml").getAbsolutePath());
+  }
+
+  /**
+   * @since OODT-58
+   */
+  public void testMimeType() {
+    Reference r = new Reference("file:///tmp/test.he5",
+        "file:///archive/test.he5/test.he5", 0L);
+    assertNotNull(r);
+    assertNotNull(r.getMimeType());
+    assertEquals("application/x-hdf", r.getMimeType().getName());
+  }
+
+}

Propchange: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message