You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sr...@apache.org on 2011/01/18 01:41:31 UTC

svn commit: r1060148 - in /mahout/trunk/core/src: main/java/org/apache/mahout/driver/MahoutDriver.java test/java/org/apache/mahout/driver/ test/java/org/apache/mahout/driver/MahoutDriverTest.java

Author: srowen
Date: Tue Jan 18 00:41:30 2011
New Revision: 1060148

URL: http://svn.apache.org/viewvc?rev=1060148&view=rev
Log:
MAHOUT-584 part 2, fix from Frank

Added:
    mahout/trunk/core/src/test/java/org/apache/mahout/driver/
    mahout/trunk/core/src/test/java/org/apache/mahout/driver/MahoutDriverTest.java
Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java?rev=1060148&r1=1060147&r2=1060148&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java Tue Jan 18 00:41:30 2011
@@ -174,13 +174,12 @@ public final class MahoutDriver {
     programDriver.driver(argsList.toArray(new String[argsList.size()]));
     long finish = System.currentTimeMillis();
     if (log.isInfoEnabled()) {
-      log.info("Program took " + (finish - start) + " ms");
+      log.info("Program took {} ms", (finish - start));
     }
   }
 
   private static Properties loadProperties(String resource) throws IOException {
-    InputStream propsStream =
-        Thread.currentThread().getContextClassLoader().getResourceAsStream("driver.classes.props");
+    InputStream propsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
     if (propsStream != null) {
       try {
         Properties properties = new Properties();
@@ -215,9 +214,9 @@ public final class MahoutDriver {
       Class<?> clazz = Class.forName(classString);
       driver.addClass(shortName(descString), clazz, desc(descString));
     } catch (ClassNotFoundException e) {
-      log.warn("Unable to add class: " + classString, e);
+      log.warn("Unable to add class: {}", classString, e);
     } catch (Throwable t) {
-      log.warn("Unable to add class: " + classString, t);
+      log.warn("Unable to add class: {}", classString, t);
     }
   }
 

Added: mahout/trunk/core/src/test/java/org/apache/mahout/driver/MahoutDriverTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/driver/MahoutDriverTest.java?rev=1060148&view=auto
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/driver/MahoutDriverTest.java (added)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/driver/MahoutDriverTest.java Tue Jan 18 00:41:30 2011
@@ -0,0 +1,32 @@
+/**
+ * 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.mahout.driver;
+
+import org.junit.Test;
+
+/**
+ * Tests if MahoutDriver can be run directly through its main method.
+ */
+public final class MahoutDriverTest {
+
+  @Test
+  public void testMain() throws Throwable {
+    MahoutDriver.main(new String[] {"canopy", "help"});
+  }
+
+}