From be6a71b95ce1820a44a074ae5c02acb83aea5e8a Mon Sep 17 00:00:00 2001 From: Amit Kumar Mondal Date: Tue, 24 May 2016 13:35:54 +0200 Subject: [PATCH 1/3] Following Changes incorporated 1. Added New POM File - Compatible for relesing to Maven Central 2. Moved Test cases to the same bundle (src/test/java) 3. Corrected Package Name Typo 4. Extracted all annotations from the BundleTestSuite because of compilation problem in Maven Compiler Plugin 5. Source Folder changed from src to src/main/java 6. Modified BundleTestSuite javadoc to eliminate javadoc plugin compilation problem 7. Removed releng dependency 8. Modified README.md to incorporate future Maven Central Dependency Signed-off-by: Amit Kumar Mondal --- com.codeaffine.osgi.testsuite.releng/.project | 11 -- .../OSGi Testsuite Tycho Build.launch | 17 -- .../org.eclipse.core.resources.prefs | 2 - .../.settings/org.eclipse.core.runtime.prefs | 2 - .../equinox.target | 19 -- .../feature/build.properties | 12 -- .../feature/feature.xml | 49 ----- .../feature/license.html | 108 ----------- .../feature/pom.xml | 16 -- com.codeaffine.osgi.testsuite.releng/pom.xml | 166 ---------------- .../repository/category.xml | 20 -- .../repository/pom.xml | 106 ----------- .../repository/rootfiles/index.html | 20 -- com.codeaffine.osgi.testsuite/.classpath | 26 ++- com.codeaffine.osgi.testsuite/.project | 6 + .../org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.m2e.core.prefs | 4 + .../META-INF/MANIFEST.MF | 2 +- com.codeaffine.osgi.testsuite/pom.xml | 178 ++++++++++++++++-- .../osgi/testsuite}/BundleTestSuite.java | 75 ++------ .../osgi/testsuite/ClassnameFilters.java | 26 +++ .../osgi/testsuite/TestBundles.java | 33 ++++ .../internal/BundleTestCollector.java | 10 +- .../testsuite}/internal/ClassPathScanner.java | 2 +- .../testsuite}/internal/ClassnameFilter.java | 2 +- .../internal/DevPropertiesLoader.java | 2 +- .../testsuite}/internal/TestCollector.java | 6 +- .../osgi/testsuite/BundleTestSuiteTest.java | 79 ++++++++ .../internal/BundleTestCollectorTest.java | 71 +++++++ .../internal/ClassPathScannerTest.java | 151 +++++++++++++++ .../internal/ClassnameFilterTest.java | 77 ++++++++ .../internal/DevPropertiesLoaderTest.java | 112 +++++++++++ .../testsuite/internal/TestCollectorTest.java | 120 ++++++++++++ 33 files changed, 889 insertions(+), 644 deletions(-) delete mode 100644 com.codeaffine.osgi.testsuite.releng/.project delete mode 100644 com.codeaffine.osgi.testsuite.releng/.settings/OSGi Testsuite Tycho Build.launch delete mode 100644 com.codeaffine.osgi.testsuite.releng/.settings/org.eclipse.core.resources.prefs delete mode 100644 com.codeaffine.osgi.testsuite.releng/.settings/org.eclipse.core.runtime.prefs delete mode 100644 com.codeaffine.osgi.testsuite.releng/equinox.target delete mode 100644 com.codeaffine.osgi.testsuite.releng/feature/build.properties delete mode 100644 com.codeaffine.osgi.testsuite.releng/feature/feature.xml delete mode 100644 com.codeaffine.osgi.testsuite.releng/feature/license.html delete mode 100644 com.codeaffine.osgi.testsuite.releng/feature/pom.xml delete mode 100644 com.codeaffine.osgi.testsuite.releng/pom.xml delete mode 100644 com.codeaffine.osgi.testsuite.releng/repository/category.xml delete mode 100644 com.codeaffine.osgi.testsuite.releng/repository/pom.xml delete mode 100644 com.codeaffine.osgi.testsuite.releng/repository/rootfiles/index.html delete mode 100644 com.codeaffine.osgi.testsuite/.settings/org.eclipse.core.resources.prefs create mode 100644 com.codeaffine.osgi.testsuite/.settings/org.eclipse.m2e.core.prefs rename com.codeaffine.osgi.testsuite/src/{com/codeaffine/osgi/testuite => main/java/com/codeaffine/osgi/testsuite}/BundleTestSuite.java (63%) create mode 100644 com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/ClassnameFilters.java create mode 100644 com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/TestBundles.java rename com.codeaffine.osgi.testsuite/src/{com/codeaffine/osgi/testuite => main/java/com/codeaffine/osgi/testsuite}/internal/BundleTestCollector.java (88%) rename com.codeaffine.osgi.testsuite/src/{com/codeaffine/osgi/testuite => main/java/com/codeaffine/osgi/testsuite}/internal/ClassPathScanner.java (98%) rename com.codeaffine.osgi.testsuite/src/{com/codeaffine/osgi/testuite => main/java/com/codeaffine/osgi/testsuite}/internal/ClassnameFilter.java (98%) rename com.codeaffine.osgi.testsuite/src/{com/codeaffine/osgi/testuite => main/java/com/codeaffine/osgi/testsuite}/internal/DevPropertiesLoader.java (97%) rename com.codeaffine.osgi.testsuite/src/{com/codeaffine/osgi/testuite => main/java/com/codeaffine/osgi/testsuite}/internal/TestCollector.java (92%) create mode 100644 com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/BundleTestSuiteTest.java create mode 100644 com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/BundleTestCollectorTest.java create mode 100644 com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/ClassPathScannerTest.java create mode 100644 com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/ClassnameFilterTest.java create mode 100644 com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/DevPropertiesLoaderTest.java create mode 100644 com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/TestCollectorTest.java diff --git a/com.codeaffine.osgi.testsuite.releng/.project b/com.codeaffine.osgi.testsuite.releng/.project deleted file mode 100644 index 5fe0fac..0000000 --- a/com.codeaffine.osgi.testsuite.releng/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - com.codeaffine.osgi.testsuite.releng - - - - - - - - diff --git a/com.codeaffine.osgi.testsuite.releng/.settings/OSGi Testsuite Tycho Build.launch b/com.codeaffine.osgi.testsuite.releng/.settings/OSGi Testsuite Tycho Build.launch deleted file mode 100644 index b89b481..0000000 --- a/com.codeaffine.osgi.testsuite.releng/.settings/OSGi Testsuite Tycho Build.launch +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/com.codeaffine.osgi.testsuite.releng/.settings/org.eclipse.core.resources.prefs b/com.codeaffine.osgi.testsuite.releng/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0..0000000 --- a/com.codeaffine.osgi.testsuite.releng/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/com.codeaffine.osgi.testsuite.releng/.settings/org.eclipse.core.runtime.prefs b/com.codeaffine.osgi.testsuite.releng/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22..0000000 --- a/com.codeaffine.osgi.testsuite.releng/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/com.codeaffine.osgi.testsuite.releng/equinox.target b/com.codeaffine.osgi.testsuite.releng/equinox.target deleted file mode 100644 index 2701d3a..0000000 --- a/com.codeaffine.osgi.testsuite.releng/equinox.target +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/com.codeaffine.osgi.testsuite.releng/feature/build.properties b/com.codeaffine.osgi.testsuite.releng/feature/build.properties deleted file mode 100644 index 82bfcca..0000000 --- a/com.codeaffine.osgi.testsuite.releng/feature/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2012, 2013, 2014 Rüdiger Herrmann. -# 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: -# Rüdiger Herrmann - initial API and implementation -################################################################################ - -bin.includes = feature.xml,license.html \ No newline at end of file diff --git a/com.codeaffine.osgi.testsuite.releng/feature/feature.xml b/com.codeaffine.osgi.testsuite.releng/feature/feature.xml deleted file mode 100644 index 9478fd6..0000000 --- a/com.codeaffine.osgi.testsuite.releng/feature/feature.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - The OSGi Test Suite runs all JUnit tests in a given list of bundles. - For example: - @RunWith( BundleTestSuite.class ) - @TestBundles( { "org.example.bundle1", "org.example.bundle2" } ) - public class AllTestSuite { - } - - - - Copyright 2013, 2014 RĂ¼diger Herrmann - - - - - - - - - - - diff --git a/com.codeaffine.osgi.testsuite.releng/feature/license.html b/com.codeaffine.osgi.testsuite.releng/feature/license.html deleted file mode 100644 index f19c483..0000000 --- a/com.codeaffine.osgi.testsuite.releng/feature/license.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

February 1, 2011

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/com.codeaffine.osgi.testsuite.releng/feature/pom.xml b/com.codeaffine.osgi.testsuite.releng/feature/pom.xml deleted file mode 100644 index ed104e2..0000000 --- a/com.codeaffine.osgi.testsuite.releng/feature/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - - - com.codeaffine.osgi.testsuite - com.codeaffine.osgi.testsuite.parent - 1.2.0-SNAPSHOT - - - com.codeaffine.osgi.testsuite.feature - eclipse-feature - - diff --git a/com.codeaffine.osgi.testsuite.releng/pom.xml b/com.codeaffine.osgi.testsuite.releng/pom.xml deleted file mode 100644 index 74e33e7..0000000 --- a/com.codeaffine.osgi.testsuite.releng/pom.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - 4.0.0 - - Automated OSGi Test Suite - - com.codeaffine.osgi.testsuite - com.codeaffine.osgi.testsuite.parent - 1.2.0-SNAPSHOT - pom - - - 0.23.0 - 0.23.0 - 2.19 - UTF-8 - scm:git:https://github.com/rherrmann/osgi-testsuite.git - - - - 3.0 - - - - feature - repository - ../com.codeaffine.osgi.testsuite - ../com.codeaffine.osgi.testsuite.test - - - - - repo.eclipse.org - https://repo.eclipse.org/content/repositories/releases/ - - - - - - - - org.eclipse.tycho - target-platform-configuration - ${tycho-version} - - - - com.codeaffine.osgi.testsuite - com.codeaffine.osgi.testsuite.parent - 1.2.0-SNAPSHOT - equinox - - - - - - - org.eclipse.tycho - tycho-maven-plugin - ${tycho-version} - true - - - - org.eclipse.tycho - tycho-packaging-plugin - ${tycho-version} - - - org.eclipse.tycho.extras - tycho-sourceref-jgit - ${tycho-extras-version} - - - - yyyyMMdd-HHmm - - true - - - - - - org.eclipse.tycho - tycho-source-plugin - ${tycho-version} - - - plugin-source - - plugin-source - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${surefire-version} - - - org.apache.maven.surefire - surefire-junit47 - ${surefire-version} - - - - - test - test - - ${project.build.outputDirectory} - - **/*Test.java - - - - - random - - - test - - - - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - 1.14 - - - org.codehaus.mojo.signature - java15 - 1.0 - - - - - ensure-java-1.5-class-library - test - - check - - - - - - - - - diff --git a/com.codeaffine.osgi.testsuite.releng/repository/category.xml b/com.codeaffine.osgi.testsuite.releng/repository/category.xml deleted file mode 100644 index 517b014..0000000 --- a/com.codeaffine.osgi.testsuite.releng/repository/category.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - diff --git a/com.codeaffine.osgi.testsuite.releng/repository/pom.xml b/com.codeaffine.osgi.testsuite.releng/repository/pom.xml deleted file mode 100644 index 926455c..0000000 --- a/com.codeaffine.osgi.testsuite.releng/repository/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - 4.0.0 - - - com.codeaffine.osgi.testsuite - com.codeaffine.osgi.testsuite.parent - 1.2.0-SNAPSHOT - - - com.codeaffine.osgi.testsuite.repository - eclipse-repository - - - - - org.eclipse.tycho - tycho-p2-repository-plugin - ${tycho-version} - - OSGi Test Suite Software Repository - false - true - - - - - maven-resources-plugin - 2.6 - - - copy-resources - package - - copy-resources - - - UTF-8 - ${basedir}/target/repository - - - rootfiles - false - - - - - - - - - org.eclipse.tycho.extras - tycho-eclipserun-plugin - ${tycho-extras-version} - - - add-repo-properties - - eclipse-run - - package - - -application org.eclipse.wtp.releng.tools.addRepoProperties - - -DartifactRepoDirectory=${project.build.directory}/repository - -Dp2StatsURI=http://www.codeaffine.com/p2-stats - -DstatsTrackedArtifacts=com.codeaffine.osgi.testsuite.feature - -DstatsArtifactsSuffix=-${project.version} - - - - org.eclipse.wtp.releng.tools.feature - eclipse-feature - - - - - http://download.eclipse.org/webtools/releng/repository - p2 - - - http://download.eclipse.org/releases/kepler - p2 - - - - - - - - - - - diff --git a/com.codeaffine.osgi.testsuite.releng/repository/rootfiles/index.html b/com.codeaffine.osgi.testsuite.releng/repository/rootfiles/index.html deleted file mode 100644 index c829eec..0000000 --- a/com.codeaffine.osgi.testsuite.releng/repository/rootfiles/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Automated OSGi Test Suite Repository - - - -

Automated OSGi Test Suite Repository

-

- This is the software repository that contains the latest stable build for the - Automated OSGi Test Suite. -

- - diff --git a/com.codeaffine.osgi.testsuite/.classpath b/com.codeaffine.osgi.testsuite/.classpath index 64c5e31..37a5a32 100644 --- a/com.codeaffine.osgi.testsuite/.classpath +++ b/com.codeaffine.osgi.testsuite/.classpath @@ -1,7 +1,27 @@ - + + + + + + + + + + + + + + + + + - - + + + + + + diff --git a/com.codeaffine.osgi.testsuite/.project b/com.codeaffine.osgi.testsuite/.project index 61905de..7c66256 100644 --- a/com.codeaffine.osgi.testsuite/.project +++ b/com.codeaffine.osgi.testsuite/.project @@ -20,8 +20,14 @@ + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.m2e.core.maven2Nature org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature diff --git a/com.codeaffine.osgi.testsuite/.settings/org.eclipse.core.resources.prefs b/com.codeaffine.osgi.testsuite/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 2a233c7..0000000 --- a/com.codeaffine.osgi.testsuite/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Fri Jan 06 22:50:00 CET 2012 -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/com.codeaffine.osgi.testsuite/.settings/org.eclipse.m2e.core.prefs b/com.codeaffine.osgi.testsuite/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/com.codeaffine.osgi.testsuite/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/com.codeaffine.osgi.testsuite/META-INF/MANIFEST.MF b/com.codeaffine.osgi.testsuite/META-INF/MANIFEST.MF index 354cbc3..ebd1607 100644 --- a/com.codeaffine.osgi.testsuite/META-INF/MANIFEST.MF +++ b/com.codeaffine.osgi.testsuite/META-INF/MANIFEST.MF @@ -12,5 +12,5 @@ Import-Package: org.junit;version="[4.8.0,5.0.0)", org.junit.runners.model;version="[4.8.0,5.0.0)", org.osgi.framework;version="[1.3.0,2.0.0)", org.osgi.framework.wiring;version="[1.0.0,2.0.0)" -Export-Package: com.codeaffine.osgi.testuite;version="1.2.0" +Export-Package: com.codeaffine.osgi.testsuite;version="1.2.0" Bundle-ActivationPolicy: lazy diff --git a/com.codeaffine.osgi.testsuite/pom.xml b/com.codeaffine.osgi.testsuite/pom.xml index d2549a1..37ee83e 100644 --- a/com.codeaffine.osgi.testsuite/pom.xml +++ b/com.codeaffine.osgi.testsuite/pom.xml @@ -9,21 +9,167 @@ Contributors: RĂ¼diger Herrmann - initial implementation --> - - 4.0.0 - - com.codeaffine.osgi.testsuite - com.codeaffine.osgi.testsuite - 1.2.0-SNAPSHOT - eclipse-plugin - - - com.codeaffine.osgi.testsuite - com.codeaffine.osgi.testsuite.parent - 1.2.0-SNAPSHOT - ../com.codeaffine.osgi.testsuite.releng/pom.xml - + + 4.0.0 + com.codeaffine.osgi.testsuite + com.codeaffine.osgi.testsuite + 1.2.0-SNAPSHOT + jar + + + + Eclipse Public License - Version 1 + https://www.eclipse.org/legal/epl-v10.html + + + + + + RĂ¼diger Herrmann + rherrmann@codeaffine.com + codeaffine + http://codeaffine.com + + + Frank Appel + fappel@codeaffine.com + codeaffine + http://codeaffine.com + + + + + scm:git:git@github.com:rherrmann/osgi-testsuite.git + scm:git:git@github.com:rherrmann/osgi-testsuite.git + git@github.com:rherrmann/osgi-testsuite.git + + + + + oss.sonatype.org + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + oss.sonatype.org + https://oss.sonatype.org/content/repositories/snapshots + + + + + + junit + junit + 4.11 + + + org.eclipse.tycho + org.eclipse.osgi + 3.9.0.v20130529-1710 + + + org.mockito + mockito-core + 1.8.1 + + + + + src/main/java + + + maven-compiler-plugin + 3.5.1 + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.0 + + + ./META-INF/MANIFEST.MF + + + + + maven-deploy-plugin + 2.7 + + true + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.0 + + + attach-sources + + jar + + + + + + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.codehaus.mojo + versions-maven-plugin + 2.1 + + false + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.6 + true + + oss.sonatype.org + https://oss.sonatype.org/ + + + + deploy-to-sonatype + deploy + + deploy + release + + + + + + diff --git a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/BundleTestSuite.java b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/BundleTestSuite.java similarity index 63% rename from com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/BundleTestSuite.java rename to com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/BundleTestSuite.java index dfe4498..d60113d 100644 --- a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/BundleTestSuite.java +++ b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/BundleTestSuite.java @@ -9,16 +9,10 @@ * RĂ¼diger Herrmann - initial API and implementation * Frank Appel - ClassnameFilters ******************************************************************************/ -package com.codeaffine.osgi.testuite; +package com.codeaffine.osgi.testsuite; -import static com.codeaffine.osgi.testuite.BundleTestSuite.ClassnameFilters.DEFAULT_CLASSNAME_FILTERS; -import static com.codeaffine.osgi.testuite.BundleTestSuite.NoMatchPolicy.IGNORE; import static java.lang.String.format; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; import java.util.regex.Pattern; import org.junit.runner.RunWith; @@ -30,7 +24,7 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; -import com.codeaffine.osgi.testuite.internal.TestCollector; +import com.codeaffine.osgi.testsuite.internal.TestCollector; /** * The BundleTestSuite test runner can be used to run all tests within a given number of OSGi @@ -42,12 +36,12 @@ *

*

* Example: - *

- *   @RunWith( BundleTestSuite.class )
- *   @TestBundles( { "org.example.bundle1", "org.example.bundle2" } )
+ * 
+ *   @RunWith( BundleTestSuite.class )
+ *   @TestBundles( { "org.example.bundle1", "org.example.bundle2" } )
  *   public class MasterTestSuite {
  *   }
- * 
+ * *

* *

@@ -57,13 +51,13 @@ *

*

* Example: - *

- *   @RunWith( BundleTestSuite.class )
- *   @TestBundles( { "org.example.bundle1", "org.example.bundle2" } )
- *   @ClassnameFilters( { ".*IntegrationTest", "!.*FooIntegrationTest" } )
+ * 
+ *   @RunWith( BundleTestSuite.class )
+ *   @TestBundles( { "org.example.bundle1", "org.example.bundle2" } )
+ *   @ClassnameFilters( { ".*IntegrationTest", "!.*FooIntegrationTest" } )
  *   public class IntegrationTestSuite {
  *   }
- * 
+ * * The example runs all test cases in bundle1 and bundle2 that are named with the postfix IntegrationTest * but exclude those with the postfix FooIntegrationTest. *

@@ -105,51 +99,6 @@ public enum NoMatchPolicy { FAIL } - /** - * The TestBundles annotation specifies the bundles to be scanned for test classes - * when a class annotated with @RunWith(BundleTestSuite.class) is run. - * - *

A test class is identified by its name. All public classes whose names end with 'Test' are - * considered test classes.

- */ - @Retention( RetentionPolicy.RUNTIME ) - @Target( ElementType.TYPE ) - public @interface TestBundles { - - /** - * @return the synblic names of the bundles that should be scanned for tests - */ - String[] value(); - - /** - * @return the policy that determines how bundles without matching tests are treated - * - * @see NoMatchPolicy - * @since 1.2 - */ - NoMatchPolicy noMatchPolicy() default IGNORE; - } - - /** - * The ClassnameFilters annotation specifies a set of regex expressions for all test - * classes (ie. their qualified names) to be included in a test run. When the annotation - * is missing, all test classes that matches the expression .*Test in all referred - * bundles and packages will be run. - * - *

Use a leading ! for an exclusion expression. Exclusion expressions can be use - * to prevent certain Tests from execution as in 'run all unit tests (".*Test") but - * not the integration tests ("!.*ITest")'. - *

- * @since 1.1 - */ - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.TYPE) - public @interface ClassnameFilters { - String[] DEFAULT_CLASSNAME_FILTERS = new String[] { ".*Test" }; - - public String[] value() default { ".*Test" }; - } - public BundleTestSuite( Class type ) throws InitializationError { super( type, getTestClasses( type ) ); } @@ -176,7 +125,7 @@ private static void checkAnnotationExists( Class type, TestBundles testBundle } private static String[] readFilterPatterns( Class type ) { - String[] result = DEFAULT_CLASSNAME_FILTERS; + String[] result = ClassnameFilters.DEFAULT_CLASSNAME_FILTERS; if( type.getAnnotation( ClassnameFilters.class ) != null ) { result = type.getAnnotation( ClassnameFilters.class ).value(); } diff --git a/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/ClassnameFilters.java b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/ClassnameFilters.java new file mode 100644 index 0000000..dc57b93 --- /dev/null +++ b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/ClassnameFilters.java @@ -0,0 +1,26 @@ +package com.codeaffine.osgi.testsuite; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * The ClassnameFilters annotation specifies a set of regex expressions for all test + * classes (ie. their qualified names) to be included in a test run. When the annotation + * is missing, all test classes that matches the expression .*Test in all referred + * bundles and packages will be run. + * + *

Use a leading ! for an exclusion expression. Exclusion expressions can be use + * to prevent certain Tests from execution as in 'run all unit tests (".*Test") but + * not the integration tests ("!.*ITest")'. + *

+ * @since 1.1 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface ClassnameFilters { + String[] DEFAULT_CLASSNAME_FILTERS = new String[] { ".*Test" }; + + public String[] value() default { ".*Test" }; +} \ No newline at end of file diff --git a/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/TestBundles.java b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/TestBundles.java new file mode 100644 index 0000000..ed05672 --- /dev/null +++ b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/TestBundles.java @@ -0,0 +1,33 @@ +package com.codeaffine.osgi.testsuite; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import com.codeaffine.osgi.testsuite.BundleTestSuite.NoMatchPolicy; + +/** + * The TestBundles annotation specifies the bundles to be scanned for test classes + * when a class annotated with @RunWith(BundleTestSuite.class) is run. + * + *

A test class is identified by its name. All public classes whose names end with 'Test' are + * considered test classes.

+ */ +@Retention( RetentionPolicy.RUNTIME ) +@Target( ElementType.TYPE ) +public @interface TestBundles { + + /** + * @return the synblic names of the bundles that should be scanned for tests + */ + String[] value(); + + /** + * @return the policy that determines how bundles without matching tests are treated + * + * @see NoMatchPolicy + * @since 1.2 + */ + NoMatchPolicy noMatchPolicy() default NoMatchPolicy.IGNORE; +} \ No newline at end of file diff --git a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/BundleTestCollector.java b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/BundleTestCollector.java similarity index 88% rename from com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/BundleTestCollector.java rename to com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/BundleTestCollector.java index 6dcf4f5..d32fc59 100644 --- a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/BundleTestCollector.java +++ b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/BundleTestCollector.java @@ -9,7 +9,7 @@ * RĂ¼diger Herrmann - initial API and implementation * Frank Appel - ClassnameFilters ******************************************************************************/ -package com.codeaffine.osgi.testuite.internal; +package com.codeaffine.osgi.testsuite.internal; import java.util.Properties; @@ -17,14 +17,17 @@ import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; - public class BundleTestCollector { + private final ClassnameFilter classnameFilter; private final String bundleSymbolicName; private final BundleContext bundleContext; private final Properties devProperties; - public BundleTestCollector( BundleContext bundleContext, String bundleSymbolicName, String[] filterPatterns ) { + public BundleTestCollector( BundleContext bundleContext, + String bundleSymbolicName, + String[] filterPatterns ) + { this.bundleContext = bundleContext; this.bundleSymbolicName = bundleSymbolicName; this.classnameFilter = new ClassnameFilter( filterPatterns ); @@ -48,5 +51,4 @@ private Bundle getBundle() throws InitializationError { } return result; } - } \ No newline at end of file diff --git a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/ClassPathScanner.java b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/ClassPathScanner.java similarity index 98% rename from com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/ClassPathScanner.java rename to com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/ClassPathScanner.java index 52edf07..52e6ee4 100644 --- a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/ClassPathScanner.java +++ b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/ClassPathScanner.java @@ -9,7 +9,7 @@ * RĂ¼diger Herrmann - initial API and implementation * Frank Appel - ClassnameFilters ******************************************************************************/ -package com.codeaffine.osgi.testuite.internal; +package com.codeaffine.osgi.testsuite.internal; import java.util.ArrayList; import java.util.Arrays; diff --git a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/ClassnameFilter.java b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/ClassnameFilter.java similarity index 98% rename from com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/ClassnameFilter.java rename to com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/ClassnameFilter.java index 7bd0775..f738903 100644 --- a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/ClassnameFilter.java +++ b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/ClassnameFilter.java @@ -8,7 +8,7 @@ * Contributors: * Frank Appel - ClassnameFilters ******************************************************************************/ -package com.codeaffine.osgi.testuite.internal; +package com.codeaffine.osgi.testsuite.internal; import java.util.ArrayList; import java.util.Collection; diff --git a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/DevPropertiesLoader.java b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/DevPropertiesLoader.java similarity index 97% rename from com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/DevPropertiesLoader.java rename to com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/DevPropertiesLoader.java index 77d3eb5..f6357a3 100644 --- a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/DevPropertiesLoader.java +++ b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/DevPropertiesLoader.java @@ -8,7 +8,7 @@ * Contributors: * RĂ¼diger Herrmann - initial API and implementation ******************************************************************************/ -package com.codeaffine.osgi.testuite.internal; +package com.codeaffine.osgi.testsuite.internal; import java.io.IOException; import java.io.InputStream; diff --git a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/TestCollector.java b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/TestCollector.java similarity index 92% rename from com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/TestCollector.java rename to com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/TestCollector.java index 17e472d..9ec11e9 100644 --- a/com.codeaffine.osgi.testsuite/src/com/codeaffine/osgi/testuite/internal/TestCollector.java +++ b/com.codeaffine.osgi.testsuite/src/main/java/com/codeaffine/osgi/testsuite/internal/TestCollector.java @@ -1,4 +1,4 @@ -package com.codeaffine.osgi.testuite.internal; +package com.codeaffine.osgi.testsuite.internal; import static java.lang.String.format; import static java.util.Arrays.asList; @@ -10,8 +10,8 @@ import org.junit.runners.model.InitializationError; import org.osgi.framework.BundleContext; -import com.codeaffine.osgi.testuite.BundleTestSuite.NoMatchPolicy; -import com.codeaffine.osgi.testuite.BundleTestSuite.TestBundles; +import com.codeaffine.osgi.testsuite.BundleTestSuite.NoMatchPolicy; +import com.codeaffine.osgi.testsuite.TestBundles; public class TestCollector { diff --git a/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/BundleTestSuiteTest.java b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/BundleTestSuiteTest.java new file mode 100644 index 0000000..828d7b2 --- /dev/null +++ b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/BundleTestSuiteTest.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2012, 2013, 2014 RĂ¼diger Herrmann. + * 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: + * RĂ¼diger Herrmann - initial API and implementation + * Frank Appel - ClassnameFilters + ******************************************************************************/ +package com.codeaffine.osgi.testsuite; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.lang.reflect.Constructor; +import java.util.regex.PatternSyntaxException; + +import org.junit.Test; +import org.junit.runners.model.InitializationError; + +public class BundleTestSuiteTest { + + @Test + public void testConstructorSatisfiesJUnitRequirements() throws Exception { + Constructor constructor = BundleTestSuite.class.getConstructor( Class.class ); + + BundleTestSuite instance = constructor.newInstance( EmptyBundleTestSuite.class ); + + assertNotNull( instance ); + } + + @Test + public void testConstructorWithValidSuite() throws InitializationError { + BundleTestSuite bundleTestSuite = new BundleTestSuite( EmptyBundleTestSuite.class ); + + assertEquals( EmptyBundleTestSuite.class, bundleTestSuite.getTestClass().getJavaClass() ); + } + + @Test + public void testConstructorWithValidPatternSuite() throws InitializationError { + BundleTestSuite bundleTestSuite = new BundleTestSuite( ValidPatternTestSuite.class ); + + assertEquals( ValidPatternTestSuite.class, bundleTestSuite.getTestClass().getJavaClass() ); + } + + @Test + public void testConstructorWithInvalidSuite() throws Exception { + try { + new BundleTestSuite( InvalidBundleTestSuite.class ); + fail(); + } catch( InitializationError expected ) { + String message = expected.getCauses().get( 0 ).getMessage(); + assertTrue( message.contains( InvalidBundleTestSuite.class.getName() ) ); + } + } + + @Test + public void testConstructorWithInvalidPatternSuite() throws Exception { + try { + new BundleTestSuite( InvalidPatternTestSuite.class ); + fail(); + } catch( PatternSyntaxException expected ) { + } + } + + public static class InvalidBundleTestSuite {} + @TestBundles({}) + public static class EmptyBundleTestSuite {} + @TestBundles( {} ) + @ClassnameFilters( { "*" } ) + public static class InvalidPatternTestSuite {} + @TestBundles( {} ) + @ClassnameFilters( { ".*Foo" } ) + public static class ValidPatternTestSuite {} +} diff --git a/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/BundleTestCollectorTest.java b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/BundleTestCollectorTest.java new file mode 100644 index 0000000..30a39d9 --- /dev/null +++ b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/BundleTestCollectorTest.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2012, 2013, 2014 RĂ¼diger Herrmann. + * 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: + * RĂ¼diger Herrmann - initial API and implementation + * Frank Appel - ClassnameFilters + ******************************************************************************/ +package com.codeaffine.osgi.testsuite.internal; + +import static com.codeaffine.osgi.testsuite.ClassnameFilters.DEFAULT_CLASSNAME_FILTERS; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runners.model.InitializationError; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.wiring.BundleWiring; + + +public class BundleTestCollectorTest { + + private BundleContext bundleContext; + + @Test + public void testCollectWithNonExistingBundle() { + String nonExistingBundle = "no.bundle"; + BundleTestCollector collector = new BundleTestCollector( bundleContext, nonExistingBundle, DEFAULT_CLASSNAME_FILTERS ); + + try { + collector.collect(); + fail(); + } catch( InitializationError expected ) { + assertTrue( expected.getCauses().get( 0 ).getMessage().contains( nonExistingBundle ) ); + } + } + + @Test + public void testCollectWithExistingBundle() throws InitializationError { + String bundle = createBundle().getSymbolicName(); + + BundleTestCollector collector = new BundleTestCollector( bundleContext, bundle, DEFAULT_CLASSNAME_FILTERS ); + Class[] classes = collector.collect(); + + assertEquals( 0, classes.length ); + } + + @Before + public void setUp() { + bundleContext = mock( BundleContext.class ); + when( bundleContext.getBundles() ).thenReturn( new Bundle[ 0 ] ); + } + + private Bundle createBundle() { + Bundle result = mock( Bundle.class ); + when( result.getSymbolicName() ).thenReturn( "bundle.symbolic.name" ); + BundleWiring bundleWiring = mock( BundleWiring.class ); + when( result.adapt( BundleWiring.class ) ).thenReturn( bundleWiring ); + when( bundleContext.getBundles() ).thenReturn( new Bundle[] { result } ); + return result; + } + +} diff --git a/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/ClassPathScannerTest.java b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/ClassPathScannerTest.java new file mode 100644 index 0000000..67197a5 --- /dev/null +++ b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/ClassPathScannerTest.java @@ -0,0 +1,151 @@ +/******************************************************************************* + * Copyright (c) 2012, 2013, 2014 RĂ¼diger Herrmann. + * 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: + * RĂ¼diger Herrmann - initial API and implementation + * Frank Appel - ClassnameFilters + ******************************************************************************/ +package com.codeaffine.osgi.testsuite.internal; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runners.model.InitializationError; +import org.osgi.framework.Bundle; +import org.osgi.framework.wiring.BundleWiring; + +public class ClassPathScannerTest { + + private Bundle bundle; + private Properties devProperties; + private ClassnameFilter classnameFilter; + + @Test + public void testScanWithoutDevProperties() throws Exception { + addTestResource( bundle, FooTest.class.getName(), FooTest.class ); + + ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); + Class[] classes = scanner.scan(); + + assertArrayEquals( new Class[] { FooTest.class }, classes ); + } + + @Test + public void testScanWithNonMatchingDevProperties() throws Exception { + addTestResource( bundle, FooTest.class.getName(), FooTest.class ); + devProperties.setProperty( "some.bogus.bundle.name", "bin" ); + + ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); + Class[] classes = scanner.scan(); + + assertArrayEquals( new Class[] { FooTest.class }, classes ); + } + + @Test + public void testScanWithBundleSpecificClassPathRoot() throws Exception { + addTestResource( bundle, "bin/" + FooTest.class.getName(), FooTest.class ); + devProperties.setProperty( bundle.getSymbolicName(), "bin" ); + + ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); + Class[] classes = scanner.scan(); + + assertArrayEquals( new Class[] { FooTest.class }, classes ); + } + + @Test + public void testScanWithGeneralClassPathRoot() throws Exception { + addTestResource( bundle, "bin/" + FooTest.class.getName(), FooTest.class ); + devProperties.setProperty( "*", "bin" ); + + ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); + Class[] classes = scanner.scan(); + + assertArrayEquals( new Class[] { FooTest.class }, classes ); + } + + @Test + public void testScanWithNonMatchingFilter() throws Exception { + addTestResource( bundle, "bin/" + Foo.class.getName(), Foo.class ); +// devProperties.setProperty( "*", "bin" ); + + ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); + Class[] classes = scanner.scan(); + + assertArrayEquals( new Class[ 0 ], classes ); + } + + @Test + public void testScanWithNonExistingClass() throws ClassNotFoundException { + addTestResource( bundle, FooTest.class.getName(), FooTest.class ); + ClassNotFoundException classNotFoundException = new ClassNotFoundException(); + when( bundle.loadClass( anyString() ) ).thenThrow( classNotFoundException ); + ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); + + try { + scanner.scan(); + fail(); + } catch( InitializationError expected ) { + assertEquals( classNotFoundException, expected.getCauses().get( 0 ) ); + } + } + + @Test + public void testScanWithEmptyBundle() throws InitializationError { + ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); + + Class[] classes = scanner.scan(); + + assertEquals( 0, classes.length ); + } + + @Before + public void setUp() { + bundle = createBundle(); + devProperties = new Properties(); + classnameFilter = mockClassnameFilter(); + } + + private static Bundle createBundle() { + Bundle result = mock( Bundle.class ); + when( result.getSymbolicName() ).thenReturn( "bundle.symbolic.name" ); + BundleWiring bundleWiring = mock( BundleWiring.class ); + when( result.adapt( BundleWiring.class ) ).thenReturn( bundleWiring ); + return result; + } + + private static ClassnameFilter mockClassnameFilter() { + ClassnameFilter result = mock( ClassnameFilter.class ); + when( result.accept( FooTest.class.getName() ) ).thenReturn( true ); + return result; + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + private static void addTestResource( Bundle bundle, String resourceName, Class clazz ) + throws ClassNotFoundException + { + BundleWiring bundleWiring = bundle.adapt( BundleWiring.class ); + when( bundleWiring.listResources( anyString(), anyString(), anyInt() ) ) + .thenReturn( Arrays.asList( resourceName ) ); + when( bundle.loadClass( clazz.getName() ) ).thenReturn( clazz ); + } + + private static class Foo { + } + + private static class FooTest { + } +} \ No newline at end of file diff --git a/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/ClassnameFilterTest.java b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/ClassnameFilterTest.java new file mode 100644 index 0000000..c810bb6 --- /dev/null +++ b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/ClassnameFilterTest.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2012, 2013, 2014 RĂ¼diger Herrmann. + * 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: + * Frank Appel - ClassnameFilters + ******************************************************************************/ +package com.codeaffine.osgi.testsuite.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import com.codeaffine.osgi.testsuite.internal.ClassnameFilter; + +public class ClassnameFilterTest { + + @Test + public void testAccept() { + ClassnameFilter filter = new ClassnameFilter(); + + boolean actual = filter.accept( "com.codeaffine.Foo" ); + + assertTrue( actual ); + } + + @Test + public void testAcceptWithMatchingInclusionPattern() { + ClassnameFilter filter = new ClassnameFilter( ".*Foo" ); + + boolean actual = filter.accept( "com.codeaffine.Foo" ); + + assertTrue( actual ); + } + + @Test + public void testAcceptWithNonMatchingInclusionPattern() { + ClassnameFilter filter = new ClassnameFilter( ".*Foo" ); + + boolean actual = filter.accept( "com.codeaffine.Bar" ); + + assertFalse( actual ); + } + + @Test + public void testAcceptWithMatchingExclusionPattern() { + ClassnameFilter filter = new ClassnameFilter( "!.*Foo" ); + + boolean actual = filter.accept( "com.codeaffine.Foo" ); + + assertFalse( actual ); + } + + @Test + public void testAcceptWithNonMatchingExclusionPattern() { + ClassnameFilter filter = new ClassnameFilter( "!.*Foo" ); + + boolean actual = filter.accept( "com.codeaffine.Bar" ); + + assertTrue( actual ); + } + + @Test + public void testAcceptWithMultiplePatterns() { + ClassnameFilter filter = new ClassnameFilter( ".*", "!.*Foo" ); + + boolean excluded = filter.accept( "com.codeaffine.Foo" ); + boolean included = filter.accept( "com.codeaffine.Bar" ); + + assertFalse( excluded ); + assertTrue( included ); + } +} \ No newline at end of file diff --git a/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/DevPropertiesLoaderTest.java b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/DevPropertiesLoaderTest.java new file mode 100644 index 0000000..283a044 --- /dev/null +++ b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/DevPropertiesLoaderTest.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2012, 2013, 2014 RĂ¼diger Herrmann. + * 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: + * RĂ¼diger Herrmann - initial API and implementation + ******************************************************************************/ +package com.codeaffine.osgi.testsuite.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Properties; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.osgi.framework.BundleContext; + +import com.codeaffine.osgi.testsuite.internal.DevPropertiesLoader; + +public class DevPropertiesLoaderTest { + + @Rule + public TemporaryFolder tempFolder = new TemporaryFolder(); + + private BundleContext bundleContext; + + @Test + public void testLoadWithoutOsgiDevProperty() { + Properties properties = loadDevProperties(); + + assertEquals( 0, properties.size() ); + } + + @Test + public void testLoadWithEmptyOsgiDevProperty() { + when( bundleContext.getProperty( "osgi.dev" ) ).thenReturn( "" ); + + Properties properties = loadDevProperties(); + + assertEquals( 0, properties.size() ); + } + + @Test + public void testLoadWithNonExistingDevPropertiesFile() throws IOException { + setOsgiDevProperty(); + DevPropertiesLoader loader = new DevPropertiesLoader( bundleContext ); + + try { + loader.load(); + fail(); + } catch( RuntimeException expected ) { + assertTrue( expected.getCause() instanceof IOException ); + } + } + + @Test + public void testLoadWithDevProperties() throws IOException { + Properties properties = new Properties(); + properties.put( "foo", "bar" ); + storeDevProperties( properties ); + setOsgiDevProperty(); + + Properties loadedProperties = loadDevProperties(); + + assertEquals( properties, loadedProperties ); + } + + @Test + public void testLoadWithNullBundleContext() { + DevPropertiesLoader loader = new DevPropertiesLoader( null ); + + Properties properties = loader.load(); + + assertEquals( 0, properties.size() ); + } + + @Before + public void setUp() { + bundleContext = mock( BundleContext.class ); + } + + private Properties loadDevProperties() { + DevPropertiesLoader loader = new DevPropertiesLoader( bundleContext ); + return loader.load(); + } + + private void setOsgiDevProperty() throws IOException { + File file = new File( tempFolder.getRoot(), "dev.properties" ); + when( bundleContext.getProperty( "osgi.dev" ) ).thenReturn( file.toURI().toURL().toString() ); + } + + private void storeDevProperties( Properties properties ) throws IOException + { + File file = new File( tempFolder.getRoot(), "dev.properties" ); + OutputStream outputStream = new FileOutputStream( file ); + properties.store( outputStream, "" ); + outputStream.close(); + } +} diff --git a/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/TestCollectorTest.java b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/TestCollectorTest.java new file mode 100644 index 0000000..c5ae39b --- /dev/null +++ b/com.codeaffine.osgi.testsuite/src/test/java/com/codeaffine/osgi/testsuite/internal/TestCollectorTest.java @@ -0,0 +1,120 @@ +package com.codeaffine.osgi.testsuite.internal; + +import static com.codeaffine.osgi.testsuite.ClassnameFilters.DEFAULT_CLASSNAME_FILTERS; +import static com.codeaffine.osgi.testsuite.BundleTestSuite.NoMatchPolicy.FAIL; +import static com.codeaffine.osgi.testsuite.BundleTestSuite.NoMatchPolicy.IGNORE; +import static com.codeaffine.osgi.testsuite.BundleTestSuite.NoMatchPolicy.WARN; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runners.model.InitializationError; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.wiring.BundleWiring; + +import com.codeaffine.osgi.testsuite.TestBundles; + +public class TestCollectorTest { + + private static final String BUNDLE_SYMBOLIC_NAME = "bundle.symbolic.name"; + + private BundleContext bundleContext; + private ByteArrayOutputStream outputStream; + + @Test + public void testCollectWithDefaultNoMatchPolicy() throws InitializationError { + TestBundles testBundles = NoMatchTestSuite_DefaultPolicy.class.getAnnotation( TestBundles.class ); + + Class[] classes = collect( testBundles ); + + assertEquals( 0, classes.length ); + assertPrintStreamIsEmpty(); + } + + @Test + public void testCollectWithIgnoreNoMatchPolicy() throws InitializationError { + TestBundles testBundles = NoMatchTestSuite_IgnorePolicy.class.getAnnotation( TestBundles.class ); + + Class[] classes = collect( testBundles ); + + assertEquals( 0, classes.length ); + assertPrintStreamIsEmpty(); + } + + @Test + public void testCollectWithWarnNoMatchPolicy() throws InitializationError { + TestBundles testBundles = NoMatchTestSuite_WarnPolicy.class.getAnnotation( TestBundles.class ); + + Class[] classes = collect( testBundles ); + + assertEquals( 0, classes.length ); + assertPrintStreamIsNotEmpty(); + } + + @Test + public void testCollectWithFailNoMatchPolicy() { + TestBundles testBundles = NoMatchTestSuite_FailPolicy.class.getAnnotation( TestBundles.class ); + + try { + collect( testBundles ); + fail(); + } catch( InitializationError expected ) { + assertPrintStreamIsEmpty(); + } + + } + + @Before + public void setUp() { + bundleContext = createBundleContext(); + outputStream = new ByteArrayOutputStream(); + } + + private static BundleContext createBundleContext() { + BundleContext result = mock( BundleContext.class ); + Bundle bundle = mock( Bundle.class ); + when( bundle.getSymbolicName() ).thenReturn( BUNDLE_SYMBOLIC_NAME ); + BundleWiring bundleWiring = mock( BundleWiring.class ); + when( bundle.adapt( BundleWiring.class ) ).thenReturn( bundleWiring ); + when( result.getBundles() ).thenReturn( new Bundle[] { bundle } ); + return result; + } + + private void assertPrintStreamIsEmpty() { + assertEquals( 0, outputStream.toByteArray().length ); + } + + private void assertPrintStreamIsNotEmpty() { + assertTrue( outputStream.toByteArray().length > 0 ); + } + + private Class[] collect( TestBundles testBundles ) throws InitializationError { + PrintStream printStream = new PrintStream( outputStream, true ); + return new TestCollector( printStream, bundleContext, testBundles, DEFAULT_CLASSNAME_FILTERS ).collect(); + } + + @TestBundles(value = BUNDLE_SYMBOLIC_NAME) + private static class NoMatchTestSuite_DefaultPolicy { + } + + @TestBundles(value = BUNDLE_SYMBOLIC_NAME, noMatchPolicy = IGNORE) + private static class NoMatchTestSuite_IgnorePolicy { + } + + @TestBundles(value = BUNDLE_SYMBOLIC_NAME, noMatchPolicy = WARN) + private static class NoMatchTestSuite_WarnPolicy { + } + + @TestBundles(value = BUNDLE_SYMBOLIC_NAME, noMatchPolicy = FAIL) + private static class NoMatchTestSuite_FailPolicy { + } + +} From 85518eba240edd881c14586250bcebe94cf5a569 Mon Sep 17 00:00:00 2001 From: Amit Kumar Mondal Date: Tue, 24 May 2016 13:36:36 +0200 Subject: [PATCH 2/3] mend --- README.md | 6 +- com.codeaffine.osgi.testsuite.test/.classpath | 7 - com.codeaffine.osgi.testsuite.test/.project | 28 -- .../.settings/All OSGi TestSuite Tests.launch | 15 - .../org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.core.runtime.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 378 ------------------ .../.settings/org.eclipse.jdt.ui.prefs | 57 --- .../.settings/org.eclipse.pde.core.prefs | 4 - .../.settings/org.eclipse.pde.prefs | 32 -- .../META-INF/MANIFEST.MF | 18 - .../build.properties | 19 - com.codeaffine.osgi.testsuite.test/pom.xml | 29 -- .../osgi/testuite/BundleTestSuiteTest.java | 82 ---- .../internal/BundleTestCollectorTest.java | 72 ---- .../internal/ClassPathScannerTest.java | 151 ------- .../internal/ClassnameFilterTest.java | 77 ---- .../internal/DevPropertiesLoaderTest.java | 112 ------ .../testuite/internal/TestCollectorTest.java | 120 ------ 19 files changed, 2 insertions(+), 1211 deletions(-) delete mode 100644 com.codeaffine.osgi.testsuite.test/.classpath delete mode 100644 com.codeaffine.osgi.testsuite.test/.project delete mode 100644 com.codeaffine.osgi.testsuite.test/.settings/All OSGi TestSuite Tests.launch delete mode 100644 com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.core.resources.prefs delete mode 100644 com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.core.runtime.prefs delete mode 100644 com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.jdt.core.prefs delete mode 100644 com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.jdt.ui.prefs delete mode 100644 com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.pde.core.prefs delete mode 100644 com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.pde.prefs delete mode 100644 com.codeaffine.osgi.testsuite.test/META-INF/MANIFEST.MF delete mode 100644 com.codeaffine.osgi.testsuite.test/build.properties delete mode 100644 com.codeaffine.osgi.testsuite.test/pom.xml delete mode 100644 com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/BundleTestSuiteTest.java delete mode 100644 com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/BundleTestCollectorTest.java delete mode 100644 com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/ClassPathScannerTest.java delete mode 100644 com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/ClassnameFilterTest.java delete mode 100644 com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/DevPropertiesLoaderTest.java delete mode 100644 com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/TestCollectorTest.java diff --git a/README.md b/README.md index d0155b6..22eaf32 100644 --- a/README.md +++ b/README.md @@ -46,11 +46,9 @@ public class MasterTestSuite { In order to remain backward compatibility with previous versions, the default value is `IGNORE`. ## Download & Integration -The p2 repository +Maven Central -> `http://rherrmann.github.io/osgi-testsuite/repository` - -contains a feature with a single bundle. Add this to your target platform. +> `Yet to release` In order to use the BundleTestSuite, Require-Bundle or Package-Import the bundle/package com.codeaffine.osgi.testsuite. In addition an implementation of the OSGi specification [Release 5](https://www.osgi.org/developer/downloads/) (tested with Eclipse Equinox 3.8), JUnit 4.8 or later, and a JRE version 1.5 or later is required. diff --git a/com.codeaffine.osgi.testsuite.test/.classpath b/com.codeaffine.osgi.testsuite.test/.classpath deleted file mode 100644 index 64c5e31..0000000 --- a/com.codeaffine.osgi.testsuite.test/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/com.codeaffine.osgi.testsuite.test/.project b/com.codeaffine.osgi.testsuite.test/.project deleted file mode 100644 index 6e95efc..0000000 --- a/com.codeaffine.osgi.testsuite.test/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - com.codeaffine.osgi.testsuite.test - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/com.codeaffine.osgi.testsuite.test/.settings/All OSGi TestSuite Tests.launch b/com.codeaffine.osgi.testsuite.test/.settings/All OSGi TestSuite Tests.launch deleted file mode 100644 index 574f72e..0000000 --- a/com.codeaffine.osgi.testsuite.test/.settings/All OSGi TestSuite Tests.launch +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.core.resources.prefs b/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 46dd060..0000000 --- a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Fri Jan 06 22:50:57 CET 2012 -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.core.runtime.prefs b/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 3a179a6..0000000 --- a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Fri Jan 06 22:50:57 CET 2012 -eclipse.preferences.version=1 -line.separator=\n diff --git a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.jdt.core.prefs b/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 64c3cb4..0000000 --- a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,378 +0,0 @@ -=\=\=\=\=\=\= -<<<<<<<=Updated upstream ->>>>>>>=Stashed changes -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=error -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=warning -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=82 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=82 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=82 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=82 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=50 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=52 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=51 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=52 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=82 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=82 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=84 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=36 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=36 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=36 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=36 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=1 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=0 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=0 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line_on_wrap -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=next_line_on_wrap -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line_on_wrap -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line_on_wrap -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line_on_wrap -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=false -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=2 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=100 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=0 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_on_off_tags=false -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.jdt.ui.prefs b/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 43afcaa..0000000 --- a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,57 +0,0 @@ -#Sun Jan 15 18:56:13 CET 2012 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_Codeaffine -formatter_settings_version=12 -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false -sp_cleanup.add_missing_deprecated_annotations=false -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=false -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.pde.core.prefs b/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index e26d473..0000000 --- a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Sat Dec 17 00:29:44 CET 2011 -eclipse.preferences.version=1 -pluginProject.extensions=false -resolve.requirebundle=false diff --git a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.pde.prefs b/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 62cfa90..0000000 --- a/com.codeaffine.osgi.testsuite.test/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,32 +0,0 @@ -compilers.f.unresolved-features=1 -compilers.f.unresolved-plugins=1 -compilers.incompatible-environment=1 -compilers.p.build=1 -compilers.p.build.bin.includes=1 -compilers.p.build.encodings=2 -compilers.p.build.java.compiler=2 -compilers.p.build.java.compliance=1 -compilers.p.build.missing.output=2 -compilers.p.build.output.library=1 -compilers.p.build.source.library=1 -compilers.p.build.src.includes=1 -compilers.p.deprecated=1 -compilers.p.discouraged-class=1 -compilers.p.internal=1 -compilers.p.missing-packages=2 -compilers.p.missing-version-export-package=2 -compilers.p.missing-version-import-package=2 -compilers.p.missing-version-require-bundle=2 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=2 -compilers.p.unknown-attribute=1 -compilers.p.unknown-class=1 -compilers.p.unknown-element=1 -compilers.p.unknown-identifier=1 -compilers.p.unknown-resource=1 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.s.create-docs=false -compilers.s.doc-folder=doc -compilers.s.open-tags=1 -eclipse.preferences.version=1 diff --git a/com.codeaffine.osgi.testsuite.test/META-INF/MANIFEST.MF b/com.codeaffine.osgi.testsuite.test/META-INF/MANIFEST.MF deleted file mode 100644 index fb1ccb1..0000000 --- a/com.codeaffine.osgi.testsuite.test/META-INF/MANIFEST.MF +++ /dev/null @@ -1,18 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Tests for Automated Bundle Testsuite -Bundle-SymbolicName: com.codeaffine.osgi.testsuite.test -Bundle-Version: 1.2.0.qualifier -Bundle-Vendor: CodeAffine -Fragment-Host: com.codeaffine.osgi.testsuite;bundle-version="[1.2.0,2.0.0)" -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Import-Package: org.junit;version="[4.8.2,5.0.0)", - org.junit.rules;version="[4.8.2,5.0.0)", - org.junit.runner;version="[4.8.2,5.0.0)", - org.junit.runner.notification;version="[4.8.2,5.0.0)", - org.junit.runners;version="[4.8.2,5.0.0)", - org.junit.runners.model;version="[4.8.2,5.0.0)", - org.mockito;version="[1.8.4,2.0.0)", - org.mockito.invocation;version="[1.8.4,2.0.0)", - org.mockito.runners;version="[1.8.4,2.0.0)", - org.mockito.stubbing;version="[1.8.4,2.0.0)" diff --git a/com.codeaffine.osgi.testsuite.test/build.properties b/com.codeaffine.osgi.testsuite.test/build.properties deleted file mode 100644 index 5f2560f..0000000 --- a/com.codeaffine.osgi.testsuite.test/build.properties +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################### -# Copyright (c) 2012, 2013 Rüdiger Herrmann. -# 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: -# Rüdiger Herrmann - initial API and implementation -################################################################################ - -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - . -javacDefaultEncoding.. = UTF-8 -jre.compilation.profile = J2SE-1.5 -javacSource = 1.5 -javacTarget = 1.5 diff --git a/com.codeaffine.osgi.testsuite.test/pom.xml b/com.codeaffine.osgi.testsuite.test/pom.xml deleted file mode 100644 index 86523dd..0000000 --- a/com.codeaffine.osgi.testsuite.test/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - 4.0.0 - - com.codeaffine.osgi.testsuite - com.codeaffine.osgi.testsuite.test - 1.2.0-SNAPSHOT - eclipse-test-plugin - - - com.codeaffine.osgi.testsuite - com.codeaffine.osgi.testsuite.parent - 1.2.0-SNAPSHOT - ../com.codeaffine.osgi.testsuite.releng/pom.xml - - - diff --git a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/BundleTestSuiteTest.java b/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/BundleTestSuiteTest.java deleted file mode 100644 index 13fd230..0000000 --- a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/BundleTestSuiteTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2013, 2014 RĂ¼diger Herrmann. - * 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: - * RĂ¼diger Herrmann - initial API and implementation - * Frank Appel - ClassnameFilters - ******************************************************************************/ -package com.codeaffine.osgi.testuite; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.lang.reflect.Constructor; -import java.util.regex.PatternSyntaxException; - -import org.junit.Test; -import org.junit.runners.model.InitializationError; - -import com.codeaffine.osgi.testuite.BundleTestSuite.ClassnameFilters; -import com.codeaffine.osgi.testuite.BundleTestSuite.TestBundles; - -public class BundleTestSuiteTest { - - @Test - public void testConstructorSatisfiesJUnitRequirements() throws Exception { - Constructor constructor = BundleTestSuite.class.getConstructor( Class.class ); - - BundleTestSuite instance = constructor.newInstance( EmptyBundleTestSuite.class ); - - assertNotNull( instance ); - } - - @Test - public void testConstructorWithValidSuite() throws InitializationError { - BundleTestSuite bundleTestSuite = new BundleTestSuite( EmptyBundleTestSuite.class ); - - assertEquals( EmptyBundleTestSuite.class, bundleTestSuite.getTestClass().getJavaClass() ); - } - - @Test - public void testConstructorWithValidPatternSuite() throws InitializationError { - BundleTestSuite bundleTestSuite = new BundleTestSuite( ValidPatternTestSuite.class ); - - assertEquals( ValidPatternTestSuite.class, bundleTestSuite.getTestClass().getJavaClass() ); - } - - @Test - public void testConstructorWithInvalidSuite() throws Exception { - try { - new BundleTestSuite( InvalidBundleTestSuite.class ); - fail(); - } catch( InitializationError expected ) { - String message = expected.getCauses().get( 0 ).getMessage(); - assertTrue( message.contains( InvalidBundleTestSuite.class.getName() ) ); - } - } - - @Test - public void testConstructorWithInvalidPatternSuite() throws Exception { - try { - new BundleTestSuite( InvalidPatternTestSuite.class ); - fail(); - } catch( PatternSyntaxException expected ) { - } - } - - public static class InvalidBundleTestSuite {} - @TestBundles({}) - public static class EmptyBundleTestSuite {} - @TestBundles( {} ) - @ClassnameFilters( { "*" } ) - public static class InvalidPatternTestSuite {} - @TestBundles( {} ) - @ClassnameFilters( { ".*Foo" } ) - public static class ValidPatternTestSuite {} -} diff --git a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/BundleTestCollectorTest.java b/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/BundleTestCollectorTest.java deleted file mode 100644 index b1b6ed6..0000000 --- a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/BundleTestCollectorTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2013, 2014 RĂ¼diger Herrmann. - * 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: - * RĂ¼diger Herrmann - initial API and implementation - * Frank Appel - ClassnameFilters - ******************************************************************************/ -package com.codeaffine.osgi.testuite.internal; - -import static com.codeaffine.osgi.testuite.BundleTestSuite.ClassnameFilters.DEFAULT_CLASSNAME_FILTERS; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runners.model.InitializationError; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.wiring.BundleWiring; - -import com.codeaffine.osgi.testuite.internal.BundleTestCollector; - -public class BundleTestCollectorTest { - - private BundleContext bundleContext; - - @Test - public void testCollectWithNonExistingBundle() { - String nonExistingBundle = "no.bundle"; - BundleTestCollector collector = new BundleTestCollector( bundleContext, nonExistingBundle, DEFAULT_CLASSNAME_FILTERS ); - - try { - collector.collect(); - fail(); - } catch( InitializationError expected ) { - assertTrue( expected.getCauses().get( 0 ).getMessage().contains( nonExistingBundle ) ); - } - } - - @Test - public void testCollectWithExistingBundle() throws InitializationError { - String bundle = createBundle().getSymbolicName(); - - BundleTestCollector collector = new BundleTestCollector( bundleContext, bundle, DEFAULT_CLASSNAME_FILTERS ); - Class[] classes = collector.collect(); - - assertEquals( 0, classes.length ); - } - - @Before - public void setUp() { - bundleContext = mock( BundleContext.class ); - when( bundleContext.getBundles() ).thenReturn( new Bundle[ 0 ] ); - } - - private Bundle createBundle() { - Bundle result = mock( Bundle.class ); - when( result.getSymbolicName() ).thenReturn( "bundle.symbolic.name" ); - BundleWiring bundleWiring = mock( BundleWiring.class ); - when( result.adapt( BundleWiring.class ) ).thenReturn( bundleWiring ); - when( bundleContext.getBundles() ).thenReturn( new Bundle[] { result } ); - return result; - } - -} diff --git a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/ClassPathScannerTest.java b/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/ClassPathScannerTest.java deleted file mode 100644 index d772484..0000000 --- a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/ClassPathScannerTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2013, 2014 RĂ¼diger Herrmann. - * 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: - * RĂ¼diger Herrmann - initial API and implementation - * Frank Appel - ClassnameFilters - ******************************************************************************/ -package com.codeaffine.osgi.testuite.internal; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.Properties; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runners.model.InitializationError; -import org.osgi.framework.Bundle; -import org.osgi.framework.wiring.BundleWiring; - -public class ClassPathScannerTest { - - private Bundle bundle; - private Properties devProperties; - private ClassnameFilter classnameFilter; - - @Test - public void testScanWithoutDevProperties() throws Exception { - addTestResource( bundle, FooTest.class.getName(), FooTest.class ); - - ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); - Class[] classes = scanner.scan(); - - assertArrayEquals( new Class[] { FooTest.class }, classes ); - } - - @Test - public void testScanWithNonMatchingDevProperties() throws Exception { - addTestResource( bundle, FooTest.class.getName(), FooTest.class ); - devProperties.setProperty( "some.bogus.bundle.name", "bin" ); - - ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); - Class[] classes = scanner.scan(); - - assertArrayEquals( new Class[] { FooTest.class }, classes ); - } - - @Test - public void testScanWithBundleSpecificClassPathRoot() throws Exception { - addTestResource( bundle, "bin/" + FooTest.class.getName(), FooTest.class ); - devProperties.setProperty( bundle.getSymbolicName(), "bin" ); - - ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); - Class[] classes = scanner.scan(); - - assertArrayEquals( new Class[] { FooTest.class }, classes ); - } - - @Test - public void testScanWithGeneralClassPathRoot() throws Exception { - addTestResource( bundle, "bin/" + FooTest.class.getName(), FooTest.class ); - devProperties.setProperty( "*", "bin" ); - - ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); - Class[] classes = scanner.scan(); - - assertArrayEquals( new Class[] { FooTest.class }, classes ); - } - - @Test - public void testScanWithNonMatchingFilter() throws Exception { - addTestResource( bundle, "bin/" + Foo.class.getName(), Foo.class ); -// devProperties.setProperty( "*", "bin" ); - - ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); - Class[] classes = scanner.scan(); - - assertArrayEquals( new Class[ 0 ], classes ); - } - - @Test - public void testScanWithNonExistingClass() throws ClassNotFoundException { - addTestResource( bundle, FooTest.class.getName(), FooTest.class ); - ClassNotFoundException classNotFoundException = new ClassNotFoundException(); - when( bundle.loadClass( anyString() ) ).thenThrow( classNotFoundException ); - ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); - - try { - scanner.scan(); - fail(); - } catch( InitializationError expected ) { - assertEquals( classNotFoundException, expected.getCauses().get( 0 ) ); - } - } - - @Test - public void testScanWithEmptyBundle() throws InitializationError { - ClassPathScanner scanner = new ClassPathScanner( bundle, devProperties, classnameFilter ); - - Class[] classes = scanner.scan(); - - assertEquals( 0, classes.length ); - } - - @Before - public void setUp() { - bundle = createBundle(); - devProperties = new Properties(); - classnameFilter = mockClassnameFilter(); - } - - private static Bundle createBundle() { - Bundle result = mock( Bundle.class ); - when( result.getSymbolicName() ).thenReturn( "bundle.symbolic.name" ); - BundleWiring bundleWiring = mock( BundleWiring.class ); - when( result.adapt( BundleWiring.class ) ).thenReturn( bundleWiring ); - return result; - } - - private static ClassnameFilter mockClassnameFilter() { - ClassnameFilter result = mock( ClassnameFilter.class ); - when( result.accept( FooTest.class.getName() ) ).thenReturn( true ); - return result; - } - - @SuppressWarnings({"unchecked", "rawtypes"}) - private static void addTestResource( Bundle bundle, String resourceName, Class clazz ) - throws ClassNotFoundException - { - BundleWiring bundleWiring = bundle.adapt( BundleWiring.class ); - when( bundleWiring.listResources( anyString(), anyString(), anyInt() ) ) - .thenReturn( Arrays.asList( resourceName ) ); - when( bundle.loadClass( clazz.getName() ) ).thenReturn( clazz ); - } - - private static class Foo { - } - - private static class FooTest { - } -} \ No newline at end of file diff --git a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/ClassnameFilterTest.java b/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/ClassnameFilterTest.java deleted file mode 100644 index c847278..0000000 --- a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/ClassnameFilterTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2013, 2014 RĂ¼diger Herrmann. - * 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: - * Frank Appel - ClassnameFilters - ******************************************************************************/ -package com.codeaffine.osgi.testuite.internal; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -import com.codeaffine.osgi.testuite.internal.ClassnameFilter; - -public class ClassnameFilterTest { - - @Test - public void testAccept() { - ClassnameFilter filter = new ClassnameFilter(); - - boolean actual = filter.accept( "com.codeaffine.Foo" ); - - assertTrue( actual ); - } - - @Test - public void testAcceptWithMatchingInclusionPattern() { - ClassnameFilter filter = new ClassnameFilter( ".*Foo" ); - - boolean actual = filter.accept( "com.codeaffine.Foo" ); - - assertTrue( actual ); - } - - @Test - public void testAcceptWithNonMatchingInclusionPattern() { - ClassnameFilter filter = new ClassnameFilter( ".*Foo" ); - - boolean actual = filter.accept( "com.codeaffine.Bar" ); - - assertFalse( actual ); - } - - @Test - public void testAcceptWithMatchingExclusionPattern() { - ClassnameFilter filter = new ClassnameFilter( "!.*Foo" ); - - boolean actual = filter.accept( "com.codeaffine.Foo" ); - - assertFalse( actual ); - } - - @Test - public void testAcceptWithNonMatchingExclusionPattern() { - ClassnameFilter filter = new ClassnameFilter( "!.*Foo" ); - - boolean actual = filter.accept( "com.codeaffine.Bar" ); - - assertTrue( actual ); - } - - @Test - public void testAcceptWithMultiplePatterns() { - ClassnameFilter filter = new ClassnameFilter( ".*", "!.*Foo" ); - - boolean excluded = filter.accept( "com.codeaffine.Foo" ); - boolean included = filter.accept( "com.codeaffine.Bar" ); - - assertFalse( excluded ); - assertTrue( included ); - } -} \ No newline at end of file diff --git a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/DevPropertiesLoaderTest.java b/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/DevPropertiesLoaderTest.java deleted file mode 100644 index 3bd3783..0000000 --- a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/DevPropertiesLoaderTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2013, 2014 RĂ¼diger Herrmann. - * 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: - * RĂ¼diger Herrmann - initial API and implementation - ******************************************************************************/ -package com.codeaffine.osgi.testuite.internal; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Properties; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.osgi.framework.BundleContext; - -import com.codeaffine.osgi.testuite.internal.DevPropertiesLoader; - -public class DevPropertiesLoaderTest { - - @Rule - public TemporaryFolder tempFolder = new TemporaryFolder(); - - private BundleContext bundleContext; - - @Test - public void testLoadWithoutOsgiDevProperty() { - Properties properties = loadDevProperties(); - - assertEquals( 0, properties.size() ); - } - - @Test - public void testLoadWithEmptyOsgiDevProperty() { - when( bundleContext.getProperty( "osgi.dev" ) ).thenReturn( "" ); - - Properties properties = loadDevProperties(); - - assertEquals( 0, properties.size() ); - } - - @Test - public void testLoadWithNonExistingDevPropertiesFile() throws IOException { - setOsgiDevProperty(); - DevPropertiesLoader loader = new DevPropertiesLoader( bundleContext ); - - try { - loader.load(); - fail(); - } catch( RuntimeException expected ) { - assertTrue( expected.getCause() instanceof IOException ); - } - } - - @Test - public void testLoadWithDevProperties() throws IOException { - Properties properties = new Properties(); - properties.put( "foo", "bar" ); - storeDevProperties( properties ); - setOsgiDevProperty(); - - Properties loadedProperties = loadDevProperties(); - - assertEquals( properties, loadedProperties ); - } - - @Test - public void testLoadWithNullBundleContext() { - DevPropertiesLoader loader = new DevPropertiesLoader( null ); - - Properties properties = loader.load(); - - assertEquals( 0, properties.size() ); - } - - @Before - public void setUp() { - bundleContext = mock( BundleContext.class ); - } - - private Properties loadDevProperties() { - DevPropertiesLoader loader = new DevPropertiesLoader( bundleContext ); - return loader.load(); - } - - private void setOsgiDevProperty() throws IOException { - File file = new File( tempFolder.getRoot(), "dev.properties" ); - when( bundleContext.getProperty( "osgi.dev" ) ).thenReturn( file.toURI().toURL().toString() ); - } - - private void storeDevProperties( Properties properties ) throws IOException - { - File file = new File( tempFolder.getRoot(), "dev.properties" ); - OutputStream outputStream = new FileOutputStream( file ); - properties.store( outputStream, "" ); - outputStream.close(); - } -} diff --git a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/TestCollectorTest.java b/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/TestCollectorTest.java deleted file mode 100644 index ab3b5b3..0000000 --- a/com.codeaffine.osgi.testsuite.test/src/com/codeaffine/osgi/testuite/internal/TestCollectorTest.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.codeaffine.osgi.testuite.internal; - -import static com.codeaffine.osgi.testuite.BundleTestSuite.ClassnameFilters.DEFAULT_CLASSNAME_FILTERS; -import static com.codeaffine.osgi.testuite.BundleTestSuite.NoMatchPolicy.FAIL; -import static com.codeaffine.osgi.testuite.BundleTestSuite.NoMatchPolicy.IGNORE; -import static com.codeaffine.osgi.testuite.BundleTestSuite.NoMatchPolicy.WARN; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runners.model.InitializationError; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.wiring.BundleWiring; - -import com.codeaffine.osgi.testuite.BundleTestSuite.TestBundles; - -public class TestCollectorTest { - - private static final String BUNDLE_SYMBOLIC_NAME = "bundle.symbolic.name"; - - private BundleContext bundleContext; - private ByteArrayOutputStream outputStream; - - @Test - public void testCollectWithDefaultNoMatchPolicy() throws InitializationError { - TestBundles testBundles = NoMatchTestSuite_DefaultPolicy.class.getAnnotation( TestBundles.class ); - - Class[] classes = collect( testBundles ); - - assertEquals( 0, classes.length ); - assertPrintStreamIsEmpty(); - } - - @Test - public void testCollectWithIgnoreNoMatchPolicy() throws InitializationError { - TestBundles testBundles = NoMatchTestSuite_IgnorePolicy.class.getAnnotation( TestBundles.class ); - - Class[] classes = collect( testBundles ); - - assertEquals( 0, classes.length ); - assertPrintStreamIsEmpty(); - } - - @Test - public void testCollectWithWarnNoMatchPolicy() throws InitializationError { - TestBundles testBundles = NoMatchTestSuite_WarnPolicy.class.getAnnotation( TestBundles.class ); - - Class[] classes = collect( testBundles ); - - assertEquals( 0, classes.length ); - assertPrintStreamIsNotEmpty(); - } - - @Test - public void testCollectWithFailNoMatchPolicy() { - TestBundles testBundles = NoMatchTestSuite_FailPolicy.class.getAnnotation( TestBundles.class ); - - try { - collect( testBundles ); - fail(); - } catch( InitializationError expected ) { - assertPrintStreamIsEmpty(); - } - - } - - @Before - public void setUp() { - bundleContext = createBundleContext(); - outputStream = new ByteArrayOutputStream(); - } - - private static BundleContext createBundleContext() { - BundleContext result = mock( BundleContext.class ); - Bundle bundle = mock( Bundle.class ); - when( bundle.getSymbolicName() ).thenReturn( BUNDLE_SYMBOLIC_NAME ); - BundleWiring bundleWiring = mock( BundleWiring.class ); - when( bundle.adapt( BundleWiring.class ) ).thenReturn( bundleWiring ); - when( result.getBundles() ).thenReturn( new Bundle[] { bundle } ); - return result; - } - - private void assertPrintStreamIsEmpty() { - assertEquals( 0, outputStream.toByteArray().length ); - } - - private void assertPrintStreamIsNotEmpty() { - assertTrue( outputStream.toByteArray().length > 0 ); - } - - private Class[] collect( TestBundles testBundles ) throws InitializationError { - PrintStream printStream = new PrintStream( outputStream, true ); - return new TestCollector( printStream, bundleContext, testBundles, DEFAULT_CLASSNAME_FILTERS ).collect(); - } - - @TestBundles(value = BUNDLE_SYMBOLIC_NAME) - private static class NoMatchTestSuite_DefaultPolicy { - } - - @TestBundles(value = BUNDLE_SYMBOLIC_NAME, noMatchPolicy = IGNORE) - private static class NoMatchTestSuite_IgnorePolicy { - } - - @TestBundles(value = BUNDLE_SYMBOLIC_NAME, noMatchPolicy = WARN) - private static class NoMatchTestSuite_WarnPolicy { - } - - @TestBundles(value = BUNDLE_SYMBOLIC_NAME, noMatchPolicy = FAIL) - private static class NoMatchTestSuite_FailPolicy { - } - -} From e1c109c2fafc609f9d951d59c8c160f36bb8daad Mon Sep 17 00:00:00 2001 From: Amit Kumar Mondal Date: Tue, 24 May 2016 15:30:08 +0200 Subject: [PATCH 3/3] mend --- .travis-deploy.sh | 35 ----------------------------------- .travis.yml | 23 ----------------------- 2 files changed, 58 deletions(-) delete mode 100644 .travis-deploy.sh delete mode 100644 .travis.yml diff --git a/.travis-deploy.sh b/.travis-deploy.sh deleted file mode 100644 index e3ed918..0000000 --- a/.travis-deploy.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -function error_exit -{ - echo -e "\e[01;31m$1\e[00m" 1>&2 - exit 1 -} - -if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then - echo -e "Starting to deploy to gh-pages\n" - - # create and cd into temporary deployment work directory - mkdir deployment-work - cd deployment-work - - # setup git and clone from gh-pages branch - git config --global user.email "travis-deployer@codeaffine.com" - git config --global user.name "Travis Deployer" - git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/rherrmann/osgi-testsuite.git . > /dev/null 2>&1 || error_exit "Error cloning gh-pages" - - # clean the repository directory, then copy the build result into it - git rm -rf repository - mkdir -p repository - cp -rf ../com.codeaffine.osgi.testsuite.releng/repository/target/repository/* ./repository - - # add, commit and push files - git add -f . - git commit -m "[ci skip] Deploy Travis build #$TRAVIS_BUILD_NUMBER to gh-pages" - git push -fq origin gh-pages > /dev/null 2>&1 || error_exit "Error uploading the build result to gh-pages" - - # go back to the directory where we started - cd .. - - echo -e "Done with deployment to gh-pages\n" -fi diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d90753e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -env: - global: - secure: "XSDqVEb9qwXDpifbNaFL+iEXnMpdHp+IW2/i11QmCPmPY/CtTv1UDqq32q6mV65Pbdlynsoia8Ld1Rt/6j8JbRZEHKF6LlKfeLCSMa1yOE38lSHAJ33eQ1aAUepqmA/Ex8UBpSlyVQXaO76hjQYCYKOsvx6L07CpCFRzUPJ1Vkg=" - -sudo: false - -language: java - -jdk: - - oraclejdk8 - -branches: - only: - - master - -script: mvn -f com.codeaffine.osgi.testsuite.releng/pom.xml clean verify - -after_success: - - chmod a+x .travis-deploy.sh - - ./.travis-deploy.sh - -after_failure: - - cat com.codeaffine.osgi.testsuite.test/target/surefire-reports/*.txt