From 2f86e0d0c5ade922157bbb157060ecaeb5ddaa1f Mon Sep 17 00:00:00 2001 From: Markus Tiede Date: Mon, 27 Feb 2012 09:04:03 +0100 Subject: Sprint task - migrate initial checks from ProblemsBP to new teststyle framework. --- .../.checkstyle | 10 +++++ .../.classpath | 7 ++++ .../.gitignore | 2 + .../.project | 34 +++++++++++++++++ .../.settings/org.eclipse.jdt.core.prefs | 8 ++++ .../META-INF/MANIFEST.MF | 13 +++++++ .../about.html | 28 ++++++++++++++ .../build.properties | 5 +++ .../plugin.xml | 39 ++++++++++++++++++++ .../pom.xml | 22 +++++++++++ .../client/teststyle/impl/standard/Activator.java | 41 +++++++++++++++++++++ .../impl/standard/checks/TestSuiteHasAUT.java | 43 ++++++++++++++++++++++ .../impl/standard/checks/TestSuiteNotEmpty.java | 36 ++++++++++++++++++ .../teststyle/impl/standard/i18n/Messages.java | 36 ++++++++++++++++++ .../impl/standard/i18n/messages.properties | 9 +++++ 15 files changed, 333 insertions(+) create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/.checkstyle create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/.classpath create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/.gitignore create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/.project create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/META-INF/MANIFEST.MF create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/about.html create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/build.properties create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/plugin.xml create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/pom.xml create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/Activator.java create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/checks/TestSuiteHasAUT.java create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/checks/TestSuiteNotEmpty.java create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/i18n/Messages.java create mode 100644 org.eclipse.jubula.client.teststyle.impl.standard/src/org/eclipse/jubula/client/teststyle/impl/standard/i18n/messages.properties (limited to 'org.eclipse.jubula.client.teststyle.impl.standard') 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 @@ + + + + + + + + + + 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 @@ + + + + + + + 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 @@ + + + org.eclipse.jubula.client.teststyle.impl.standard + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + net.sf.eclipsecs.core.CheckstyleBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + net.sf.eclipsecs.core.CheckstyleNature + + 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 @@ + + + + +About + + +

About This Content

+ +

June 22, 2011

+

License

+ +

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 http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

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 http://www.eclipse.org.

+ + + 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 @@ + + + + + + + + + + + + + + + + + + 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 @@ + + + + 4.0.0 + + org.eclipse.jubula.releng.client + org.eclipse.jubula + 1.2.0-SNAPSHOT + ../org.eclipse.jubula.releng.client + + org.eclipse.jubula + org.eclipse.jubula.client.teststyle.impl.standard + 1.2.0-SNAPSHOT + eclipse-plugin + 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 -- cgit v1.2.1