diff --git a/README.md b/README.md index 0d29601..c5a7f33 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,113 @@ -[Concordion](http://www.concordion.org) is an open source framework for Java that lets you turn a plain English description of a requirement into an automated test. +This [Concordion](http://www.concordion.org) extension provides the capability to embed screenshots in the output specification. -This project enables extra features in Concordion, such as embedding screenshots or logging information in the output. +The [demo project](http://github.com/nigelcharman//concordion-screenshot-extension-demo) demonstrates this extension using Concordion with Selenium WebDriver for end-to-end browser testing. -The [demo project](https://github.com/concordion/concordion-extensions-demo) demonstrates the extensions using Concordion with Selenium WebDriver for end-to-end browser testing. +# Introduction -See the [documentation](http://concordion.org/ExtensionsLibrary.html) for more details. \ No newline at end of file +This extension has two main uses - taking screenshots to help diagnose test failures, and/or explicitly adding screenshots to the output for documentation purposes. + +By default, the whole screen is captured using `java.awt.Robot`. As an alternative, custom screenshots can be captured using the `ScreenshotTaker` interface. For example, when using frameworks such as Selenium, a custom screenshot taker can capture an image of the entire web page, even if the test is running in the background. + +# Diagnosing test failures + +When running GUI tests it can be difficult to determine what was being shown on the GUI at the time of failure [1], especially if the tests are running in the background or on a Continuous Integration server. + +This extension adds screenshots to the Concordion output when failures or exceptions occur. It can also be configured to add screenshots on successful assertions. + +The screenshot is displayed when you hover over the relevant element. Clicking on the element will open the image in the current browser window. For example, hovering over the failure in this web test: + +![Screenshot Image](images/Screenshot.png) + +shows a screenshot of the browser page at the time the failure +occurred: + +![Screenshot Hover Image](images/ScreenshotHover.png) + +Clicking on the failure opens the image for further inspection: + +![Screenshot Clicked Image](images/ScreenshotClicked.png) + +(Note: this image has been truncated to save space) + +[1]: The screenshot is invoked by an assertion listener, so will occur a very short period after the failure actually occurred. In most cases, this small delay is of no consequence. + +# Explicitly adding screenshots to the output + +This extension also provides a Concordion `screenshot` command that explicitly add screenshots to the output HTML for documentation purposes. + +To use the command, add an attribute named `screenshot` using the namespace `"urn:concordion-extensions:2010"` to an element in your Concordion HTML. For example: + +```html + + +.... +
+... +``` + +By default, the screenshot is embedded in the output HTML. If +you'd rather have it linked, set the attribute value to +'linked', for example: + +```html +

See this screen

+``` + +**NOTE:** If you want to use the extension only as a +command, and not to capture screenshots of test failures, you will need +to use a custom configuration that sets `setScreenshotOnAssertionFailure` +and `setScreenshotOnThrowable` to `false`. See below for +custom configuration details. + +# Configuration + +## Default Configuration + +By default, this extension will take screenshots using `java.awt.Robot` +whenever an assertion fails, or an uncaught Throwable occurs in the test. + +To install the extension with default configuration, either annotate the fixture class with: + +```java +@Extensions(ScreenshotExtension.class) +``` + +or set the system property `concordion.extensions` to + +`org.concordion.ext.ScreenshotExtension` + +## Custom Configuration + +Alternatively, use the `@Extension` annotation on a ScreenshotExtension +instance field. This allows methods to be called to configure the extension. + +For example, the following code configures a custom `ScreenshotTaker`, +takes screenshots on assertion success as well as failure, and limits +the maximum width of the screenshot images on mouse hover to 400 pixels. + +```java + private ScreenshotTaker camera = new SeleniumScreenshotTaker(driver); + + @Extension + public ConcordionExtension extension = + new ScreenshotExtension().setScreenshotTaker(camera).setScreenshotOnAssertionSuccess(true) + .setMaxWidth(400); +``` + +# Screenshot Taker + +By default, the screenshot will be of the full visible screen. +This can be overridden using a custom `ScreenshotTaker`. + +For example, the `SeleniumScreenshotTaker` in the above examples ensures that only the browser window is captured, that the full browser page is captured and that it is captured regardless of whether the browser window is currently displayed. (The `SeleniumScreenshotTaker` is included in the [concordion-screenshot-extension-demo](http://github.com/nigelcharman/concordion-screenshot-extension-demo) project.) + +# Further info + +* [Specification](http://nigelcharman.github.io/concordion-screenshot-extension/spec/Screenshot.html) +* [API](http://nigelcharman.github.io/concordion-screenshot-extension/api/index.html) +* [Demo project](http://github.com/nigelcharman/concordion-screenshot-extension-demo) + +### Acknowledgements + +This extension was partly inspired by Mark Derricutt's [ScreenshotCommand](http://github.com/talios/concordion-examples/blob/master/src/test/java/com/talios/ScreenshotCommand.java), and by Adam Setch's [post](http://tech.groups.yahoo.com/group/concordion/message/618) to the Concordion list. \ No newline at end of file diff --git a/build.gradle b/build.gradle index 98eebf8..a4efa3c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,71 +1,31 @@ -buildscript { - repositories { - jcenter() - } - - dependencies { - classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7.1' - } -} - -apply plugin: 'java' -apply plugin: 'eclipse' -apply plugin: 'nexus' -apply from: 'http://tellurianring.com/projects/gradle-plugins/gradle-release/apply.groovy' +apply from: '../concordion-extension-build/extension-build.gradle' -repositories { - mavenCentral() -} +description = 'An extension to Concordion to embed screenshots in the output specification' -dependencies { - compile 'org.concordion:concordion:1.4.4' -} - -compileJava { - sourceCompatibility = 1.6 - targetCompatibility = 1.6 +ext { + developers = { + developer { + id 'nigel.charman.nz' + name 'Nigel Charman' + roles { role 'Project owner' } + url 'http://gplus.to/NigelCharman' + } + } + inceptionYear = '2011' } -test { - systemProperties['concordion.output.dir'] = "$reporting.baseDir/spec" +githubPages { + repoUri = 'git@github.com:nigelcharman/concordion-screenshot-extension.git' + pages { + from 'docs' + + from ('build/reports/spec/spec/concordion/ext/screenshot/') { + into 'spec' + } + + from ('build/docs/javadoc/') { + into 'api' + } + } } -createReleaseTag.dependsOn uploadArchives - -modifyPom { - project { - name 'concordion-extensions' - description 'This extensions library adds features to the Concordion acceptance test framework, such as embedding screenshots or logging information in the output' - url 'http://www.concordion.org/ExtensionsLibrary.html' - packaging 'jar' - inceptionYear '2010' - - scm { - url 'https://github.com/concordion/concordion-extensions.git' - connection 'scm:git:git://github.com/concordion/concordion-extensions.git' - developerConnection 'scm:git:git@github.com:concordion/concordion-extensions.git' - } - - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.html' - distribution 'repo' - } - } - - issueManagement{ - system 'GoogleCode' - url 'http://code.google.com/p/concordion-extensions/issues' - } - - developers { - developer { - id 'nigel.charman.nz' - name 'Nigel Charman' - roles { role 'Project owner' } - url 'http://gplus.to/NigelCharman' - } - } - } -} diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..1632563 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,12 @@ + + + Concordion Screenshot Extension + + +

Concordion Screenshot Extension

+ + + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 2bdc8d5..69c9e55 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1 @@ -group=org.concordion version=1.1.2-SNAPSHOT \ No newline at end of file diff --git a/images/Screenshot.png b/images/Screenshot.png new file mode 100644 index 0000000..eec66c8 Binary files /dev/null and b/images/Screenshot.png differ diff --git a/images/ScreenshotClicked.png b/images/ScreenshotClicked.png new file mode 100644 index 0000000..671f0c7 Binary files /dev/null and b/images/ScreenshotClicked.png differ diff --git a/images/ScreenshotHover.png b/images/ScreenshotHover.png new file mode 100644 index 0000000..8685ee8 Binary files /dev/null and b/images/ScreenshotHover.png differ diff --git a/src/main/java/org/concordion/ext/EmbedExtension.java b/src/main/java/org/concordion/ext/EmbedExtension.java deleted file mode 100644 index 85b92c2..0000000 --- a/src/main/java/org/concordion/ext/EmbedExtension.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext; - -import org.concordion.api.extension.ConcordionExtender; -import org.concordion.api.extension.ConcordionExtension; -import org.concordion.ext.embed.EmbedCommand; - -/** - * Embeds HTML snippets in the Concordion output. - */ -public class EmbedExtension implements ConcordionExtension { - - public static final String EXTENSION_NAMESPACE = "urn:concordion-extensions:2010"; - public static final String COMMAND_NAME = "embed"; - - private EmbedCommand embedCommand = new EmbedCommand(); - - @Override - public void addTo(ConcordionExtender concordionExtender) { - concordionExtender.withCommand(EXTENSION_NAMESPACE, COMMAND_NAME, embedCommand); - } - - /** - * Declares additional namespaces that are present in the HTML snippet. - * If the HTML fragment includes elements or attributes with a namespace prefix, the additional namespaces must be declared, both in the HTML specification, - * and using this method. - * - * @param prefix the prefix assigned to the namespace - * @param namespace the corresponding namespace - * @return this - */ - public EmbedExtension withNamespace(String prefix, String namespace) { - embedCommand.withNamespace(prefix, namespace); - return this; - } -} diff --git a/src/main/java/org/concordion/ext/Extensions.java b/src/main/java/org/concordion/ext/Extensions.java deleted file mode 100644 index 7f012ec..0000000 --- a/src/main/java/org/concordion/ext/Extensions.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext; - -import org.concordion.api.extension.ConcordionExtender; -import org.concordion.api.extension.ConcordionExtension; - -/** - * Installs all of the extensions in this package. - *

To add all of the extensions, set the system property concordion.extensions to org.concordion.ext.Extensions. - * This is typically set in the @BeforeClass of a base test case:

- *
- *   @BeforeClass
- *   public static void addExtensions() {
- *       System.setProperty("concordion.extensions", "org.concordion.ext.Extensions");
- *   }
- * 
- *

The extensions may also be installed individually and have a number of customisation options. See the Javadoc of each extension for details.

- * NOTE: only use this class if you want the default configuration of each extension. If you wish to customise, you will need to - * specify each extension, or extension factory, in a comma-separated list to the concordion.extensions property. - */ -public class Extensions implements ConcordionExtension { - - @Override - public void addTo(ConcordionExtender concordionExtender) { - new LoggingTooltipExtension().addTo(concordionExtender); - new ScreenshotExtension().addTo(concordionExtender); - new TimestampFormatterExtension().addTo(concordionExtender); - new EmbedExtension().addTo(concordionExtender); - } -} diff --git a/src/main/java/org/concordion/ext/LoggingTooltipExtension.java b/src/main/java/org/concordion/ext/LoggingTooltipExtension.java deleted file mode 100644 index d390622..0000000 --- a/src/main/java/org/concordion/ext/LoggingTooltipExtension.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.concordion.api.Resource; -import org.concordion.api.extension.ConcordionExtender; -import org.concordion.api.extension.ConcordionExtension; -import org.concordion.ext.logging.JavaUtilLogMessenger; -import org.concordion.ext.logging.LogMessageTooltipWriter; -import org.concordion.ext.logging.LogMessenger; -import org.concordion.ext.tooltip.TooltipRenderer; - -/** - * Annotates the Concordion HTML output with logging information captured using a LogMessenger. - *

- *

Default Configuration

- * By default, this extension will capture all output from the root logger and disable console logging of the root logger. - *

- *

Custom Configuration

- * The extension can be customised using the custom constructor. The logging can be restricted to named loggers, - * and by logging levels. The output of logging to the console can also be enabled. - *

- *

Custom Log Framework

- * An alternate LogMessenger implementation can be provided. The default uses java.util.logging. - *

- * - * Thanks to Trent Richardson for the CSS Tooltip implementation. - */ -public class LoggingTooltipExtension implements ConcordionExtension { - - private static final String TOOLTIP_CSS_SOURCE_PATH = "/org/concordion/ext/resource/tooltip.css"; - private static final Resource TOOLTIP_CSS_TARGET_RESOURCE = new Resource("/tooltip.css"); - - private static final Resource BUBBLE_FILLER_IMAGE_RESOURCE = new Resource("/image/bubble_filler.gif"); - private static final String BUBBLE_FILLER_RESOURCE_PATH = "/org/concordion/ext/resource/bubble_filler.gif"; - private static final Resource BUBBLE_IMAGE_RESOURCE = new Resource("/image/bubble.gif"); - private static final String BUBBLE_RESOURCE_PATH = "/org/concordion/ext/resource/bubble.gif"; - private static final Resource INFO_IMAGE_RESOURCE = new Resource("/image/info16.png"); - private static final String INFO_RESOURCE_PATH = "/org/concordion/ext/resource/i16.png"; - - private final LogMessenger logMessenger; - - /** - * Default constructor that logs output from all java.util.loggers, with a {@link Level} of INFO or higher, and disables the console output of the root logger. - */ - public LoggingTooltipExtension() { - this("", Level.INFO, false); - } - - /** - * Implementation that permits a custom LogMessenger. - * @param messenger - */ - public LoggingTooltipExtension(LogMessenger messenger) { - this.logMessenger = messenger; - } - - /** - * Custom constructor. - * Uses a JavaUtilLogMessenger logger. - * - * @param loggerNames a comma separated list of the names of loggers whose output is to be shown in the Concordion output. An empty string indicates the root logger. - * @param loggingLevel the logging {@link Level} for the handler that writes to the Concordion output. Log messages of this level and - * higher will be output. Note that the associated {@link Logger}s must also have an appropriate logging level set. - * @param displayRootConsoleLogging false to remove console output for the root logger, true to show the console output - */ - public LoggingTooltipExtension(String loggerNames, Level loggingLevel, boolean displayRootConsoleLogging) { - this.logMessenger = new JavaUtilLogMessenger(loggerNames, loggingLevel, displayRootConsoleLogging); - } - - @Override - public void addTo(ConcordionExtender concordionExtender) { - LogMessageTooltipWriter extension = new LogMessageTooltipWriter(new TooltipRenderer(INFO_IMAGE_RESOURCE), logMessenger); - - concordionExtender.withExecuteListener(extension).withAssertEqualsListener(extension).withAssertTrueListener(extension) - .withAssertFalseListener(extension).withVerifyRowsListener(extension).withThrowableListener(extension); - concordionExtender.withSpecificationProcessingListener(extension); - concordionExtender.withLinkedCSS(TOOLTIP_CSS_SOURCE_PATH, TOOLTIP_CSS_TARGET_RESOURCE); - concordionExtender.withResource(BUBBLE_RESOURCE_PATH, BUBBLE_IMAGE_RESOURCE); - concordionExtender.withResource(BUBBLE_FILLER_RESOURCE_PATH, BUBBLE_FILLER_IMAGE_RESOURCE); - concordionExtender.withResource(INFO_RESOURCE_PATH, INFO_IMAGE_RESOURCE); - } - -} diff --git a/src/main/java/org/concordion/ext/TimestampFormatterExtension.java b/src/main/java/org/concordion/ext/TimestampFormatterExtension.java deleted file mode 100644 index 7efde78..0000000 --- a/src/main/java/org/concordion/ext/TimestampFormatterExtension.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext; - - -import org.concordion.api.extension.ConcordionExtender; -import org.concordion.api.extension.ConcordionExtension; -import org.concordion.ext.footer.TimestampFormattingSpecificationListener; - -/** - * Formats the footer of the Concordion output HTML to show the time in hours, minutes and seconds rather than milliseconds. - *

- * To install the extension: - *

- *       System.setProperty("concordion.extensions", "org.concordion.ext.TimestampFormatterExtension");
- * 
- */ -public class TimestampFormatterExtension implements ConcordionExtension { - - @Override - public void addTo(ConcordionExtender concordionExtender) { - concordionExtender.withSpecificationProcessingListener(new TimestampFormattingSpecificationListener()); - } -} diff --git a/src/main/java/org/concordion/ext/TranslatorExtension.java b/src/main/java/org/concordion/ext/TranslatorExtension.java deleted file mode 100644 index 619a972..0000000 --- a/src/main/java/org/concordion/ext/TranslatorExtension.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext; - -import org.concordion.api.Element; -import org.concordion.api.extension.ConcordionExtender; -import org.concordion.api.extension.ConcordionExtension; -import org.concordion.api.listener.ThrowableCaughtEvent; -import org.concordion.api.listener.ThrowableCaughtListener; -import org.concordion.ext.translator.MessageTranslator; - -/** - * Translates exception messages in the Concordion output. - */ -public class TranslatorExtension implements ConcordionExtension, ThrowableCaughtListener { - - private final MessageTranslator messageTranslator; - - public TranslatorExtension(MessageTranslator messageTranslator) { - this.messageTranslator = messageTranslator; - } - - @Override - public void addTo(ConcordionExtender concordionExtender) { - concordionExtender.withThrowableListener(this); - } - - @Override - public void throwableCaught(ThrowableCaughtEvent event) { - Element[] childSpans = event.getElement().getDescendantElements("span"); - for (Element span : childSpans) { - if ("exceptionMessage".equals(span.getAttributeValue("class"))) { - Element replacementExceptionMessage = new Element("span") - .addAttribute("class", "exceptionMessage") - .appendText(translateMessage(span.getText())); - span.appendSister(replacementExceptionMessage); - event.getElement().removeChild(span); - } - } - } - - private String translateMessage(String originalMessage) { - return messageTranslator.translate(originalMessage); - } -} diff --git a/src/main/java/org/concordion/ext/embed/EmbedCommand.java b/src/main/java/org/concordion/ext/embed/EmbedCommand.java deleted file mode 100644 index fd140bf..0000000 --- a/src/main/java/org/concordion/ext/embed/EmbedCommand.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext.embed; - -import nu.xom.Document; - -import org.concordion.api.AbstractCommand; -import org.concordion.api.CommandCall; -import org.concordion.api.Element; -import org.concordion.api.Evaluator; -import org.concordion.api.ResultRecorder; -import org.concordion.internal.XMLParser; -import org.concordion.internal.command.EchoCommand; -import org.concordion.internal.util.Check; - -/** - * Embeds HTML fragments in the Concordion output. - *

- * When embedding HTML, it is often necessary to add namespace declarations to the Concordion output. - * The {@link #withNamespace(String, String)} method registers a namespace declaration. When the embed command - * is executed for an element, it creates a wrapper element that contains the namespace declarations around - * the element that the command is being executed for. - * - * @see {@link EmbedExtension) for details of configuring and using this command - * @see The {@link EchoCommand} is similar, except that it adds text rather than HTML to the output. - */ -public class EmbedCommand extends AbstractCommand { - - private String namespaceDeclaration = ""; - - /** - * Registers a namespace declaration. - * - * @param prefix the prefix to use for the namespace - * @param namespace the namespace - */ - public void withNamespace(String prefix, String namespace) { - String decl; - if (prefix == null || prefix.length() == 0) { - decl = String.format("xmlns='%s'", namespace); - } else { - decl = String.format("xmlns:%s='%s'", prefix, namespace); - } - if (namespaceDeclaration.length() > 0) { - namespaceDeclaration += " "; - } - namespaceDeclaration += decl; - } - - @Override - public void verify(CommandCall commandCall, Evaluator evaluator, ResultRecorder resultRecorder) { - Check.isFalse(commandCall.hasChildCommands(), "Nesting commands inside an 'embed' is not supported"); - - Object result = evaluator.evaluate(commandCall.getExpression()); - - Element element = commandCall.getElement(); - if (result != null) { - Element rootElement = getRootElement(result.toString()); - rootElement.moveChildrenTo(element); - } else { - Element child = new Element("em"); - child.appendText("null"); - element.appendChild(child); - } - } - - private Document getXOMDocument(String xml) { - try { - return XMLParser.parse(String.format("%s", namespaceDeclaration, xml)); - } catch (Exception e) { - throw new RuntimeException("Failed to parse resultant XML document", e); - } - } - - private Element getRootElement(String xml) { - return new Element(getXOMDocument(xml).getRootElement()); - } -} diff --git a/src/main/java/org/concordion/ext/footer/TimestampFormatter.java b/src/main/java/org/concordion/ext/footer/TimestampFormatter.java deleted file mode 100644 index 313e409..0000000 --- a/src/main/java/org/concordion/ext/footer/TimestampFormatter.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext.footer; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class TimestampFormatter { - - Pattern timePattern = Pattern.compile("in (\\d*) ms (.*)"); - - public String reformat(String string) { - Matcher matcher = timePattern.matcher(string); - if (matcher.matches()) { - Integer ms = Integer.valueOf(matcher.group(1)); - int seconds = ms/1000; - - StringBuilder sb = new StringBuilder(100); - sb.append("in "); - int minutes = 0; - if (seconds > 60) { - minutes = seconds/60; - seconds = seconds - (minutes * 60); - - if (minutes > 60) { - int hours = minutes / 60; - minutes = minutes - (hours * 60); - sb.append(hours).append("h "); - } - - sb.append(minutes).append("m "); - } - sb.append(seconds).append("s "); - sb.append(matcher.group(2)); - return sb.toString(); - } - - return string; - } - -} diff --git a/src/main/java/org/concordion/ext/footer/TimestampFormattingSpecificationListener.java b/src/main/java/org/concordion/ext/footer/TimestampFormattingSpecificationListener.java deleted file mode 100644 index 6e19728..0000000 --- a/src/main/java/org/concordion/ext/footer/TimestampFormattingSpecificationListener.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext.footer; - -import org.concordion.api.Element; -import org.concordion.api.listener.SpecificationProcessingEvent; -import org.concordion.api.listener.SpecificationProcessingListener; - -public class TimestampFormattingSpecificationListener implements SpecificationProcessingListener { - - TimestampFormatter formatter = new TimestampFormatter(); - - @Override - public void beforeProcessingSpecification(SpecificationProcessingEvent event) { - } - - @Override - public void afterProcessingSpecification(SpecificationProcessingEvent event) { - Element body = event.getRootElement().getFirstChildElement("body"); - - if (body != null) { - Element[] divs = body.getChildElements("div"); - for (Element div : divs) { - if ("footer".equals(div.getAttributeValue("class"))) { - Element timeDiv = div.getFirstChildElement("div"); - String timeTaken = timeDiv.getText(); - div.removeChild(timeDiv); - - Element newTimeDiv = new Element("div"); - newTimeDiv.addStyleClass("testTime"); - newTimeDiv.appendText(formatter.reformat(timeTaken)); - div.appendChild(newTimeDiv); - } - } - } - } -} diff --git a/src/main/java/org/concordion/ext/jul/formatter/TimeAndMessageFormatter.java b/src/main/java/org/concordion/ext/jul/formatter/TimeAndMessageFormatter.java deleted file mode 100644 index 85ca794..0000000 --- a/src/main/java/org/concordion/ext/jul/formatter/TimeAndMessageFormatter.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext.jul.formatter; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.logging.Formatter; -import java.util.logging.LogRecord; - -public class TimeAndMessageFormatter extends Formatter { - - private static final DateFormat format = new SimpleDateFormat("h:mm:ss.SSS"); - private static final String lineSep = System.getProperty("line.separator"); - - @Override - public String format(LogRecord record) { - StringBuilder output = new StringBuilder() - .append("[") - .append(format.format(new Date(record.getMillis()))) - .append("]: ") - .append(record.getMessage()).append(' ') - .append(lineSep); - return output.toString(); - } -} diff --git a/src/main/java/org/concordion/ext/logging/JavaUtilLogMessenger.java b/src/main/java/org/concordion/ext/logging/JavaUtilLogMessenger.java deleted file mode 100644 index ee56e99..0000000 --- a/src/main/java/org/concordion/ext/logging/JavaUtilLogMessenger.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext.logging; - -import java.io.ByteArrayOutputStream; -import java.util.logging.ConsoleHandler; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.logging.StreamHandler; - -import org.concordion.ext.jul.formatter.TimeAndMessageFormatter; - -/** - * Configures java.util..logging to store new messages for subsequent retrieval. - */ -public class JavaUtilLogMessenger implements LogMessenger { - private final ByteArrayOutputStream baos; - private final StreamHandler streamHandler; - - /** - * Configures a {@link Handler} to store new messages. The logging level - * @param loggerNames - * @param loggingLevel - * @param displayRootConsoleLogging - */ - public JavaUtilLogMessenger(String loggerNames, Level loggingLevel, boolean displayRootConsoleLogging) { - baos = new ByteArrayOutputStream(4096); - streamHandler = new StreamHandler(baos, new TimeAndMessageFormatter()); - streamHandler.setLevel(loggingLevel); - for (String loggerName : loggerNames.split(",")) { - Logger logger = Logger.getLogger(loggerName.trim()); - logger.addHandler(streamHandler); - } - if (!displayRootConsoleLogging) { - removeRootConsoleHandler(); - } - } - - private void removeRootConsoleHandler() { - Logger logger = Logger.getLogger(""); - Handler[] handlers = logger.getHandlers(); - for (Handler handler : handlers) { - if (handler instanceof ConsoleHandler) { - System.out.println("LoggingTooltipExtension: removing root console logging handler"); - logger.removeHandler(handler); - } - } - } - - @Override - public String getNewLogMessages() { - streamHandler.flush(); - String text = baos.toString(); - baos.reset(); - return text; - } -} \ No newline at end of file diff --git a/src/main/java/org/concordion/ext/logging/LogMessageTooltipWriter.java b/src/main/java/org/concordion/ext/logging/LogMessageTooltipWriter.java deleted file mode 100644 index 0201ca5..0000000 --- a/src/main/java/org/concordion/ext/logging/LogMessageTooltipWriter.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext.logging; - -import org.concordion.api.Element; -import org.concordion.api.Resource; -import org.concordion.api.listener.AssertEqualsListener; -import org.concordion.api.listener.AssertFailureEvent; -import org.concordion.api.listener.AssertFalseListener; -import org.concordion.api.listener.AssertSuccessEvent; -import org.concordion.api.listener.AssertTrueListener; -import org.concordion.api.listener.ExecuteEvent; -import org.concordion.api.listener.ExecuteListener; -import org.concordion.api.listener.ExpressionEvaluatedEvent; -import org.concordion.api.listener.MissingRowEvent; -import org.concordion.api.listener.SpecificationProcessingEvent; -import org.concordion.api.listener.SpecificationProcessingListener; -import org.concordion.api.listener.SurplusRowEvent; -import org.concordion.api.listener.ThrowableCaughtEvent; -import org.concordion.api.listener.ThrowableCaughtListener; -import org.concordion.api.listener.VerifyRowsListener; -import org.concordion.ext.tooltip.TooltipRenderer; - -/** - * Writes any new log messages to tooltips when invoked by Concordion events. - */ -public class LogMessageTooltipWriter implements AssertEqualsListener, AssertTrueListener, AssertFalseListener, ExecuteListener, - SpecificationProcessingListener, VerifyRowsListener, ThrowableCaughtListener { - - private final TooltipRenderer renderer; - private final LogMessenger logMessenger; - private Resource resource; - - public LogMessageTooltipWriter(TooltipRenderer renderer, LogMessenger logMessenger) { - this.logMessenger = logMessenger; - this.renderer = renderer; - } - - @Override - public void beforeProcessingSpecification(SpecificationProcessingEvent event) { - resource = event.getResource(); - } - - @Override - public void afterProcessingSpecification(SpecificationProcessingEvent event) { - resource = null; - } - - @Override - public void executeCompleted(ExecuteEvent event) { - renderLogMessages(event.getElement()); - } - - @Override - public void failureReported(AssertFailureEvent event) { - renderLogMessages(event.getElement()); - } - - @Override - public void successReported(AssertSuccessEvent event) { - renderLogMessages(event.getElement()); - } - - @Override - public void expressionEvaluated(ExpressionEvaluatedEvent event) { - renderLogMessages(event.getElement()); - } - - @Override - public void throwableCaught(ThrowableCaughtEvent event) { - renderLogMessages(event.getElement()); - } - - @Override - public void missingRow(MissingRowEvent event) { - } - - @Override - public void surplusRow(SurplusRowEvent event) { - } - - private void renderLogMessages(Element element) { - String text = logMessenger.getNewLogMessages(); - - if (text.length() > 0) { - renderer.renderTooltip(resource, element, text); - } - } -} diff --git a/src/main/java/org/concordion/ext/logging/LogMessenger.java b/src/main/java/org/concordion/ext/logging/LogMessenger.java deleted file mode 100644 index 3ba665f..0000000 --- a/src/main/java/org/concordion/ext/logging/LogMessenger.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext.logging; - -/** - * Delivers logging messages from the underlying logging mechanism. - */ -public interface LogMessenger { - /** - * Get new messages that have been written to the log since the last time this method was called. - * @return new log messages - */ - String getNewLogMessages(); -} \ No newline at end of file diff --git a/src/main/java/org/concordion/ext/package.html b/src/main/java/org/concordion/ext/package.html deleted file mode 100644 index 9e87280..0000000 --- a/src/main/java/org/concordion/ext/package.html +++ /dev/null @@ -1,39 +0,0 @@ - -Provides extensions for enhancing Concordion output. - - -

-This package contains extensions to: -

    -
  1. embed logging information in the Concordion output
  2. -
  3. embed screenshots in the Concordion output
  4. -
  5. embed HTML in the Concordion output
  6. -
  7. translate the text of exception messages
  8. -
  9. change the timestamp in the footer of the Concordion output from milliseconds to hours, minutes and seconds
  10. -
-

To add all of the extensions (except TranslatorExtension), set the system property concordion.extensions to org.concordion.ext.Extensions. -This is typically set in the @BeforeClass of a base test case:

-
-    @BeforeClass
-    public static void addExtensions() {
-      System.setProperty("concordion.extensions", "org.concordion.ext.Extensions");
-    }
-
-

The extensions may also be installed individually and have a number of customisation options. See the Javadoc of each extension for details. -To install multiple or customised extensions, supply a comma-separated list of extensions or extension factories in the concordion.extensions system property. -

- \ No newline at end of file diff --git a/src/main/java/org/concordion/ext/tooltip/TooltipRenderer.java b/src/main/java/org/concordion/ext/tooltip/TooltipRenderer.java deleted file mode 100644 index d9fd16c..0000000 --- a/src/main/java/org/concordion/ext/tooltip/TooltipRenderer.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext.tooltip; - -import org.concordion.api.Element; -import org.concordion.api.Resource; - -/** - * Renders tooltips in the Concordion output. The tooltip will display text when hovered over. - */ -public class TooltipRenderer { - - private long buttonId = 0; - private final Resource tooltipImageResource; - - /** - * Constructor. - * - * @param tooltipImageResource the image to use for the tooltip icon - */ - public TooltipRenderer(Resource tooltipImageResource) { - this.tooltipImageResource = tooltipImageResource; - } - - /** - * Adds a tooltip with the given text to the given element of the given resource. - * - * If the element is: - * - * - * @param resource the output resource - * @param element the element that the tooltip is to be added to - * @param text the text to include in the tooltip - */ - public void renderTooltip(Resource resource, Element element, String text) { - buttonId++; - - Element tooltip = createTooltip(resource.getRelativePath(tooltipImageResource), text); - if (element.getLocalName().equals("table")) { - Element tr = element.getFirstDescendantNamed("tr"); - Element th = new Element("th"); - tr.appendChild(th); - th.appendChild(tooltip); - } else if (element.getLocalName().equals("tr")) { - Element td = new Element("td"); - element.appendChild(td); - td.appendChild(tooltip); - } else if (element.getLocalName().equals("td")) { - Element span = new Element("span"); - element.moveChildrenTo(span); - element.moveAttributesTo(span); - element.appendChild(span); - element.appendChild(tooltip); - } else { - element.appendNonBreakingSpace(); - element.appendSister(tooltip); - } - } - - private Element createTooltip(String relativePathToImage, String text) { - Element tt = new Element("a").addAttribute("href", "#").addStyleClass("tt"); - tt.appendChild(new Element("img").addAttribute("src", relativePathToImage).addAttribute("alt", "i").appendNonBreakingSpace()); - Element tooltip = new Element("span").addStyleClass("tooltip"); - tt.appendChild(tooltip); - tooltip.appendChild(new Element("span").addStyleClass("top").appendText("")); - Element textChild = new Element("span").addStyleClass("middle"); - String[] lines = text.split("\\r?\\n"); - for (String line : lines) { - textChild.appendText(line).appendChild(new Element("br")); - } - tooltip.appendChild(textChild); - tooltip.appendChild(new Element("span").addStyleClass("bottom").appendText("")); - - return tt; - } -} diff --git a/src/main/java/org/concordion/ext/translator/MessageTranslator.java b/src/main/java/org/concordion/ext/translator/MessageTranslator.java deleted file mode 100644 index bd08b1e..0000000 --- a/src/main/java/org/concordion/ext/translator/MessageTranslator.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext.translator; - -public interface MessageTranslator { - /** - * Translates the original message into a new message. - * @param originalMessage - * @return the new message - */ - String translate(String originalMessage); -} diff --git a/src/main/resources/org/concordion/ext/resource/bubble-200.gif b/src/main/resources/org/concordion/ext/resource/bubble-200.gif deleted file mode 100644 index 93adba3..0000000 Binary files a/src/main/resources/org/concordion/ext/resource/bubble-200.gif and /dev/null differ diff --git a/src/main/resources/org/concordion/ext/resource/bubble-300.gif b/src/main/resources/org/concordion/ext/resource/bubble-300.gif deleted file mode 100644 index 341ff34..0000000 Binary files a/src/main/resources/org/concordion/ext/resource/bubble-300.gif and /dev/null differ diff --git a/src/main/resources/org/concordion/ext/resource/bubble.gif b/src/main/resources/org/concordion/ext/resource/bubble.gif deleted file mode 100644 index e884882..0000000 Binary files a/src/main/resources/org/concordion/ext/resource/bubble.gif and /dev/null differ diff --git a/src/main/resources/org/concordion/ext/resource/bubble_filler-200.gif b/src/main/resources/org/concordion/ext/resource/bubble_filler-200.gif deleted file mode 100644 index 49c9a6b..0000000 Binary files a/src/main/resources/org/concordion/ext/resource/bubble_filler-200.gif and /dev/null differ diff --git a/src/main/resources/org/concordion/ext/resource/bubble_filler-300.gif b/src/main/resources/org/concordion/ext/resource/bubble_filler-300.gif deleted file mode 100644 index b581120..0000000 Binary files a/src/main/resources/org/concordion/ext/resource/bubble_filler-300.gif and /dev/null differ diff --git a/src/main/resources/org/concordion/ext/resource/bubble_filler.gif b/src/main/resources/org/concordion/ext/resource/bubble_filler.gif deleted file mode 100644 index 19b5b7b..0000000 Binary files a/src/main/resources/org/concordion/ext/resource/bubble_filler.gif and /dev/null differ diff --git a/src/main/resources/org/concordion/ext/resource/i16.png b/src/main/resources/org/concordion/ext/resource/i16.png deleted file mode 100644 index 14142d0..0000000 Binary files a/src/main/resources/org/concordion/ext/resource/i16.png and /dev/null differ diff --git a/src/main/resources/org/concordion/ext/resource/tooltip.css b/src/main/resources/org/concordion/ext/resource/tooltip.css deleted file mode 100644 index cd5c975..0000000 --- a/src/main/resources/org/concordion/ext/resource/tooltip.css +++ /dev/null @@ -1,43 +0,0 @@ -a.tt img {border: none; padding-left:4px;} - -/*---------- bubble tooltip, courtesy of trentrichardson.com -----------*/ -a.tt{ - position:relative; - z-index:24; - color:#3CA3FF; - font-size:10pt; - text-decoration:none; -} -a.tt span{ display: none; } - -/*background:; ie hack, something must be changed in a for ie to execute it*/ -a.tt:hover{ z-index:25; color: #aaaaff; background:;} -a.tt:hover span.tooltip{ - display:block; - position:absolute; - top:0px; left:0; - padding: 15px 0 0 0; - width:400px; - color: #993300; - text-align: left; - filter: alpha(opacity:95); - KHTMLOpacity: 0.95; - MozOpacity: 0.95; - opacity: 0.95; -} -a.tt:hover span.top{ - display: block; - padding: 30px 8px 0; - background: url(image/bubble.gif) no-repeat top; -} -a.tt:hover span.middle{ /* different middle bg for stretch */ - display: block; - padding: 0 8px; - background: url(image/bubble_filler.gif) repeat bottom; -} -a.tt:hover span.bottom{ - display: block; - padding:3px 8px 10px; - color: #548912; - background: url(image/bubble.gif) no-repeat bottom; -} diff --git a/src/test/java/org/concordion/ext/footer/TestTimeFormatterTest.java b/src/test/java/org/concordion/ext/footer/TestTimeFormatterTest.java deleted file mode 100644 index 3098e2b..0000000 --- a/src/test/java/org/concordion/ext/footer/TestTimeFormatterTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 org.concordion.ext.footer; - -import static org.junit.Assert.*; -import static org.hamcrest.CoreMatchers.*; - -import org.concordion.ext.footer.TimestampFormatter; -import org.junit.Test; - - -public class TestTimeFormatterTest { - @Test - public void translatesSeconds() { - assertThat(new TimestampFormatter().reformat("in 5771 ms on 24-Sep-2010 at 10:57:30 NZST"), equalTo("in 5s on 24-Sep-2010 at 10:57:30 NZST")); - } - - @Test - public void translatesMinutesAndSeconds() { - assertThat(new TimestampFormatter().reformat("in 105771 ms on 24-Sep-2010 at 10:57:30 NZST"), equalTo("in 1m 45s on 24-Sep-2010 at 10:57:30 NZST")); - } - - @Test - public void translatesHoursMinutesAndSeconds() { - assertThat(new TimestampFormatter().reformat("in 7654321 ms on 24-Sep-2010 at 10:57:30 NZST"), equalTo("in 2h 7m 34s on 24-Sep-2010 at 10:57:30 NZST")); - } -} diff --git a/src/test/java/spec/concordion/ext/Ext.java b/src/test/java/spec/concordion/ext/Ext.java deleted file mode 100644 index 053e482..0000000 --- a/src/test/java/spec/concordion/ext/Ext.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 spec.concordion.ext; - -import org.concordion.integration.junit4.ConcordionRunner; -import org.junit.Before; -import org.junit.runner.RunWith; - -import test.concordion.TestRig; - -@RunWith(ConcordionRunner.class) -public class Ext { -} diff --git a/src/test/java/spec/concordion/ext/embed/Embed.java b/src/test/java/spec/concordion/ext/embed/Embed.java deleted file mode 100644 index dddd65f..0000000 --- a/src/test/java/spec/concordion/ext/embed/Embed.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 spec.concordion.ext.embed; - -import org.concordion.integration.junit4.ConcordionRunner; -import org.junit.Before; -import org.junit.runner.RunWith; - -import test.concordion.TestRig; - -@RunWith(ConcordionRunner.class) -public class Embed { - - private String nextResult; - - @Before - public void installExtension() { - System.setProperty("concordion.extensions", "org.concordion.ext.EmbedExtension"); - } - - public String list(String item1, String item2) { - return String.format("
  1. %s
  2. %s
", item1, item2); - } - - public void setNextResult(String nextResult) { - this.nextResult = nextResult; - } - - public String render(String fragment, String namespacePrefix, String namespace) throws Exception { - return new TestRig() - .withNamespaceDeclaration(namespacePrefix, namespace) - .withStubbedEvaluationResult(nextResult) - .processFragment(fragment) - .getOutputFragmentXML(); - } -} diff --git a/src/test/java/spec/concordion/ext/loggingTooltip/AlternateLoggingTooltipExtensionFactory.java b/src/test/java/spec/concordion/ext/loggingTooltip/AlternateLoggingTooltipExtensionFactory.java deleted file mode 100644 index 385e284..0000000 --- a/src/test/java/spec/concordion/ext/loggingTooltip/AlternateLoggingTooltipExtensionFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -package spec.concordion.ext.loggingTooltip; - -import org.concordion.api.extension.ConcordionExtension; -import org.concordion.api.extension.ConcordionExtensionFactory; -import org.concordion.ext.LoggingTooltipExtension; -import org.concordion.ext.logging.LogMessenger; - -public class AlternateLoggingTooltipExtensionFactory implements ConcordionExtensionFactory { - - public static String logMessage; - - @Override - public ConcordionExtension createExtension() { - return new LoggingTooltipExtension(new LogMessenger() { - @Override - public String getNewLogMessages() { - return "[]: " + logMessage; - } - }); - } -} diff --git a/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltip.java b/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltip.java deleted file mode 100644 index 296d358..0000000 --- a/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltip.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 spec.concordion.ext.loggingTooltip; - -import java.util.logging.Logger; - -import org.concordion.ext.LoggingTooltipExtension; -import org.concordion.integration.junit4.ConcordionRunner; -import org.junit.Before; -import org.junit.runner.RunWith; - -import test.concordion.EmbedExtensionWithConcordionNamespaceFactory; -import test.concordion.TestRig; - -@RunWith(ConcordionRunner.class) -public class LoggingTooltip { - - private static final Logger logger = Logger.getLogger(LoggingTooltip.class.getName()); - - @Before - public void installExtension() { - System.setProperty("concordion.extensions", - LoggingTooltipExtension.class.getName() + ", " + EmbedExtensionWithConcordionNamespaceFactory.class.getName()); - } - - public String render(String fragment) throws Exception { - String outputFragment = new TestRig() - .withFixture(this) - .withSourceFilter("/org/concordion/ext/resource") - .processFragment(fragment) - .getOutputFragmentXML(); - return outputFragment.substring(0, outputFragment.indexOf("[") + 1) + "timestamp" + outputFragment.substring(outputFragment.indexOf("]")); - } - - public String getName() throws Exception { - logger.info("Got name Frank"); - return "Frank"; - } -} diff --git a/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipCss.java b/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipCss.java deleted file mode 100644 index 9bdb4a0..0000000 --- a/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipCss.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 spec.concordion.ext.loggingTooltip; - -import org.concordion.integration.junit4.ConcordionRunner; -import org.junit.runner.RunWith; - -import test.concordion.FileOutputStreamer; -import test.concordion.ProcessingResult; -import test.concordion.TestRig; - -@RunWith(ConcordionRunner.class) -public class LoggingTooltipCss { - - public void setSystemProperty(String name, String value) { - System.setProperty(name, value); - } - - public boolean hasCSSDeclaration(String cssFilename) throws Exception { - ProcessingResult result = new TestRig() - .withFixture(this) - .withOutputStreamer(new FileOutputStreamer()) - .withSourceFilter("/org/concordion/ext/resource") - .processFragment(""); - return result.hasCSSDeclaration(cssFilename); - } -} diff --git a/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipCustomisation.java b/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipCustomisation.java deleted file mode 100644 index 48d0f69..0000000 --- a/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipCustomisation.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 spec.concordion.ext.loggingTooltip; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.concordion.integration.junit4.ConcordionRunner; -import org.junit.runner.RunWith; - -import test.concordion.TestRig; - -@RunWith(ConcordionRunner.class) -public class LoggingTooltipCustomisation { - public String acronym; - private static final Logger fooLogger = Logger.getLogger("foo"); - private static final Logger barLogger = Logger.getLogger("bar"); - private static final Logger bazLogger = Logger.getLogger("baz"); - - public void configureLogLevel(String logLevel) { - LoggingTooltipExtensionFactory.loggers = ""; - LoggingTooltipExtensionFactory.logLevel = Level.parse(logLevel); - } - - public void configureLoggers(String loggers) { - LoggingTooltipExtensionFactory.loggers = loggers; - LoggingTooltipExtensionFactory.logLevel = Level.FINEST; - } - - public void setSystemProperty(String key, String value) { - System.setProperty(key, value); - } - - public void configureLogMessage(String value) { - AlternateLoggingTooltipExtensionFactory.logMessage = value; - } - - public String render(String fragment) throws Exception { - String outputFragment = new TestRig() - .withFixture(this) - .withSourceFilter("/org/concordion/ext/resource") - .processFragment(fragment) - .getOutputFragmentXML(); - return outputFragment; - } - - public String getMessagesFrom(String outputFragment) { - String message = ""; - String[] lines = outputFragment.split("
"); - for (String line : lines) { - message += extractLogMessage(line) + "\n"; - } - return message.trim(); - } - - private String extractLogMessage(String outputFragment) { - int logMessageStart = outputFragment.indexOf("]"); - if (logMessageStart == -1) { - return ""; - } - return "[timestamp]" + (outputFragment.substring(logMessageStart + 1)).trim(); - } - - public String getName() throws Exception { - fooLogger.info("Hello Foo"); - barLogger.info("Hello Bar"); - bazLogger.info("Hello Baz"); - return "Frank"; - } - - public void logStuff() throws Exception { - fooLogger.info("Hello Info"); - barLogger.fine("Hello Fine"); - bazLogger.warning("Hello Warn"); - } -} diff --git a/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipExtensionFactory.java b/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipExtensionFactory.java deleted file mode 100644 index 404c402..0000000 --- a/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipExtensionFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 spec.concordion.ext.loggingTooltip; - -import java.util.logging.Level; - -import org.concordion.api.extension.ConcordionExtension; -import org.concordion.api.extension.ConcordionExtensionFactory; -import org.concordion.ext.LoggingTooltipExtension; - -public class LoggingTooltipExtensionFactory implements ConcordionExtensionFactory { - - public static String loggers; - public static Level logLevel; - - @Override - public ConcordionExtension createExtension() { - LoggingTooltipExtension extension = new LoggingTooltipExtension(loggers, logLevel, false); - return extension; - } -} \ No newline at end of file diff --git a/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipResources.java b/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipResources.java deleted file mode 100644 index 58d1efa..0000000 --- a/src/test/java/spec/concordion/ext/loggingTooltip/LoggingTooltipResources.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 spec.concordion.ext.loggingTooltip; - -import org.concordion.api.Resource; -import org.concordion.integration.junit4.ConcordionRunner; -import org.junit.runner.RunWith; - -import test.concordion.TestRig; - -@RunWith(ConcordionRunner.class) -public class LoggingTooltipResources { - - public void setSystemProperty(String name, String value) { - System.setProperty(name, value); - } - - public boolean hasCopiedResource(String resourceName) throws Exception { - TestRig testRig = new TestRig(); - testRig - .withFixture(this) - .withSourceFilter("/org/concordion/ext/resource") - .processFragment(""); - return testRig.hasCopiedResource(new Resource("/image/" + resourceName)); - } -} diff --git a/src/test/java/spec/concordion/ext/screenshot/ScreenshotCommand.java b/src/test/java/spec/concordion/ext/screenshot/ScreenshotCommand.java index 9d5f767..bdc287b 100644 --- a/src/test/java/spec/concordion/ext/screenshot/ScreenshotCommand.java +++ b/src/test/java/spec/concordion/ext/screenshot/ScreenshotCommand.java @@ -18,7 +18,6 @@ import org.junit.Before; import org.junit.runner.RunWith; -import test.concordion.EmbedExtensionWithConcordionNamespaceFactory; import test.concordion.FileOutputStreamer; import test.concordion.TestRig; import test.concordion.ext.screenshot.DummyScreenshotFactory; @@ -32,7 +31,7 @@ public class ScreenshotCommand { @Before public void installExtension() { System.setProperty("concordion.extensions", - DummyScreenshotFactory.class.getName() + ", " + EmbedExtensionWithConcordionNamespaceFactory.class.getName()); + DummyScreenshotFactory.class.getName()); } public String render(String fragment, String namespacePrefix, String namespace) throws Exception { diff --git a/src/test/java/spec/concordion/ext/screenshot/ScreenshotListener.java b/src/test/java/spec/concordion/ext/screenshot/ScreenshotListener.java index 8e3f3d7..aa97069 100644 --- a/src/test/java/spec/concordion/ext/screenshot/ScreenshotListener.java +++ b/src/test/java/spec/concordion/ext/screenshot/ScreenshotListener.java @@ -18,7 +18,6 @@ import org.junit.Before; import org.junit.runner.RunWith; -import test.concordion.EmbedExtensionWithConcordionNamespaceFactory; import test.concordion.FileOutputStreamer; import test.concordion.TestRig; import test.concordion.ext.screenshot.DummyScreenshotFactory; @@ -36,7 +35,7 @@ public class ScreenshotListener { @Before public void installExtension() { System.setProperty("concordion.extensions", - DummyScreenshotFactory.class.getName() + ", " + EmbedExtensionWithConcordionNamespaceFactory.class.getName()); + DummyScreenshotFactory.class.getName()); } public String renderAsFailure(String fragment, String acronym) throws Exception { diff --git a/src/test/java/spec/concordion/ext/screenshot/ScreenshotNaming.java b/src/test/java/spec/concordion/ext/screenshot/ScreenshotNaming.java index e174db1..d29d3bf 100644 --- a/src/test/java/spec/concordion/ext/screenshot/ScreenshotNaming.java +++ b/src/test/java/spec/concordion/ext/screenshot/ScreenshotNaming.java @@ -22,7 +22,6 @@ import org.junit.Before; import org.junit.runner.RunWith; -import test.concordion.EmbedExtensionWithConcordionNamespaceFactory; import test.concordion.FileOutputStreamer; import test.concordion.TestRig; import test.concordion.ext.screenshot.DummyScreenshotFactory; @@ -38,7 +37,7 @@ public class ScreenshotNaming { @Before public void installExtension() { System.setProperty("concordion.extensions", - DummyScreenshotFactory.class.getName() + ", " + EmbedExtensionWithConcordionNamespaceFactory.class.getName()); + DummyScreenshotFactory.class.getName()); } public ScreenshotNaming() { diff --git a/src/test/java/spec/concordion/ext/timestampFormatter/TimestampFormatter.java b/src/test/java/spec/concordion/ext/timestampFormatter/TimestampFormatter.java deleted file mode 100644 index 7cae5e1..0000000 --- a/src/test/java/spec/concordion/ext/timestampFormatter/TimestampFormatter.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 spec.concordion.ext.timestampFormatter; - -import org.concordion.integration.junit4.ConcordionRunner; -import org.junit.runner.RunWith; - -import test.concordion.TestRig; - -@RunWith(ConcordionRunner.class) -public class TimestampFormatter { - public void setSystemProperty(String name, String value) { - System.setProperty(name, value); - } - - public String getFooterStart() throws Exception { - String footerText = new TestRig() - .withFixture(this) - .processFragment("

2000

").getFooterText(); - return footerText.substring(0, footerText.indexOf("in") + 8); - } - - public void sleep(int millis) throws Exception { - Thread.sleep(millis); - } -} diff --git a/src/test/java/spec/concordion/ext/translator/FrenchTranslatorExtensionFactory.java b/src/test/java/spec/concordion/ext/translator/FrenchTranslatorExtensionFactory.java deleted file mode 100644 index c00e1c0..0000000 --- a/src/test/java/spec/concordion/ext/translator/FrenchTranslatorExtensionFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 spec.concordion.ext.translator; - -import org.concordion.api.extension.ConcordionExtension; -import org.concordion.api.extension.ConcordionExtensionFactory; -import org.concordion.ext.TranslatorExtension; -import org.concordion.ext.translator.MessageTranslator; - -public class FrenchTranslatorExtensionFactory implements ConcordionExtensionFactory, MessageTranslator { - - @Override - public ConcordionExtension createExtension() { - return new TranslatorExtension(this); - } - - @Override - public String translate(String originalMessage) { - return originalMessage.replace("RuntimeException: Unable to connect to", "Impossible de se connecter à"); - } -} \ No newline at end of file diff --git a/src/test/java/spec/concordion/ext/translator/Translator.java b/src/test/java/spec/concordion/ext/translator/Translator.java deleted file mode 100644 index 03cb513..0000000 --- a/src/test/java/spec/concordion/ext/translator/Translator.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 spec.concordion.ext.translator; - -import org.concordion.integration.junit4.ConcordionRunner; -import org.junit.Before; -import org.junit.runner.RunWith; - -import test.concordion.EmbedExtensionWithConcordionNamespaceFactory; -import test.concordion.TestRig; - -@RunWith(ConcordionRunner.class) -public class Translator { - - private String exceptionMessage; - - @Before - public void setupEmbedExtension() { - System.setProperty("concordion.extensions", EmbedExtensionWithConcordionNamespaceFactory.class.getName()); - } - - public void setSystemProperty(String name, String value) { - System.setProperty(name, value + ", " + EmbedExtensionWithConcordionNamespaceFactory.class.getName()); - } - - public void setExceptionMessage(String exceptionMessage) { - this.exceptionMessage = exceptionMessage; - } - - public void makeConnection() { - throw new RuntimeException(exceptionMessage); - } - - public String render(String fragment) throws Exception { - return new TestRig() - .withFixture(this) - .processFragment(fragment) - .getOutputFragmentXML(); - } - - public String getExceptionMessage(String fragment) { - return new TestRig() - .withFixture(this) - .processFragment(fragment) - .getExceptionMessage(); - } - - public String getStackTraceMessage(String fragment) { - return new TestRig() - .withFixture(this) - .processFragment(fragment) - .getStackTraceMessage().replace("org.concordion.internal.InvalidExpressionException: ", ""); - } -} diff --git a/src/test/java/test/concordion/EmbedExtensionWithConcordionNamespaceFactory.java b/src/test/java/test/concordion/EmbedExtensionWithConcordionNamespaceFactory.java deleted file mode 100644 index ccc6a98..0000000 --- a/src/test/java/test/concordion/EmbedExtensionWithConcordionNamespaceFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2010 Two Ten Consulting Limited, New Zealand - * - * 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 test.concordion; - -import org.concordion.api.extension.ConcordionExtension; -import org.concordion.api.extension.ConcordionExtensionFactory; -import org.concordion.ext.EmbedExtension; -import org.concordion.ext.ScreenshotExtension; -import org.concordion.internal.ConcordionBuilder; - -public class EmbedExtensionWithConcordionNamespaceFactory implements ConcordionExtensionFactory { - @Override - public ConcordionExtension createExtension() { - EmbedExtension extension = new EmbedExtension(); - extension.withNamespace("concordion", ConcordionBuilder.NAMESPACE_CONCORDION_2007); - extension.withNamespace("cx", ScreenshotExtension.EXTENSION_NAMESPACE); - return extension; - } -} diff --git a/src/test/resources/spec/concordion/ext/Ext.html b/src/test/resources/spec/concordion/ext/Ext.html deleted file mode 100644 index a56274d..0000000 --- a/src/test/resources/spec/concordion/ext/Ext.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - -

Concordion Extensions Library

- -

Concordion Extensions introduce additional functionality. See here for a guide on how to create and configure them.

- -

These specifications cover the extensions available in the Concordion Extensions Library.

- -

Extensions

- - - diff --git a/src/test/resources/spec/concordion/ext/embed/Embed.html b/src/test/resources/spec/concordion/ext/embed/Embed.html deleted file mode 100644 index 8ded202..0000000 --- a/src/test/resources/spec/concordion/ext/embed/Embed.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - -

embed

- -

The Embed extension adds an embed command to embed HTML snippets in the Concordion output.

- -
-

Example

- -

Given the specification maps the prefix cx to the namespace urn:concordion-extensions:2010.

- -

- If the expression "username" - evaluates to "<p font-style="italic">jbloggs</p>" and we - have the following instrumentation in our specification: -

- -
-<p>Username: <span cx:embed="#username" /></p>
-
- -

Then we expect the following output:

- -
-<p>Username: <span cx:embed="#username"><p font-style="italic">jbloggs</p></span></p>
-
-
- - diff --git a/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltip.html b/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltip.html deleted file mode 100644 index 2bd9a8b..0000000 --- a/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltip.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - -

Logging Tooltip Extension

- -

The Logging Tooltip extension adds logging information as tooltips to the Concordion output. The logging information is only displayed when -hovering over the tooltip.

- -

By default, this extension will capture all output from the root java.util.logging logger and disable console logging of the root logger.

- -
-

Example

- -
<p concordion:assertEquals="getName()">Frank</p>
- -

When run with a fixture that logs and returns the name "Frank", it becomes:

- -
-<p concordion:assertEquals="getName()" class="success">Frank&#160;</p> _
-<a href="#" class="tt"> _
-<img src="image/info16.png" alt="i">&#160;</img> _
-<span class="tooltip"> _
-<span class="top" /> _
-<span class="middle"> _
-[timestamp]: Got name Frank  _
-<br /> _
-</span><span class="bottom" /> _
-</span> _
-</a>
-
- -

where timestamp shows the time the statement was logged.

- -

NOTE: the icon that appears above is after an execute command within this specification. Since we are running a specification within a specification, it appears in an unusual location.

- -
- -

Further Details

- - - - - diff --git a/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltipCss.html b/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltipCss.html deleted file mode 100644 index 89549a0..0000000 --- a/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltipCss.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -

Logging Tooltip CSS Styles

- -

The Logging Tooltip extension adds an external CSS stylesheet.

- -
-

Example

- -

Given the system property concordion.extensions is set to org.concordion.ext.LoggingTooltipExtension.

- -

The HTML output links the external tooltip.css stylesheet.

- -
- - diff --git a/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltipCustomisation.html b/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltipCustomisation.html deleted file mode 100644 index aa03152..0000000 --- a/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltipCustomisation.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - -

Logging Tooltip Customisation

- -

The Logging Tooltip extension can be customised using a ConcordionExtensionFactory to restrict the log output to -named loggers, and by logging level. The output of logging to the console can also be enabled.

- -
-

Example - restrict output to single named logger

-

Given the LoggingTooltipExtensionFactory has been restricted to use only the foo logger,

-

and the system property concordion.extensions - is set to the class spec.concordion.ext.loggingTooltip.LoggingTooltipExtensionFactory.

- -

When running

-
<p concordion:assertEquals="getName()">Frank</p>
- -

with a fixture that logs "Hello Foo" to the foo logger, and "Hello Bar" to the bar logger, - the logging tooltip displays:

- -
[timestamp]: Hello Foo
-
- -
-

Example - restrict output to multiple named loggers

-

Given the LoggingTooltipExtensionFactory has been restricted to use the baz, foo loggers,

-

and the system property concordion.extensions - is set to the class spec.concordion.ext.loggingTooltip.LoggingTooltipExtensionFactory.

- -

When running

-
<p concordion:assertEquals="getName()">Frank</p>
- -

with a fixture that logs "Hello Foo" to the foo logger, "Hello Bar" to the bar logger, and "Hello Baz" to the baz logger, - the logging tooltip displays:

- -
[timestamp]: Hello Foo
-[timestamp]: Hello Baz
-
- -
-

Example - restrict output to specific log level

-

Given the LoggingTooltipExtensionFactory has been restricted to use the INFO log level,

-

and the system property concordion.extensions - is set to the class spec.concordion.ext.loggingTooltip.LoggingTooltipExtensionFactory.

- -

When running

-
<p concordion:execute="logStuff()"/>
- -

with a fixture that logs "Hello Info" at the INFO log level, "Hello Fine" to the FINE log level, and "Hello Warn" to the WARN log level, - the logging tooltip displays:

- -
[timestamp]: Hello Info
-[timestamp]: Hello Warn
-
- -

- For those not using java.util.logging, a custom LogMessenger can be provided. For the sake of the below - example, the implementation is one that returns a fixed string, but alternatives that use Logback, log4j or slf4j - can be easily implemented as an exercise for the reader. -

- -
-

Example - custom log messenger

- -

Given the AlternateLoggingTooltipExtensionFactory has been told to return Hello AlternateLoggingTooltipExtensionFactory as a log message,

-

and the system property concordion.extensions - is set to the class spec.concordion.ext.loggingTooltip.AlternateLoggingTooltipExtensionFactory.

- -

When running

-
<p concordion:execute="logStuff()"/>
- -

the logging tooltip displays:

- -
[timestamp]: Hello AlternateLoggingTooltipExtensionFactory
- -
- - diff --git a/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltipResources.html b/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltipResources.html deleted file mode 100644 index e29f31c..0000000 --- a/src/test/resources/spec/concordion/ext/loggingTooltip/LoggingTooltipResources.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - -

Logging Tooltip Resources

- -

The Logging Tooltip extension copies image files to the Concordion output folder.

- -
-

Example

- -

Given the system property concordion.extensions is set to org.concordion.ext.LoggingTooltipExtension.

- -

The following files are copied to the output folder:

- -
- - diff --git a/src/test/resources/spec/concordion/ext/timestampFormatter/TimestampFormatter.html b/src/test/resources/spec/concordion/ext/timestampFormatter/TimestampFormatter.html deleted file mode 100644 index 087cbae..0000000 --- a/src/test/resources/spec/concordion/ext/timestampFormatter/TimestampFormatter.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -

Timestamp Formatter

- -

The Timestamp Formatter extension reformats the footer of the Concordion output to show hours, minutes and seconds rather than milliseconds.

- -
-

Example

- -

Given the system property concordion.extensions is set to org.concordion.ext.TimestampFormatterExtension.

- -

When we run Concordion with a fixture that takes 2 seconds, we expect the footer on the output to start with:

- -
Results generated by Concordionin 2s on
-
- - diff --git a/src/test/resources/spec/concordion/ext/translator/Translator.html b/src/test/resources/spec/concordion/ext/translator/Translator.html deleted file mode 100644 index 49eb4e3..0000000 --- a/src/test/resources/spec/concordion/ext/translator/Translator.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - -

Exception Translator

- -

The Exception Translator extension modifies the exception message.

- -
-

Example

- -

Given the system property concordion.extensions is set to spec.concordion.ext.translator.FrenchTranslatorExtensionFactory.

- -

When running a fixture that throws an exception with the message Unable to connect to http://localhost:9080, when the following command is executed

- -
<p concordion:execute="makeConnection()">Connectez moi</p>
- -

, the output displays the exception message:

- -
Impossible de se connecter à http://localhost:9080
- -

, and the stack trace retains the original exception message:

- -
RuntimeException: Unable to connect to http://localhost:9080
- -
- -