http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/config.bat.in ---------------------------------------------------------------------- diff --git a/config.bat.in b/config.bat.in deleted file mode 100644 index a73a88e..0000000 --- a/config.bat.in +++ /dev/null @@ -1,66 +0,0 @@ -REM -REM Licensed to the Apache Software Foundation (ASF) under one -REM or more contributor license agreements. See the NOTICE file -REM distributed with this work for additional information -REM regarding copyright ownership. The ASF licenses this file -REM to you under the Apache License, Version 2.0 (the -REM "License"); you may not use this file except in compliance -REM with the License. You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, -REM software distributed under the License is distributed on an -REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -REM KIND, either express or implied. See the License for the -REM specific language governing permissions and limitations -REM under the License. -REM - -REM This is a generated file and will be overwritten the next -REM time that cmake is run. - -REM This build may be one of @CMAKE_CONFIGURATION_TYPES@ -REM Choose the configuration this script should reference: -SET PROTON_BUILD_CONFIGURATION=relwithdebinfo - -REM PROTON_HOME is the root of the proton checkout -REM PROTON_BUILD is where cmake was run - -set PROTON_HOME=@CMAKE_SOURCE_DIR@ -set PROTON_BUILD=@CMAKE_BINARY_DIR@ - -set PROTON_HOME=%PROTON_HOME:/=\% -set PROTON_BUILD=%PROTON_BUILD:/=\% - -set PROTON_BINDINGS=%PROTON_BUILD%\proton-c\bindings -set PROTON_JARS=%PROTON_BUILD%\proton-j\proton-j.jar - -REM Python & Jython -set PYTHON_BINDINGS=%PROTON_BINDINGS%\python -set COMMON_PYPATH=%PROTON_HOME%\tests\python;%PROTON_HOME%\proton-c\bindings\python -set PYTHONPATH=%COMMON_PYPATH%;%PYTHON_BINDINGS% -set JYTHONPATH=%COMMON_PYPATH%;%PROTON_HOME%\proton-j\src\main\resources;%PROTON_JARS% -set CLASSPATH=%PROTON_JARS% - -REM PHP -set PHP_BINDINGS=%PROTON_BINDINGS%\php -if EXIST %PHP_BINDINGS% ( - echo include_path="%PHP_BINDINGS%;%PROTON_HOME%\proton-c\bindings\php" > %PHP_BINDINGS%\php.ini - echo extension="%PHP_BINDINGS%\cproton.so" >> %PHP_BINDINGS%\php.ini - set PHPRC=%PHP_BINDINGS%\php.ini -) - -REM Ruby -set RUBY_BINDINGS=%PROTON_BINDINGS%\ruby -set RUBYLIB=%RUBY_BINDINGS%;%PROTON_HOME%\proton-c\bindings\ruby\lib;%PROTON_HOME%\tests\ruby - -REM Perl -set PERL_BINDINGS=%PROTON_BINDINGS%\perl -set PERL5LIB=%PERL5LIB%;%PERL_BINDINGS%;%PROTON_HOME%\proton-c\bindings\perl\lib - -REM test applications -set PATH=%PATH%;%PROTON_BUILD%\tests\tools\apps\c -set PATH=%PATH%;%PROTON_HOME%\tests\tools\apps\python -set PATH=%PATH%;%PROTON_HOME%\tests\python -set PATH=%PATH%;%PROTON_BUILD%\proton-c\%PROTON_BUILD_CONFIGURATION%
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/config.sh.in ---------------------------------------------------------------------- diff --git a/config.sh.in b/config.sh.in deleted file mode 100755 index edb77e6..0000000 --- a/config.sh.in +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -merge_paths() { - # Merge paths, remove duplicates (keep first instance) - path=$(echo $* | sed 's/:/ /'g) # Split with spaces. - newpath="" - for d in $path; do # Remove duplicates - { echo $newpath | grep -q "\(:\|^\)$d\(:\|$\)"; } || newpath="$newpath:$d" - done - echo $newpath | sed 's/^://' # Remove leading : -} - -PROTON_HOME=@CMAKE_SOURCE_DIR@ -PROTON_BUILD=@CMAKE_BINARY_DIR@ - -PROTON_BINDINGS=$PROTON_BUILD/proton-c/bindings -PROTON_JARS=$PROTON_BUILD/proton-j/proton-j.jar - -PYTHON_BINDINGS=$PROTON_BINDINGS/python -PHP_BINDINGS=$PROTON_BINDINGS/php -RUBY_BINDINGS=$PROTON_BINDINGS/ruby -PERL_BINDINGS=$PROTON_BINDINGS/perl - -# Python & Jython -COMMON_PYPATH=$PROTON_HOME/tests/python:$PROTON_HOME/proton-c/bindings/python:$PROTON_HOME/examples -export PYTHONPATH=$COMMON_PYPATH:$PYTHON_BINDINGS -export JYTHONPATH=$COMMON_PYPATH:$PROTON_HOME/proton-j/src/main/resources:$PROTON_JARS -export CLASSPATH=$PROTON_JARS - -# PHP -if [ -d $PHP_BINDINGS ]; then - cat <<EOF > $PHP_BINDINGS/php.ini -include_path="$PHP_BINDINGS:$PROTON_HOME/proton-c/bindings/php" -extension="$PHP_BINDINGS/cproton.so" -EOF - export PHPRC=$PHP_BINDINGS/php.ini -fi - -# Ruby -export RUBYLIB=$RUBY_BINDINGS:$PROTON_HOME/proton-c/bindings/ruby/lib:$PROTON_HOME/tests/ruby - -# Perl -export PERL5LIB=$PERL5LIB:$PERL_BINDINGS:$PROTON_HOME/proton-c/bindings/perl/lib - -# Go -export GOPATH="$(merge_paths $PROTON_HOME/proton-c/bindings/go $GOPATH)" -# Help Go compiler find libraries and include files. -export C_INCLUDE_PATH="$(merge_paths $PROTON_HOME/proton-c/include $PROTON_BUILD/proton-c/include $C_INCLUDE_PATH)" -export LIBRARY_PATH="$(merge_paths $PROTON_BUILD/proton-c $LIBRARY_PATH)" -export LD_LIBRARY_PATH="$(merge_paths $PROTON_BUILD/proton-c $LD_LIBRARY_PATH)" - - - -# test applications -export PATH="$(merge_paths $PATH $PROTON_BUILD/tests/tools/apps/c $PROTON_HOME/tests/tools/apps/python $PROTON_HOME/tests/python)" - -# can the test harness use valgrind? -if [[ -x "$(type -p valgrind)" && "@ENABLE_VALGRIND@" == "ON" ]] ; then - export VALGRIND=$(type -p valgrind) -fi - -# can the test harness use saslpasswd2? -if [[ -x "$(type -p saslpasswd2)" ]] ; then - export SASLPASSWD=$(type -p saslpasswd2) -fi - -# Location of interop test files. -export PN_INTEROP_DIR=$PROTON_HOME/tests/interop http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/README ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/README b/design/api-reconciliation/README deleted file mode 100644 index 74aec08..0000000 --- a/design/api-reconciliation/README +++ /dev/null @@ -1,4 +0,0 @@ -Tool to generate a report mapping proton-c functions to proton-j class methods. -On Linux, the list of proton-c functions can be generated using generate-c-functions.sh - -See pom.xml for more details. http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/generate-c-functions.sh ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/generate-c-functions.sh b/design/api-reconciliation/generate-c-functions.sh deleted file mode 100755 index 9820453..0000000 --- a/design/api-reconciliation/generate-c-functions.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# Script to generate a list of proton-c functions for use as input to the api-reconciliation tool. - -# If you have problems running ctags, note that there are two ctags executables on some Linux -# distributions. The one required here is from the exuberant-ctags package -# (http://ctags.sourceforge.net), *not* GNU emacs ctags. - -BASE_DIR=`dirname $0` -INCLUDE_DIR=$BASE_DIR/../../proton-c/include/proton -OUTPUT_DIR=$BASE_DIR/target - -mkdir -p $OUTPUT_DIR -ctags --c-kinds=p -x $INCLUDE_DIR/*.h | awk '{print $1'} > $OUTPUT_DIR/cfunctions.txt http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/pom.xml ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/pom.xml b/design/api-reconciliation/pom.xml deleted file mode 100644 index 4622f34..0000000 --- a/design/api-reconciliation/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.qpid</groupId> - <artifactId>proton-api-reconciliation</artifactId> - <version>1.0-SNAPSHOT</version> - <properties> - <proton-c-build-dir>${basedir}/../../build/proton-c</proton-c-build-dir> - <jni-jar>${proton-c-build-dir}/bindings/java/proton-jni.jar</jni-jar> - </properties> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.6</source> - <target>1.6</target> - <optimize>true</optimize> - <showDeprecation>true</showDeprecation> - <showWarnings>true</showWarnings> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <version>1.2.1</version> - <executions> - <execution> - <goals> - <goal>java</goal> - </goals> - </execution> - </executions> - <configuration> - <mainClass>org.apache.qpid.proton.apireconciliation.Main</mainClass> - <includePluginDependencies>true</includePluginDependencies> - <arguments> - <argument>org.apache.qpid.proton</argument> - <argument>target/cfunctions.txt</argument> - <argument>org.apache.qpid.proton.ProtonCEquivalent</argument> - <argument>target/apireconciliation.csv</argument> - </arguments> - </configuration> - <dependencies> - <dependency> - <groupId>org.apache.qpid</groupId> - <artifactId>proton-jni</artifactId> - <version>${project.version}</version> - <scope>system</scope> - <systemPath>${jni-jar}</systemPath> - </dependency> - <dependency> - <groupId>org.apache.qpid</groupId> - <artifactId>proton-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.10</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.reflections</groupId> - <artifactId>reflections</artifactId> - <version>0.9.8</version> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.6</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.4</version> - </dependency> - </dependencies> - <description>Tool to generate a report mapping proton-c functions to proton-j class methods. -Uses proton-jni and proton-api at run-time, so these libraries must be available to Maven, -eg in a local Maven repository. -Can be run using sensible defaults using "mvn compile exec:java"</description> - <parent> - <groupId>org.apache</groupId> - <artifactId>apache</artifactId> - <version>12</version> - <relativePath></relativePath> - </parent> -</project> http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/CFunctionNameListReader.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/CFunctionNameListReader.java b/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/CFunctionNameListReader.java deleted file mode 100644 index e726801..0000000 --- a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/CFunctionNameListReader.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.List; - -import org.apache.commons.io.FileUtils; - -public class CFunctionNameListReader -{ - - public List<String> readCFunctionNames(String fileContainingFunctionNames) throws IOException - { - File functionNameFile = new File(fileContainingFunctionNames); - if (!functionNameFile.canRead()) - { - throw new FileNotFoundException("File " + functionNameFile + " cannot be found or is not readable."); - } - - List<String> cFunctionNames = FileUtils.readLines(functionNameFile); - return cFunctionNames; - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Joiner.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Joiner.java b/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Joiner.java deleted file mode 100644 index 9d73308..0000000 --- a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Joiner.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.proton.apireconciliation; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.qpid.proton.apireconciliation.reportwriter.AnnotationAccessor; - -public class Joiner -{ - private final AnnotationAccessor _annotationAccessor; - - public Joiner(AnnotationAccessor annotationAccessor) - { - _annotationAccessor = annotationAccessor; - } - - /** - * Does an outer join of the supplied C functions with those named by the - * annotations on the Java methods. - */ - public ReconciliationReport join(List<String> protonCFunctions, Set<Method> javaMethods) - { - ReconciliationReport report = new ReconciliationReport(); - - Map<String, Method> cFunctionToJavaMethodMap = createOneToOneMappingBetweenCFunctionNameAndJavaMethodMap(javaMethods); - - Set<Method> unannotatedMethods = new HashSet<Method>(javaMethods); - unannotatedMethods.removeAll(cFunctionToJavaMethodMap.values()); - - for (Method unannotatedMethod : unannotatedMethods) - { - report.addRow(null, unannotatedMethod); - } - - for (String protonCFunction : protonCFunctions) - { - Method javaMethod = cFunctionToJavaMethodMap.remove(protonCFunction); - report.addRow(protonCFunction, javaMethod); - } - - // add anything remaining in annotatedNameToMethod to report as Java methods with an unknown annotation - for (Method method : cFunctionToJavaMethodMap.values()) - { - report.addRow(null, method); - } - - return report; - } - - private Map<String, Method> createOneToOneMappingBetweenCFunctionNameAndJavaMethodMap(Set<Method> javaMethods) - { - Map<String, Method> annotatedNameToMethod = new HashMap<String, Method>(); - Set<String> functionsWithDuplicateJavaMappings = new HashSet<String>(); - - for (Method method : javaMethods) - { - String functionName = _annotationAccessor.getAnnotationValue(method); - if (functionName != null) - { - if (annotatedNameToMethod.containsKey(functionName)) - { - functionsWithDuplicateJavaMappings.add(functionName); - } - annotatedNameToMethod.put(functionName, method); - } - } - - // Any functions that had duplicate java method names are removed. - for (String functionName : functionsWithDuplicateJavaMappings) - { - annotatedNameToMethod.remove(functionName); - } - - return annotatedNameToMethod; - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Main.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Main.java b/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Main.java deleted file mode 100644 index 92557c9..0000000 --- a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation; - -import java.util.List; - -import org.apache.qpid.proton.apireconciliation.reportwriter.AnnotationAccessor; -import org.apache.qpid.proton.apireconciliation.reportwriter.ReconciliationReportWriter; - -public class Main -{ - - public static void main(String[] args) throws Exception - { - if (args.length != 4) - { - System.err.println("Unexpected number of arguments. Usage:"); - System.err.println(" java " + Main.class.getName() + " packageRootName cFunctionFile annotationClassName outputFile"); - Runtime.getRuntime().exit(-1); - } - - String packageRootName = args[0]; - String cFunctionFile = args[1]; - String annotationClassName = args[2]; - String outputFile = args[3]; - - CFunctionNameListReader cFunctionNameListReader = new CFunctionNameListReader(); - - AnnotationAccessor annotationAccessor = new AnnotationAccessor(annotationClassName); - Reconciliation reconciliation = new Reconciliation(annotationAccessor); - - List<String> cFunctionNames = cFunctionNameListReader.readCFunctionNames(cFunctionFile); - ReconciliationReport report = reconciliation.reconcile(cFunctionNames, packageRootName); - - ReconciliationReportWriter writer = new ReconciliationReportWriter(annotationAccessor); - writer.write(outputFile, report); - System.err.println("Written : " + outputFile); - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Reconciliation.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Reconciliation.java b/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Reconciliation.java deleted file mode 100644 index 7f27b4d..0000000 --- a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/Reconciliation.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.proton.apireconciliation; - -import java.lang.reflect.Method; -import java.util.List; -import java.util.Set; - -import org.apache.qpid.proton.apireconciliation.packagesearcher.PackageSearcher; -import org.apache.qpid.proton.apireconciliation.reportwriter.AnnotationAccessor; - -public class Reconciliation -{ - private final PackageSearcher _packageSearcher = new PackageSearcher(); - private final Joiner _joiner; - - public Reconciliation(AnnotationAccessor annotationAccessor) - { - _joiner = new Joiner(annotationAccessor); - } - - public ReconciliationReport reconcile(List<String> protonCFunctions, String packageRootName) - { - Set<Method> javaMethods = _packageSearcher.findMethods(packageRootName); - ReconciliationReport report = _joiner.join(protonCFunctions, javaMethods); - return report; - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/ReconciliationReport.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/ReconciliationReport.java b/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/ReconciliationReport.java deleted file mode 100644 index e5bfbaa..0000000 --- a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/ReconciliationReport.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.proton.apireconciliation; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class ReconciliationReport -{ - private List<ReportRow> _reportRows = new ArrayList<ReportRow>(); - - public Iterator<ReportRow> rowIterator() - { - return _reportRows.iterator(); - } - - public void addRow(String declaredProtonCFunction, Method javaMethod) - { - _reportRows.add(new ReportRow(declaredProtonCFunction, javaMethod)); - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/ReportRow.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/ReportRow.java b/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/ReportRow.java deleted file mode 100644 index 23ff7ab..0000000 --- a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/ReportRow.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.proton.apireconciliation; - -import java.lang.reflect.Method; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -public class ReportRow -{ - private final String _declaredProtonCFunction; - private final Method _javaMethod; - - public ReportRow(String declaredProtonCFunction, Method javaMethod) - { - _declaredProtonCFunction = declaredProtonCFunction; - _javaMethod = javaMethod; - } - - public String getCFunction() - { - return _declaredProtonCFunction; - } - - public Method getJavaMethod() - { - return _javaMethod; - } - - @Override - public int hashCode() - { - return new HashCodeBuilder().append(_declaredProtonCFunction) - .append(_javaMethod) - .toHashCode(); - } - - @Override - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - if (obj == this) - { - return true; - } - if (obj.getClass() != getClass()) - { - return false; - } - ReportRow rhs = (ReportRow) obj; - return new EqualsBuilder() - .append(_declaredProtonCFunction, rhs._declaredProtonCFunction) - .append(_javaMethod, rhs._javaMethod) - .isEquals(); - } - - @Override - public String toString() - { - return new ToStringBuilder(this) - .append("_declaredProtonCFunction", _declaredProtonCFunction) - .append("_javaMethod", _javaMethod) - .toString(); - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/packagesearcher/PackageSearcher.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/packagesearcher/PackageSearcher.java b/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/packagesearcher/PackageSearcher.java deleted file mode 100644 index 6a824ae..0000000 --- a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/packagesearcher/PackageSearcher.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.logging.Logger; - -import org.reflections.Reflections; -import org.reflections.scanners.SubTypesScanner; - -public class PackageSearcher -{ - private final static Logger LOGGER = Logger.getLogger(PackageSearcher.class.getName()); - - public Set<Method> findMethods(String packageName) - { - Reflections reflections = new Reflections(packageName, new SubTypesScanner(false)); - - Set<Class<?>> allInterfaces = getAllApiInterfaces(reflections); - - Set<Method> allImplMethods = new HashSet<Method>(); - for (Class<?> apiInterface : allInterfaces) - { - List<Method> apiMethodList = Arrays.asList(apiInterface.getMethods()); - Set<?> impls = reflections.getSubTypesOf(apiInterface); - if (impls.size() == 0) - { - // In the case where there are no implementations of apiInterface, we add the methods of - // apiInterface so they appear on the final report. - for (Method apiMethod : apiMethodList) - { - allImplMethods.add(apiMethod); - } - } - else - { - for (Object implementingClassObj : impls) - { - Class implementingClass = (Class) implementingClassObj; - LOGGER.fine("Found implementation " + implementingClass.getName() + " for " + apiInterface.getName()); - - for (Method apiMethod : apiMethodList) - { - Method implMethod = findImplMethodOfApiMethod(apiMethod, implementingClass); - allImplMethods.add(implMethod); - } - } - } - } - return allImplMethods; - } - - private Method findImplMethodOfApiMethod(Method apiMethod, Class<?> impl) - { - try - { - Method implMethod = impl.getMethod(apiMethod.getName(), apiMethod.getParameterTypes()); - return implMethod; - } - catch (Exception e) - { - // Should not happen - throw new IllegalStateException("Could not find implementation of method " + apiMethod - + " on the impl. " + impl, e); - } - } - - @SuppressWarnings("rawtypes") - private Set<Class<?>> getAllApiInterfaces(Reflections reflections) - { - Set<Class<?>> classes = reflections.getSubTypesOf(Object.class); - Set<Class<?>> interfaces = new HashSet<Class<?>>(); - - for (Class clazz : classes) - { - if(clazz.isInterface()) - { - interfaces.add(clazz); - } - } - - return interfaces; - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/reportwriter/AnnotationAccessor.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/reportwriter/AnnotationAccessor.java b/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/reportwriter/AnnotationAccessor.java deleted file mode 100644 index 71a1a91..0000000 --- a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/reportwriter/AnnotationAccessor.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.reportwriter; - -import java.lang.annotation.Annotation; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -public class AnnotationAccessor -{ - private static final String VALUE_METHOD = "value"; - private final Class<Annotation> _annotationClass; - private final Method _functionNameMethod; - - @SuppressWarnings("unchecked") - public AnnotationAccessor(String annotationClassName) - { - try - { - _annotationClass = (Class<Annotation>) Class.forName(annotationClassName); - } - catch (ClassNotFoundException e) - { - throw new IllegalArgumentException("Couldn't find annotation class " + annotationClassName, e); - } - - try - { - _functionNameMethod = _annotationClass.getMethod(VALUE_METHOD); - } - catch (SecurityException e) - { - throw new IllegalArgumentException("Couldn't find method " + VALUE_METHOD + " on annotation " + _annotationClass, e); - } - catch (NoSuchMethodException e) - { - throw new IllegalArgumentException("Couldn't find method " + VALUE_METHOD + " on annotation " + _annotationClass, e); - } - } - - public String getAnnotationValue(Method javaMethod) - { - Annotation annotation = javaMethod.getAnnotation(_annotationClass); - if (javaMethod != null && annotation != null) - { - return getProtonCFunctionName(annotation); - } - else - { - return null; - } - } - - private String getProtonCFunctionName(Annotation annotation) - { - try - { - return String.valueOf(_functionNameMethod.invoke(annotation)); - } - catch (IllegalArgumentException e) - { - throw new RuntimeException("Couldn't invoke method " + _functionNameMethod + " on annotation " + annotation, e); - } - catch (IllegalAccessException e) - { - throw new RuntimeException("Couldn't invoke method " + _functionNameMethod + " on annotation " + annotation, e); - } - catch (InvocationTargetException e) - { - throw new RuntimeException("Couldn't invoke method " + _functionNameMethod + " on annotation " + annotation, e); - } - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/reportwriter/ReconciliationReportWriter.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/reportwriter/ReconciliationReportWriter.java b/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/reportwriter/ReconciliationReportWriter.java deleted file mode 100644 index efb4cce..0000000 --- a/design/api-reconciliation/src/main/java/org/apache/qpid/proton/apireconciliation/reportwriter/ReconciliationReportWriter.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.reportwriter; - -import static java.lang.String.format; -import static org.apache.commons.lang.StringUtils.defaultString; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.io.FileUtils; -import org.apache.qpid.proton.apireconciliation.ReconciliationReport; -import org.apache.qpid.proton.apireconciliation.ReportRow; - -public class ReconciliationReportWriter -{ - private static final String ROW_FORMAT="%s,%s,%s"; - private static final String REPORT_TITLE = format(ROW_FORMAT, "C function","Java Method","Java Annotation"); - private final AnnotationAccessor _annotationAccessor; - - public ReconciliationReportWriter(AnnotationAccessor annotationAccessor) - { - _annotationAccessor = annotationAccessor; - } - - public void write(String outputFile, ReconciliationReport report) throws IOException - { - File output = new File(outputFile); - List<String> reportLines = new ArrayList<String>(); - - reportLines.add(REPORT_TITLE); - - Iterator<ReportRow> itr = report.rowIterator(); - while (itr.hasNext()) - { - ReportRow row = itr.next(); - Method javaMethod = row.getJavaMethod(); - String cFunction = defaultString(row.getCFunction()); - - String fullyQualifiedMethodName = ""; - String annotationCFunction = ""; - if (javaMethod != null) - { - fullyQualifiedMethodName = createFullyQualifiedJavaMethodName(javaMethod); - annotationCFunction = defaultString(_annotationAccessor.getAnnotationValue(javaMethod)); - } - reportLines.add(format(ROW_FORMAT, cFunction, fullyQualifiedMethodName, annotationCFunction)); - } - - FileUtils.writeLines(output, reportLines); - } - - private String createFullyQualifiedJavaMethodName(Method javaMethod) - { - return javaMethod.getDeclaringClass().getName() + "#" + javaMethod.getName(); - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/CFunctionNameListReaderTest.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/CFunctionNameListReaderTest.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/CFunctionNameListReaderTest.java deleted file mode 100644 index 4e36a90..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/CFunctionNameListReaderTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation; - -import static org.junit.Assert.*; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -import org.apache.commons.io.FileUtils; -import org.junit.Test; - -public class CFunctionNameListReaderTest -{ - - private CFunctionNameListReader _cFunctionDeclarationReader = new CFunctionNameListReader(); - - @Test - public void testReadFileContainingSingleCFunction() throws Exception - { - String declarationFile = createTestFileContaining("function1", "function2", "function3"); - - List<String> functions = _cFunctionDeclarationReader.readCFunctionNames(declarationFile); - assertEquals(3, functions.size()); - assertEquals("function1", functions.get(0)); - assertEquals("function3", functions.get(2)); - } - - private String createTestFileContaining(String... functionNames) throws Exception - { - File file = File.createTempFile(CFunctionNameListReader.class.getSimpleName(), "txt"); - file.deleteOnExit(); - FileUtils.writeLines(file, Arrays.asList(functionNames)); - return file.getAbsolutePath(); - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/JoinerTest.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/JoinerTest.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/JoinerTest.java deleted file mode 100644 index 134d4fe..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/JoinerTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.proton.apireconciliation; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -import java.lang.reflect.Method; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.apache.qpid.proton.apireconciliation.reportwriter.AnnotationAccessor; -import org.junit.Before; -import org.junit.Test; - -public class JoinerTest -{ - private static final String C_FUNCTION1 = "cFunction1"; - private static final String C_FUNCTION2 = "cFunction2"; - private Joiner _joiner; - private Method _method1 = null; - private Method _method2 = null; - private Method _methodSharingFunctionNameAnnotationWithMethod2 = null; - private Method _methodWithoutAnnotation; - - @Before - public void setUp() throws Exception - { - _method1 = getClass().getMethod("javaMethodWithMapping1"); - _method2 = getClass().getMethod("javaMethodWithMapping2"); - _methodSharingFunctionNameAnnotationWithMethod2 = getClass().getMethod("javaMethodSharingFunctionNameAnnotationWithMethod2"); - _methodWithoutAnnotation = getClass().getMethod("javaMethodWithoutAnnotation"); - - AnnotationAccessor annotationAccessor = new AnnotationAccessor(TestAnnotation.class.getName()); - - _joiner = new Joiner(annotationAccessor); - } - - @Test - public void testSingleRowReport() throws Exception - { - List<String> protonCFunctions = asList(C_FUNCTION1); - Set<Method> javaMethods = new HashSet<Method>(asList(_method1)); - - ReconciliationReport reconciliationReport = _joiner.join(protonCFunctions, javaMethods); - assertSingleRowEquals(reconciliationReport, C_FUNCTION1, _method1); - } - - @Test - public void testCFunctionWithoutCorrespondingAnnotatedJavaMethod() throws Exception - { - List<String> protonCFunctions = asList("functionX"); - Set<Method> javaMethods = Collections.emptySet(); - - ReconciliationReport reconciliationReport = _joiner.join(protonCFunctions, javaMethods); - assertSingleRowEquals(reconciliationReport, "functionX", null); - } - - @Test - public void testJavaMethodAnnotatedWithUnknownCFunctionName() throws Exception - { - List<String> protonCFunctions = Collections.emptyList(); - Set<Method> javaMethods = new HashSet<Method>(asList(_method1)); - - ReconciliationReport reconciliationReport = _joiner.join(protonCFunctions, javaMethods); - assertSingleRowEquals(reconciliationReport, null, _method1); - } - - @Test - public void testJavaMethodWithoutAnnotation() throws Exception - { - List<String> protonCFunctions = Collections.emptyList(); - Set<Method> javaMethods = new HashSet<Method>(asList(_methodWithoutAnnotation)); - - ReconciliationReport reconciliationReport = _joiner.join(protonCFunctions, javaMethods); - assertSingleRowEquals(reconciliationReport, null, _methodWithoutAnnotation); - } - - @Test - public void testJavaMethodsWithAnnotationToSameFunction() throws Exception - { - List<String> protonCFunctions = asList(C_FUNCTION2); - Set<Method> javaMethods = new HashSet<Method>(asList(_method2, _methodSharingFunctionNameAnnotationWithMethod2)); - - ReconciliationReport reconciliationReport = _joiner.join(protonCFunctions, javaMethods); - Set<ReportRow> rowSet = TestUtils.getReportRowsFrom(reconciliationReport); - - Set<ReportRow> expectedRowSet = new HashSet<ReportRow>(asList( - new ReportRow(C_FUNCTION2, null), - new ReportRow(null, _method2), - new ReportRow(null, _methodSharingFunctionNameAnnotationWithMethod2))); - - assertEquals(expectedRowSet, rowSet); - } - - @Test - public void testMultipleRowReport() throws Exception - { - List<String> protonCFunctions = asList(C_FUNCTION1, C_FUNCTION2); - Set<Method> javaMethods = new HashSet<Method>(asList(_method1, _method2)); - - ReconciliationReport reconciliationReport = _joiner.join(protonCFunctions, javaMethods); - - Set<ReportRow> rowSet = TestUtils.getReportRowsFrom(reconciliationReport); - - Set<ReportRow> expectedRowSet = new HashSet<ReportRow>(asList( - new ReportRow(C_FUNCTION1, _method1), - new ReportRow(C_FUNCTION2, _method2))); - - assertEquals(expectedRowSet,rowSet); - } - - private void assertSingleRowEquals(ReconciliationReport reconciliationReport, String expectedCFunctionName, Method expectedJavaMethod) - { - Iterator<ReportRow> rowIterator = reconciliationReport.rowIterator(); - ReportRow row = rowIterator.next(); - assertReportRowEquals(row, expectedCFunctionName, expectedJavaMethod); - - assertFalse(rowIterator.hasNext()); - } - - private void assertReportRowEquals(ReportRow row, String expectedCFunctionName, Method expectedMethod) - { - assertEquals(expectedCFunctionName, row.getCFunction()); - assertEquals(expectedMethod, row.getJavaMethod()); - } - - @TestAnnotation(C_FUNCTION1) - public void javaMethodWithMapping1() - { - } - - @TestAnnotation(C_FUNCTION2) - public void javaMethodWithMapping2() - { - } - - @TestAnnotation(C_FUNCTION2) - public void javaMethodSharingFunctionNameAnnotationWithMethod2() - { - } - - public void javaMethodWithoutAnnotation() - { - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/ReportRowTest.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/ReportRowTest.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/ReportRowTest.java deleted file mode 100644 index 65613d3..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/ReportRowTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.proton.apireconciliation; - -import static org.junit.Assert.*; - -import java.lang.reflect.Method; - -import org.junit.Before; -import org.junit.Test; - -public class ReportRowTest -{ - - private Method _javaMethod1; - private Method _javaMethod2; - - @Before - public void setUp() throws Exception - { - _javaMethod1 = getClass().getMethod("javaMethod1"); - _javaMethod2 = getClass().getMethod("javaMethod2"); - } - - @Test - public void testSames() throws Exception - { - - ReportRow reportRow = new ReportRow("cfunction", _javaMethod1); - Object other = new Object(); - - assertTrue(reportRow.equals(reportRow)); - assertFalse(reportRow.equals(other)); - } - - @Test - public void testEquals() throws Exception - { - - assertTrue(new ReportRow("cfunction", _javaMethod1).equals(new ReportRow("cfunction", _javaMethod1))); - - assertFalse(new ReportRow("cfunction", _javaMethod1).equals(new ReportRow("cfunction2", _javaMethod1))); - assertFalse(new ReportRow("cfunction2", _javaMethod1).equals(new ReportRow("cfunction2", _javaMethod2))); - - assertFalse(new ReportRow("cfunction", _javaMethod1).equals(null)); - - } - - @Test - public void testEqualsWithNulls() throws Exception - { - assertTrue(new ReportRow("cfunction", null).equals(new ReportRow("cfunction", null))); - assertTrue(new ReportRow(null, _javaMethod1).equals(new ReportRow(null, _javaMethod1))); - - assertFalse(new ReportRow("cfunction", _javaMethod1).equals(new ReportRow("cfunction", null))); - assertFalse(new ReportRow("cfunction", _javaMethod1).equals(new ReportRow(null, _javaMethod1))); - } - - // Used by reflection by test methods - public void javaMethod1() - { - } - - // Used by reflection by test methods - public void javaMethod2() - { - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/TestAnnotation.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/TestAnnotation.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/TestAnnotation.java deleted file mode 100644 index 146e397..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/TestAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface TestAnnotation -{ - String value(); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/TestUtils.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/TestUtils.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/TestUtils.java deleted file mode 100644 index 19ba849..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/TestUtils.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -public class TestUtils -{ - public static Set<ReportRow> getReportRowsFrom(ReconciliationReport reconciliationReport) - { - Iterator<ReportRow> rowIterator = reconciliationReport.rowIterator(); - Set<ReportRow> rows = new HashSet<ReportRow>(); - while (rowIterator.hasNext()) - { - rows.add(rowIterator.next()); - } - return rows; - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/PackageSearcherTest.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/PackageSearcherTest.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/PackageSearcherTest.java deleted file mode 100644 index b85cacb..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/PackageSearcherTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher; - -import static org.junit.Assert.assertEquals; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.manyimpls.Impl1; -import org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.manyimpls.Impl2; -import org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.manyimpls.InterfaceWithManyImpls; -import org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.noimpl.InterfaceWithoutImpl; -import org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.tree.ImplAtTreeTop; -import org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.tree.InterfaceAtTreeTop; -import org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.tree.leaf.ImplAtLeaf; -import org.junit.Test; - -public class PackageSearcherTest -{ - private PackageSearcher _packageSearcher = new PackageSearcher(); - - @Test - public void testFindDescendsPackageTree() throws Exception - { - String testDataPackage = InterfaceAtTreeTop.class.getPackage().getName(); - Set<Method> actualMethods = _packageSearcher.findMethods(testDataPackage); - assertEquals(2, actualMethods.size()); - - Set<Method> expectedMethods = new HashSet<Method>(Arrays.asList( - ImplAtTreeTop.class.getMethod("method"), - ImplAtLeaf.class.getMethod("method"))); - - assertEquals(expectedMethods, actualMethods); - } - - @Test - public void testZeroImplenentationsOfInterface() throws Exception - { - String testDataPackage = InterfaceWithoutImpl.class.getPackage().getName(); - - Method expectedMethod = InterfaceWithoutImpl.class.getMethod("method"); - - Set<Method> actualMethods = _packageSearcher.findMethods(testDataPackage); - assertEquals(1, actualMethods.size()); - - Method actualMethod = actualMethods.iterator().next(); - assertEquals(expectedMethod, actualMethod); - } - - @Test - public void testManyImplenentationsOfInterface() throws Exception - { - String testDataPackage = InterfaceWithManyImpls.class.getPackage().getName(); - - Set<Method> actualMethods = _packageSearcher.findMethods(testDataPackage); - assertEquals(2, actualMethods.size()); - - String methodName = "method"; - Set<Method> expectedMethods = new HashSet<Method>(Arrays.asList( - Impl1.class.getMethod(methodName), - Impl2.class.getMethod(methodName))); - - assertEquals(expectedMethods, actualMethods); - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/Impl1.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/Impl1.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/Impl1.java deleted file mode 100644 index 6f9c539..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/Impl1.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.manyimpls; - -public class Impl1 implements InterfaceWithManyImpls -{ - - public void method() - { - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/Impl2.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/Impl2.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/Impl2.java deleted file mode 100644 index 97ac514..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/Impl2.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.manyimpls; - -public class Impl2 implements InterfaceWithManyImpls -{ - - public void method() - { - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/InterfaceWithManyImpls.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/InterfaceWithManyImpls.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/InterfaceWithManyImpls.java deleted file mode 100644 index d5f01fa..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/manyimpls/InterfaceWithManyImpls.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.manyimpls; - -public interface InterfaceWithManyImpls -{ - void method(); - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/noimpl/InterfaceWithoutImpl.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/noimpl/InterfaceWithoutImpl.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/noimpl/InterfaceWithoutImpl.java deleted file mode 100644 index 8d8302f..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/noimpl/InterfaceWithoutImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.noimpl; - -public interface InterfaceWithoutImpl -{ - void method(); -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/subpackage/InterfaceInSubPackage.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/subpackage/InterfaceInSubPackage.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/subpackage/InterfaceInSubPackage.java deleted file mode 100644 index c2b5530..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/subpackage/InterfaceInSubPackage.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.subpackage; - -public interface InterfaceInSubPackage -{ - void methodWithinSubpackage(); -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/subpackage/impl/ImplOfInterfaceInSubPackage.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/subpackage/impl/ImplOfInterfaceInSubPackage.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/subpackage/impl/ImplOfInterfaceInSubPackage.java deleted file mode 100644 index dfda90d..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/subpackage/impl/ImplOfInterfaceInSubPackage.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.subpackage.impl; - -import org.apache.qpid.proton.apireconciliation.TestAnnotation; -import org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.subpackage.InterfaceInSubPackage; - -public class ImplOfInterfaceInSubPackage implements InterfaceInSubPackage -{ - - public static final String VALUE_WITHIN_SUBPACKAGE = "subpackageFunction"; - public static final String METHOD_WITHIN_SUBPACKAGE = "methodWithinSubpackage"; - - @TestAnnotation(VALUE_WITHIN_SUBPACKAGE) - public void methodWithinSubpackage() - { - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/ImplAtTreeTop.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/ImplAtTreeTop.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/ImplAtTreeTop.java deleted file mode 100644 index 8660d68..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/ImplAtTreeTop.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.tree; - -public class ImplAtTreeTop implements InterfaceAtTreeTop -{ - - public void method() - { - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/InterfaceAtTreeTop.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/InterfaceAtTreeTop.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/InterfaceAtTreeTop.java deleted file mode 100644 index 9b85666..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/InterfaceAtTreeTop.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.tree; - -public interface InterfaceAtTreeTop -{ - void method(); - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/leaf/ImplAtLeaf.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/leaf/ImplAtLeaf.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/leaf/ImplAtLeaf.java deleted file mode 100644 index 511cd76..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/leaf/ImplAtLeaf.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.tree.leaf; - -public class ImplAtLeaf implements InterfaceAtLeaf -{ - - public void method() - { - } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/leaf/InterfaceAtLeaf.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/leaf/InterfaceAtLeaf.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/leaf/InterfaceAtLeaf.java deleted file mode 100644 index b12d794..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/packagesearcher/testdata/tree/leaf/InterfaceAtLeaf.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.packagesearcher.testdata.tree.leaf; - -public interface InterfaceAtLeaf -{ - void method(); -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/reportwriter/AnnotationAccessorTest.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/reportwriter/AnnotationAccessorTest.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/reportwriter/AnnotationAccessorTest.java deleted file mode 100644 index 7df2640..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/reportwriter/AnnotationAccessorTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.reportwriter; - -import static org.junit.Assert.*; - -import java.lang.reflect.Method; - -import org.apache.qpid.proton.apireconciliation.TestAnnotation; -import org.junit.Before; -import org.junit.Test; - -public class AnnotationAccessorTest -{ - private static final String ANNOTATION_VALUE_1 = "value1"; - private static final String ANNOTATED_METHOD_NAME = "annotatedMethod"; - private static final String UNANNOTATED_METHOD_NAME = "unannotatedMethod"; - - private Method _annotatedMethod; - private Method _unannotatedMethod; - - private String _annotationClassName; - - private AnnotationAccessor _annotationAccessor; - - @Before - public void setUp() throws Exception - { - _annotatedMethod = getClass().getMethod(ANNOTATED_METHOD_NAME); - _unannotatedMethod = getClass().getMethod(UNANNOTATED_METHOD_NAME); - _annotationClassName = TestAnnotation.class.getName(); - _annotationAccessor = new AnnotationAccessor(_annotationClassName); - } - - @Test - public void testGetAnnotationValue() - { - assertEquals(ANNOTATION_VALUE_1, _annotationAccessor.getAnnotationValue(_annotatedMethod)); - } - - @Test - public void testGetAnnotationValueWithoutAnnotationReturnsNull() - { - assertNull(_annotationAccessor.getAnnotationValue(_unannotatedMethod)); - } - - @TestAnnotation(ANNOTATION_VALUE_1) - public void annotatedMethod() - { - } - - public void unannotatedMethod() - { - } -} http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/reportwriter/ReconciliationReportWriterTest.java ---------------------------------------------------------------------- diff --git a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/reportwriter/ReconciliationReportWriterTest.java b/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/reportwriter/ReconciliationReportWriterTest.java deleted file mode 100644 index 331c9fe..0000000 --- a/design/api-reconciliation/src/test/java/org/apache/qpid/proton/apireconciliation/reportwriter/ReconciliationReportWriterTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.proton.apireconciliation.reportwriter; - -import static org.junit.Assert.*; - -import java.io.File; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; - -import org.apache.commons.io.FileUtils; -import org.apache.qpid.proton.apireconciliation.ReconciliationReport; -import org.apache.qpid.proton.apireconciliation.TestAnnotation; -import org.junit.Before; -import org.junit.Test; - - -public class ReconciliationReportWriterTest -{ - private ReconciliationReportWriter _writer; - private ReconciliationReport _report = new ReconciliationReport(); - - @Before - public void setUp() - { - _writer = new ReconciliationReportWriter(new AnnotationAccessor(TestAnnotation.class.getName())); - } - - @Test - public void testReportWithSingleFullyMappedRow() throws Exception - { - File expectedReport = getClasspathResource("expectedsingle.csv"); - File outputFile = createTemporaryFile(); - - _report.addRow("function1", getClass().getMethod("methodWithMapping")); - _writer.write(outputFile.getAbsolutePath(), _report); - - assertFilesSame(expectedReport, outputFile); - } - - @Test - public void testReportWithManyRowsSomeUnmapped() throws Exception - { - File expectedReport = getClasspathResource("expectedmany.csv"); - File outputFile = createTemporaryFile(); - - _report.addRow("function1", getClass().getMethod("methodWithMapping")); - _report.addRow("function2", getClass().getMethod("anotherMethodWithMapping")); - _report.addRow(null, getClass().getMethod("methodWithoutMapping")); - _report.addRow("function4", null); - _writer.write(outputFile.getAbsolutePath(), _report); - - assertFilesSame(expectedReport, outputFile); - } - - private File getClasspathResource(String filename) throws URISyntaxException - { - URL resource = getClass().getResource(filename); - assertNotNull("Resource " + filename + " could not be found",resource); - return new File(resource.toURI()); - } - - private File createTemporaryFile() throws Exception - { - File tmpFile = File.createTempFile(getClass().getSimpleName(), "csv"); - tmpFile.deleteOnExit(); - return tmpFile; - } - - private void assertFilesSame(File expectedReport, File actualReport) throws IOException - { - assertTrue(expectedReport.canRead()); - assertTrue(actualReport.canRead()); - assertEquals("Report contents unexpected", - FileUtils.readFileToString(expectedReport), - FileUtils.readFileToString(actualReport)); - } - - @TestAnnotation("function1") - public void methodWithMapping() - { - } - - @TestAnnotation("function2") - public void anotherMethodWithMapping() - { - } - - public void methodWithoutMapping() - { - } -} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
