/*
   Licensed 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 com.zavakid.commons.test.casperjs;

import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;

/**
 * @author zavakid 2013-6-4 下午10:06:05
 * @since 1.0
 */
public class CasperJsExecutor {

    public static void execCasperJsFile(String casperJsPath, String testFilePath, String... args) {
        StringBuilder sb = new StringBuilder(casperJsPath).append(" ").append(testFilePath);
        for (String arg : args) {
            sb.append(" ").append(arg);
        }
        CommandLine cmd = CommandLine.parse(sb.toString());
        DefaultExecutor executor = new DefaultExecutor();
        try {
            int returnValue = executor.execute(cmd);
            if (returnValue != 0) {
                throw new CasperJsException("return value is " + returnValue);
            }
        } catch (Exception e) {
            throw new CasperJsException(e);
        }
    }

}

@@ -692,16 +692,86 @@
 r;%0A%0A/**%0A
+ * %E6%89%A7%E8%A1%8C casperjs%E3%80%82%E5%A6%82%E6%9E%9C casperjs %E8%84%9A%E6%9C%AC%E9%80%80%E5%87%BA%E6%97%B6%EF%BC%8C%E8%BF%94%E5%9B%9E%E7%A0%81%E4%B8%8D%E4%B8%BA0%EF%BC%8C%E5%B0%B1%E6%8A%9B%E5%87%BA %7B@link CasperJsException%7D%0A
  * @auth
@@ -826,16 +826,25 @@
 %0Apublic 
+abstract 
 class Ca

add comment ot CasperJsExecutor