Skip to content
Snippets Groups Projects
Commit 091e6f4b authored by Christian Wulf's avatar Christian Wulf
Browse files

Merge branch 'runner' into 'master'

Runner

fixes #247

See merge request !73
parents 2a2547e7 fded395a
No related branches found
No related tags found
No related merge requests found
/bin
/target
# Mac OS
.DS_Store
.AppleDouble
.LSOverride
# TeeTime specific
teetime.log
/src/main/resources/hugetext.txt
# Java
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
\ No newline at end of file
[submodule "src/site/markdown/wiki"]
path = src/site/markdown/wiki
url = gitlab@build.se.informatik.uni-kiel.de:chw/teetime.wiki.git
......@@ -25,16 +25,12 @@
<java.version>1.6</java.version>
<checkstyle.version>2.17</checkstyle.version>
<findbugs.version>3.0.2</findbugs.version>
<findbugs.version>3.0.3</findbugs.version>
<pmd.version>3.5</pmd.version>
<javadoc.version>2.10.3</javadoc.version>
</properties>
<distributionManagement>
<site>
<id>teetime.sf.net</id>
<url>scp://shell.sourceforge.net/home/project-web/teetime/htdocs</url>
</site>
<snapshotRepository>
<id>teetime-deployment</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
......@@ -115,7 +111,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
<version>1.7.13</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
......@@ -143,6 +139,24 @@
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
......
......@@ -9,6 +9,9 @@
<action dev="ntd" type="add" issue="163">
Introduced error codes.
</action>
<action dev="ntd" type="add" issue="247">
Configuration can now be executed from command line.
</action>
</release>
<release version="2.0" date="30.09.2015" description="Camellia Release">
<action dev="ntd" type="add" issue="93">
......
......@@ -15,12 +15,16 @@
*/
package teetime.framework;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import teetime.framework.signal.ValidatingSignal;
import teetime.framework.validation.AnalysisNotValidException;
......@@ -40,7 +44,7 @@ import teetime.framework.validation.AnalysisNotValidException;
*/
public final class Execution<T extends Configuration> {
// private static final Logger LOGGER = LoggerFactory.getLogger(Execution.class);
private static final Logger LOGGER = LoggerFactory.getLogger(Execution.class);
private final T configuration;
private final ConfigurationContext configurationContext;
......@@ -166,4 +170,30 @@ public final class Execution<T extends Configuration> {
return this.configuration;
}
private static List<Configuration> configLoader(final String... args) {
List<Configuration> instances = new ArrayList<Configuration>();
for (String each : args) {
try {
Class<?> clazz = Class.forName(each);
Object obj = clazz.newInstance();
if (obj instanceof Configuration) {
instances.add((Configuration) obj);
}
} catch (ClassNotFoundException e) {
LOGGER.error("Could not find class " + each);
} catch (InstantiationException e) {
LOGGER.error("Could not instantiate class " + each, e);
} catch (IllegalAccessException e) {
LOGGER.error("IllegalAccessException arised while instantiating class " + each, e);
}
}
return instances;
}
public static void main(final String... args) {
List<Configuration> instances = configLoader(args);
for (Configuration configuration : instances) {
new Execution<Configuration>(configuration).executeBlocking(); // NOPMD
}
}
}
......@@ -205,4 +205,11 @@ public class ExecutionTest {
new Execution<NameConfig>(configuration); // do not execute, but just initialize the execution
}
@Test
public void mainMethod() {
assertFalse(MainMethodTestConfig.executed);
Execution.main("teetime.framework.MainMethodTestConfig");
assertTrue(MainMethodTestConfig.executed);
}
}
/**
* Copyright (C) 2015 Christian Wulf, Nelson Tavares de Sousa (http://teetime-framework.github.io)
*
* 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 teetime.framework;
import teetime.stage.InitialElementProducer;
public class MainMethodTestConfig extends Configuration {
public static boolean executed = false;
public MainMethodTestConfig() {
connectPorts(new InitialElementProducer<Object>(new Object()).getOutputPort(), new StaticSetter().getInputPort());
}
private class StaticSetter extends AbstractConsumerStage<Object> {
@Override
protected void execute(final Object element) {
executed = true;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment