diff options
Diffstat (limited to 'org.eclipse.jubula.client.teststyle.impl.standard')
15 files changed, 333 insertions, 0 deletions
diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/.checkstyle b/org.eclipse.jubula.client.teststyle.impl.standard/.checkstyle new file mode 100644 index 000000000..57af6cc26 --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/.checkstyle @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false"> + <fileset name="all" enabled="true" check-config-name="Jubula" local="false"> + <file-match-pattern match-pattern="." include-pattern="true"/> + </fileset> + <filter name="FilesFromPackage" enabled="true"> + <filter-data value="src/org/eclipse/jubula/client/teststyle/impl/standard/i18n"/> + </filter> +</fileset-config> diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/.classpath b/org.eclipse.jubula.client.teststyle.impl.standard/.classpath new file mode 100644 index 000000000..64c5e31b7 --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/.gitignore b/org.eclipse.jubula.client.teststyle.impl.standard/.gitignore new file mode 100644 index 000000000..934e0e06f --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/.gitignore @@ -0,0 +1,2 @@ +/bin +/target diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/.project b/org.eclipse.jubula.client.teststyle.impl.standard/.project new file mode 100644 index 000000000..be690a87e --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.jubula.client.teststyle.impl.standard</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>net.sf.eclipsecs.core.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> + </natures> +</projectDescription> diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jubula.client.teststyle.impl.standard/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..b8a8e0fd2 --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Feb 01 13:14:29 CET 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/META-INF/MANIFEST.MF b/org.eclipse.jubula.client.teststyle.impl.standard/META-INF/MANIFEST.MF new file mode 100644 index 000000000..f44a3e329 --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Jubula Teststyle Rules - Standard +Bundle-SymbolicName: org.eclipse.jubula.client.teststyle.impl.standard;singleton:=true +Bundle-Version: 1.2.0.qualifier +Bundle-Activator: org.eclipse.jubula.client.teststyle.impl.standard.Activator +Bundle-Vendor: Eclipse Jubula +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.jubula.client.teststyle;bundle-version="[1.2.0,1.3.0)", + org.eclipse.jubula.client.core;bundle-version="[1.2.0,1.3.0)", + org.eclipse.jubula.client.ui.rcp;bundle-version="[1.2.0,1.3.0)" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/about.html b/org.eclipse.jubula.client.teststyle.impl.standard/about.html new file mode 100644 index 000000000..f1be81099 --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 22, 2011</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +</body> +</html> diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/build.properties b/org.eclipse.jubula.client.teststyle.impl.standard/build.properties new file mode 100644 index 000000000..e9863e281 --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/plugin.xml b/org.eclipse.jubula.client.teststyle.impl.standard/plugin.xml new file mode 100644 index 000000000..0cb81a5ce --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/plugin.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<!-- + Copyright (c) 2004, 2012 BREDEX GmbH. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + --> +<plugin> + <extension + point="org.eclipse.jubula.client.teststyle.definition"> + <category + description="Standard Rules" + name="Standard Rules"> + <check + activeByDefault="true" + class="org.eclipse.jubula.client.teststyle.impl.standard.checks.TestSuiteHasAUT" + defaultSeverity="ERROR" + description="Each Testsuite should be assigned to an AUT" + id="org.eclipse.jubula.client.teststyle.impl.standard.checks.testSuiteHasAUT" + name="Testsuite has AUT defined"> + <contexts><TestSuites id="TestSuiteContext" /></contexts> + <attributes></attributes> + </check> + <check + activeByDefault="true" + class="org.eclipse.jubula.client.teststyle.impl.standard.checks.TestSuiteNotEmpty" + defaultSeverity="ERROR" + description="Each Testsuite should reference at least one Test Case" + id="org.eclipse.jubula.client.teststyle.impl.standard.checks.testSuiteNotEmpty" + name="Testsuite references at least one Test Case"> + <contexts><TestSuites id="TestSuiteContext" /></contexts> + <attributes></attributes> + </check> + </category> + </extension> + +</plugin> diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/pom.xml b/org.eclipse.jubula.client.teststyle.impl.standard/pom.xml new file mode 100644 index 000000000..9a6c086c5 --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/pom.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2004, 2012 BREDEX GmbH. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + --> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.jubula.releng.client</artifactId> + <groupId>org.eclipse.jubula</groupId> + <version>1.2.0-SNAPSHOT</version> + <relativePath>../org.eclipse.jubula.releng.client</relativePath> + </parent> + <groupId>org.eclipse.jubula</groupId> + <artifactId>org.eclipse.jubula.client.teststyle.impl.standard</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project> diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/Activator.java b/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/Activator.java new file mode 100644 index 000000000..43fe1a0a4 --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/Activator.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2004, 2012 BREDEX GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * BREDEX GmbH - initial API and implementation and/or initial documentation + *******************************************************************************/ +package org.eclipse.jubula.client.teststyle.impl.standard; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +/** + * Default Activator + */ +public class Activator implements BundleActivator { + /** + * the context + */ + private static BundleContext context; + + /** + * @return the context + */ + static BundleContext getContext() { + return context; + } + + /** {@inheritDoc} */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /** {@inheritDoc} */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } +} diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/checks/TestSuiteHasAUT.java b/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/checks/TestSuiteHasAUT.java new file mode 100644 index 000000000..28420985b --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/checks/TestSuiteHasAUT.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2004, 2012 BREDEX GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * BREDEX GmbH - initial API and implementation and/or initial documentation + *******************************************************************************/ +package org.eclipse.jubula.client.teststyle.impl.standard.checks; + +import java.util.Locale; + +import org.eclipse.jubula.client.core.model.ITestSuitePO; +import org.eclipse.jubula.client.teststyle.checks.BaseCheck; +import org.eclipse.jubula.client.teststyle.impl.standard.i18n.Messages; +import org.eclipse.jubula.client.ui.rcp.businessprocess.WorkingLanguageBP; + +/** + * Check whether each Testsuite has an AUT defined + */ +public class TestSuiteHasAUT extends BaseCheck { + + @Override + public String getDescription() { + return Messages.TestSuiteHasAUTProblemDescription; + } + + @Override + public boolean hasError(Object obj) { + if (obj instanceof ITestSuitePO) { + ITestSuitePO ts = (ITestSuitePO) obj; + WorkingLanguageBP wl = WorkingLanguageBP.getInstance(); + Locale workLang = wl.getWorkingLanguage(); + if (ts.getAut() != null && wl.isTestSuiteLanguage(workLang, ts)) { + return false; + } + } + return true; + } + +} diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/checks/TestSuiteNotEmpty.java b/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/checks/TestSuiteNotEmpty.java new file mode 100644 index 000000000..12d46af06 --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/checks/TestSuiteNotEmpty.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2004, 2012 BREDEX GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * BREDEX GmbH - initial API and implementation and/or initial documentation + *******************************************************************************/ +package org.eclipse.jubula.client.teststyle.impl.standard.checks; + +import org.eclipse.jubula.client.core.model.ITestSuitePO; +import org.eclipse.jubula.client.teststyle.checks.BaseCheck; +import org.eclipse.jubula.client.teststyle.impl.standard.i18n.Messages; + +/** + * Testsuites should at least reference one test case + */ +public class TestSuiteNotEmpty extends BaseCheck { + @Override + public String getDescription() { + return Messages.NoEmptyTestSuitesProblemDescription; + } + + @Override + public boolean hasError(Object obj) { + if (obj instanceof ITestSuitePO) { + ITestSuitePO ts = (ITestSuitePO) obj; + if (ts.getNodeListSize() == 0) { + return true; + } + } + return false; + } +} diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/i18n/Messages.java b/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/i18n/Messages.java new file mode 100644 index 000000000..85292749c --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/i18n/Messages.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2004, 2012 BREDEX GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * BREDEX GmbH - initial API and implementation and/or initial documentation + *******************************************************************************/ +package org.eclipse.jubula.client.teststyle.impl.standard.i18n; + +import org.eclipse.osgi.util.NLS; + +/** + * @author BREDEX GmbH + * @created 10.12.2010 + */ +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.jubula.client.teststyle.impl.standard.i18n.messages"; //$NON-NLS-1$ + + public static String NoEmptyTestSuitesProblemDescription; + public static String TestSuiteHasAUTProblemDescription; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + /** + * Constructor + */ + private Messages() { + // hide + } +} diff --git a/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/i18n/messages.properties b/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/i18n/messages.properties new file mode 100644 index 000000000..a18afec88 --- /dev/null +++ b/org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/i18n/messages.properties @@ -0,0 +1,9 @@ +############################################################################### +# Copyright (c) 2004, 2012 BREDEX GmbH. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## +TestSuiteHasAUTProblemDescription=Each Test Suite requires an AUT setting for Execution. +NoEmptyTestSuitesProblemDescription=Add specified Test Cases to Test Suite.
\ No newline at end of file |