![JAR search and dependency download from the Maven repository](/logo.png)
org.bitbucket.bradleysmithllc.etlunit.cli.ReportCmd Maven / Gradle / Ivy
package org.bitbucket.bradleysmithllc.etlunit.cli;
/*
* #%L
* etlunit-cli
* %%
* Copyright (C) 2010 - 2014 bradleysmithllc
* %%
* 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.
* #L%
*/
import org.clamshellcli.api.Command;
import org.clamshellcli.api.Configurator;
import org.clamshellcli.api.Context;
import org.clamshellcli.api.IOConsole;
import org.bitbucket.bradleysmithllc.etlunit.maven.ETLUnitMojo;
import java.awt.*;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class ReportCmd implements Command
{
private static final String NAMESPACE = "syscmd";
public static final String ACTION_NAME = "report";
public Object execute(Context ctx)
{
IOConsole console = ctx.getIoConsole();
String [] inputLine = (String []) ctx.getValue(Context.KEY_COMMAND_LINE_ARGS);
try
{
File basedir = new File(".");
File src = ETLUnitMojo.getReportsDirectoryRoot(basedir);
File reportIndex;
reportIndex = new File(src, "html-reports/index.html").getCanonicalFile();
if (reportIndex.exists())
{
if (Desktop.isDesktopSupported())
{
Desktop dt = Desktop.getDesktop();
dt.browse(reportIndex.toURI());
}
else
{
console.writeOutput("Your platform does not support the Java Desktop - don't ask me why.\n");
}
}
else
{
console.writeOutput("No report file found\n");
}
}
catch (Exception exc)
{
exc.printStackTrace();
console.writeOutput(exc.toString() + Configurator.VALUE_LINE_SEP);
}
return null;
}
public void plug(Context plug)
{
// no load-time setup needed
}
public Descriptor getDescriptor()
{
return new Descriptor()
{
public String getNamespace()
{
return NAMESPACE;
}
public String getName()
{
return ACTION_NAME;
}
public String getDescription()
{
return "Opens the test report for the last run";
}
public String getUsage()
{
return "report ";
}
public Map getArguments()
{
Map map = new HashMap();
return map;
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy