diff --git a/Kieker.WebGUI/bin/Kieker.WebGUI.bat b/Kieker.WebGUI/bin/Kieker.WebGUI.bat index 0867192faac2b401faf96f2e3de8d52e45ae84a5..06fac5ee413222ad5c0aded5947cd300df208c11 100644 --- a/Kieker.WebGUI/bin/Kieker.WebGUI.bat +++ b/Kieker.WebGUI/bin/Kieker.WebGUI.bat @@ -1,7 +1,7 @@ @echo off REM @author Nils Christian Ehmke -java -XX:PermSize=256M -XX:MaxPermSize=512M -Xms128M -Xmx256M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -jar ..\lib\jetty-runner-8.1.7.v20120910.jar --path /Kieker.WebGUI ..\target\Kieker.WebGUI-*.war +java -XX:PermSize=256M -XX:MaxPermSize=512M -Xms128M -Xmx256M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -jar ..\lib\jetty-runner-8.1.9.v20130131.jar --path /Kieker.WebGUI ..\target\Kieker.WebGUI-*.war @echo on diff --git a/Kieker.WebGUI/bin/Kieker.WebGUI.sh b/Kieker.WebGUI/bin/Kieker.WebGUI.sh index e13101c9ead8481494dbc1ee380e44465f2f59a6..1d69cd9c546c7a03303d837052043b2f0bf5ad40 100644 --- a/Kieker.WebGUI/bin/Kieker.WebGUI.sh +++ b/Kieker.WebGUI/bin/Kieker.WebGUI.sh @@ -2,4 +2,4 @@ # @author Nils Christian Ehmke -java -XX:PermSize=256M -XX:MaxPermSize=512M -Xms128M -Xmx256M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -jar ../lib/jetty-runner-8.1.7.v20120910.jar --path /Kieker.WebGUI ../target/Kieker.WebGUI-*.war \ No newline at end of file +java -XX:PermSize=256M -XX:MaxPermSize=512M -Xms128M -Xmx256M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -jar ../lib/jetty-runner-8.1.9.v20130131.jar --path /Kieker.WebGUI ../target/Kieker.WebGUI-*.war \ No newline at end of file diff --git a/Kieker.WebGUI/lib/commons-fileupload-1.2.1.LICENSE b/Kieker.WebGUI/lib/commons-fileupload-1.3.LICENSE similarity index 100% rename from Kieker.WebGUI/lib/commons-fileupload-1.2.1.LICENSE rename to Kieker.WebGUI/lib/commons-fileupload-1.3.LICENSE diff --git a/Kieker.WebGUI/lib/commons-io-1.4.LICENSE b/Kieker.WebGUI/lib/commons-io-2.4.LICENSE similarity index 100% rename from Kieker.WebGUI/lib/commons-io-1.4.LICENSE rename to Kieker.WebGUI/lib/commons-io-2.4.LICENSE diff --git a/Kieker.WebGUI/lib/jetty-runner-8.1.7.v20120910.LICENSE b/Kieker.WebGUI/lib/jetty-runner-8.1.9.v20130131.LICENSE similarity index 100% rename from Kieker.WebGUI/lib/jetty-runner-8.1.7.v20120910.LICENSE rename to Kieker.WebGUI/lib/jetty-runner-8.1.9.v20130131.LICENSE diff --git a/Kieker.WebGUI/lib/jetty-runner-8.1.7.v20120910.jar b/Kieker.WebGUI/lib/jetty-runner-8.1.9.v20130131.jar similarity index 78% rename from Kieker.WebGUI/lib/jetty-runner-8.1.7.v20120910.jar rename to Kieker.WebGUI/lib/jetty-runner-8.1.9.v20130131.jar index c5c47f72748779eaa0bef044eaf406c25242cada..6a62333b1b57ca8cacdcb15d9de1413074f70f76 100644 Binary files a/Kieker.WebGUI/lib/jetty-runner-8.1.7.v20120910.jar and b/Kieker.WebGUI/lib/jetty-runner-8.1.9.v20130131.jar differ diff --git a/Kieker.WebGUI/pom.xml b/Kieker.WebGUI/pom.xml index 99dd88d647be9357432d566e56654a6bc18494a2..1353c5f510c8914ae183c12b21b6f6e3e5852d7c 100644 --- a/Kieker.WebGUI/pom.xml +++ b/Kieker.WebGUI/pom.xml @@ -319,12 +319,12 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>1.4</version> + <version>2.4</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> - <version>1.2.1</version> + <version>1.3</version> </dependency> </dependencies> @@ -333,7 +333,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> - <version>2.9.1</version> + <version>2.10</version> <configuration> <configLocation>${project.basedir}/config/quality-config/cs-conf.xml</configLocation> </configuration> @@ -386,7 +386,7 @@ <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> - <version>8.1.7.v20120910</version> + <version>8.1.10.v20130312</version> <configuration> <webApp> <contextPath>/Kieker.WebGUI</contextPath> @@ -404,7 +404,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>2.5.1</version> + <version>3.0</version> <configuration> <source>1.6</source> <target>1.6</target> @@ -453,7 +453,7 @@ </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> - <version>2.3</version> + <version>2.4</version> <executions> <execution> <id>Sources-Archive</id> diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/EnvironmentLoaderListener.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/EnvironmentLoaderListener.java index 8a79784c4b538fb2088b7ce55973a31d3ec75c4a..c734bffa31c7623eff15d9aaacc45b505fe53eca 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/EnvironmentLoaderListener.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/EnvironmentLoaderListener.java @@ -24,7 +24,7 @@ import kieker.common.logging.LogFactory; /** * The {@link EnvironmentLoaderListener} is a context listener, which will be activated during the initialization of the application. It is used to initialize some - * environment properties for the webgui. + * environment properties for the WebGUI. * * @author Nils Christian Ehmke */ diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/User.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/User.java index 949af48b87dcf171224add06d097f8454b948afb..9fbb1210f7f6310b70c2cfdf978aedd701e26ddc 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/User.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/User.java @@ -114,6 +114,7 @@ public class User { * * @param id * The id to be recognized. + * * @return The corresponding role. */ public static Role fromID(final int id) { diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java index 8126c89cb6b97ee8c1f82f7535fd304523371433..15ea03a27efc60d30ba146674dd1c7e6aa1b8c66 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java @@ -67,7 +67,7 @@ public final class GraphLayoutServiceImpl implements IGraphLayoutService { * @see kieker.webgui.service.impl.IGraphLayoutService#layoutGraph(java.lang.String, java.lang.String) */ @Override - public String layoutGraph(final String nodes, final String edges) { + public String layoutGraph(final String nodes, final String edges) throws GraphLayoutException { try { final LayoutInformation layoutInformation = GraphLayoutServiceImpl.assembleLayoutInformation(nodes, edges); @@ -90,15 +90,10 @@ public final class GraphLayoutServiceImpl implements IGraphLayoutService { sb.append(bendPoints); return sb.toString(); - } catch (final GraphLayoutException e) { - e.printStackTrace(); - return "Error#Empty Graph!"; } catch (final NumberFormatException e) { - e.printStackTrace(); - return "Error#Invalid Graph Information String!"; + throw new GraphLayoutException("Invalid number format", e); } catch (final Exception e) { // NOCS - e.printStackTrace(); - return "Error#Unknown Error!"; + throw new GraphLayoutException("Unknown Error!", e); } } @@ -117,7 +112,7 @@ public final class GraphLayoutServiceImpl implements IGraphLayoutService { // if there is no semicolon, we got an empty graph if (firstSemicolon < 0) { - throw new GraphLayoutException(); + throw new GraphLayoutException("Empty Graph"); } final int scale = Integer.parseInt(nodesStr.substring(0, firstSemicolon)); diff --git a/Kieker.WebGUI/src/test/java/kieker/webgui/common/ExceptionsExtendingAbstractClassTest.java b/Kieker.WebGUI/src/test/java/kieker/webgui/common/ExceptionsExtendingAbstractClassTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b309585f5f1b5cb0d5220531620cca11a3845350 --- /dev/null +++ b/Kieker.WebGUI/src/test/java/kieker/webgui/common/ExceptionsExtendingAbstractClassTest.java @@ -0,0 +1,98 @@ +/*************************************************************************** + * Copyright 2012 Kieker Project (http://kieker-monitoring.net) + * + * 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 kieker.webgui.common; + +import java.io.File; +import java.io.IOException; +import java.util.Collection; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.filefilter.IOFileFilter; +import org.apache.commons.io.filefilter.RegexFileFilter; +import org.apache.commons.io.filefilter.TrueFileFilter; +import org.junit.Assert; +import org.junit.Test; + +import kieker.webgui.common.exception.AbstractKiekerWebGUIException; + +/** + * This JUnit test makes sure that all exceptions within the application extend the {@link AbstractKiekerWebGUIException}. The exceptions in question will be found + * using two criteria: They have to be in a package containing the subpackage {@code exception} and their classname has to contain {@code Exception}. + * + * @author Nils Christian Ehmke + */ +public class ExceptionsExtendingAbstractClassTest { + + private static final String UNNECESSARY_PREFIX = "src.main.java."; + private static final String UNNECESSARY_SUFFIX = ".java"; + private static final String PATTERN_EXCEPTION_PACKAGE = "\\exception\\"; + private static final String DIR_NAME_SOURCES = "src"; + private static final String PATTERN_EXCEPTION_SOURCE_FILES = ".*Exception\\.java"; + + /** + * Default constructor. <b>Do not use this constructor. This is just a test class and not to be used outside a JUnit test!</b> + */ + public ExceptionsExtendingAbstractClassTest() { + // No code necessary + } + + /** + * This is the main test running through the available JUnit tests and checking them. + * + * @throws IOException + * If something went wrong during the analysis. + * + * @throws ClassNotFoundException + * If one of the JUnit test classes could not be loaded. + */ + @Test + public void test() throws IOException, ClassNotFoundException { + final Collection<File> sourceFiles = ExceptionsExtendingAbstractClassTest.listJavaSourceFiles(); + for (final File sourceFile : sourceFiles) { + if (ExceptionsExtendingAbstractClassTest.isSourceFileInExceptionPackage(sourceFile)) { + final String className = ExceptionsExtendingAbstractClassTest.sourceFileToClassName(sourceFile); + final Class<?> clazz = this.getClass().getClassLoader().loadClass(className); + if (!ExceptionsExtendingAbstractClassTest.doesClassExtendAbstractKiekerWebGUIException(clazz)) { + Assert.fail("Class '" + className + "' doesn't extend AbstractKiekerWebGUIException"); + } + } + } + } + + private static Collection<File> listJavaSourceFiles() { + final IOFileFilter filter = new RegexFileFilter(ExceptionsExtendingAbstractClassTest.PATTERN_EXCEPTION_SOURCE_FILES); + return FileUtils.listFiles(new File(ExceptionsExtendingAbstractClassTest.DIR_NAME_SOURCES), filter, TrueFileFilter.INSTANCE); + } + + private static boolean isSourceFileInExceptionPackage(final File file) { + return file.getAbsolutePath().contains(ExceptionsExtendingAbstractClassTest.PATTERN_EXCEPTION_PACKAGE); + } + + private static boolean doesClassExtendAbstractKiekerWebGUIException(final Class<?> clazz) { + return AbstractKiekerWebGUIException.class.isAssignableFrom(clazz); + } + + private static String sourceFileToClassName(final File file) { + final String pathName = file.getPath(); + + String className = pathName.replace("\\", "."); + className = className.substring(ExceptionsExtendingAbstractClassTest.UNNECESSARY_PREFIX.length()); + className = className.substring(0, className.length() - ExceptionsExtendingAbstractClassTest.UNNECESSARY_SUFFIX.length()); + + return className; + } +} diff --git a/Kieker.WebGUI/src/test/java/kieker/webgui/service/impl/GraphLayoutServiceImplTest.java b/Kieker.WebGUI/src/test/java/kieker/webgui/service/impl/GraphLayoutServiceImplTest.java index 1ce9580ad902bf1d72113524d8d9913b49fc10e7..5a0b403898d66ed5b242bc23e668bd8e2cb836fc 100644 --- a/Kieker.WebGUI/src/test/java/kieker/webgui/service/impl/GraphLayoutServiceImplTest.java +++ b/Kieker.WebGUI/src/test/java/kieker/webgui/service/impl/GraphLayoutServiceImplTest.java @@ -17,8 +17,10 @@ package kieker.webgui.service.impl; import org.junit.Assert; +import org.junit.Test; import kieker.webgui.common.exception.GraphLayoutException; +import kieker.webgui.service.IGraphLayoutService; /** * Test class for {@link GraphLayoutServiceImpl}. @@ -35,17 +37,46 @@ public class GraphLayoutServiceImplTest { } /** - * A test of this test class. + * A test making sure that a invalid node/edge combination results in an exceptions. */ - // @Test - public void test() { - final GraphLayoutServiceImpl layouter = new GraphLayoutServiceImpl(); - + @Test + public void testLayoutFail() { + final IGraphLayoutService layouter = new GraphLayoutServiceImpl(); // We assert that something goes wrong here try { - layouter.layoutGraph(" ", " 1 "); + layouter.layoutGraph("", ""); Assert.fail(); } catch (final GraphLayoutException ex) { } } + + /** + * A test making sure that the layout works for nodes without edges. + */ + @Test + public void testLayoutWithoutEdges() { + final IGraphLayoutService layouter = new GraphLayoutServiceImpl(); + + final String inputNodes = "12;0 -1 204 72 f 0 0 0 0 1 78;1 -1 216 84 f 1 90 0 0 2 78"; + final String inputEdges = ""; + + // We assert that the layout method succeeds + final String layoutString = layouter.layoutGraph(inputNodes, inputEdges); + Assert.assertTrue(layoutString.startsWith("autoLayout#")); + } + + /** + * A test making sure that the layout works for nodes with edges. + */ + @Test + public void testLayoutWithEdges() { + final IGraphLayoutService layouter = new GraphLayoutServiceImpl(); + + final String inputNodes = "12;0 -1 204 72 f 0 0 0 0 1 78;1 -1 216 84 f 1 90 0 0 2 78"; + final String inputEdges = "0 0 1 0"; + + // We assert that the layout method succeeds + final String layoutString = layouter.layoutGraph(inputNodes, inputEdges); + Assert.assertTrue(layoutString.startsWith("autoLayout#")); + } }