perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6378 - in trunk: . perfsonar-base/apt perfsonar-base/apt/src/ test perfsonar-base/apt/src/test/resources perfsonar-base/ base perfsonar-base/base/src/main/java/net/geant/perfsonar perfsonar-base/base/src/main/java/net/geant/perfsonar/res ponse perfsonar-base/base/src/main/java/net/geant/perfsona r/selftest perfsonar-base/base/src/test/java/net/geant/per fsonar perfsonar-base/base/src/test/java/net/geant/perfson ar/configuration perfsonar-base/base/src/test/java/net/gea nt/perfsonar/helpers perfsonar-base/base/src/test/resource s perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls p erfsonar-base/ls/src/test/resources perfsonar-base/messagi ng perfsonar-base/messaging/src/main/java/net/geant/perfso nar/messaging perfsonar-base/messaging/src/main/java/net/g eant/perfsonar/templates perfsonar-base/messaging/src/test perfsonar-base/messaging/src/test/java/net/geant/perfsona r/messaging perfsonar-base/messaging/src/test/java/net/gea nt/perfsonar/templat es perfsonar-base/messaging/src/test/ resources perfsonar-base/messaging-test-data perfsonar-bas e/sample-service perfsonar-base/sample-service/src/test/ja va/net/geant/perfsonar/mp/sshtelnet perfsonar-java-base2/s rc/main/java/org/perfsonar/base2/service/authn/component/w ssec perfsonar-java-base2/src/main/java/org/perfsonar/base 2/service/configuration perfsonar-java-base2/src/main/java /org/perfsonar/base2/service/messages perfsonar-java-base2 /src/main/java/org/perfsonar/base2/service/registration pe rfsonar-java-base2/src/main/java/org/perfsonar/base2/servi ce/requesthandler perfsonar-java-base2/src/main/java/org/p erfsonar/base2/service/scheduler perfsonar-java-base2/src/ main/java/org/perfsonar/base2/service/storage/xml perfsona r-java-rrd-ma-SQL_backend/doc perfsonar-java-rrd-ma-SQL _backend/src/deb/control perfsonar-java-rrd-ma-SQL_bac kend/src/main/java/org/perfsonar/service/measurementArchiv e/rrdType perfsonar-java-rrd-ma-SQL_backend/src/main/jav a/org/perfsonar/service/measureme ntArchive/rrdType/storag e/rrd perfsonar-java-rrd-ma-SQL_backend/src/main/java/or g/perfsonar/service/measurementArchive/rrdType/storage/sql perfsonar-java-rrd-ma-SQL_backend/src/rpm perfsonar-jav a-web-admin/perfsonar-java-web-admin-component/src/main/ja va/org/perfsonar/webadmin/config perfsonar-java-web-admin/ perfsonar-java-web-admin-component/src/main/java/org/perfs onar/webadmin/servlet/util perfsonar-java-web-admin/perfso nar-java-web-admin-component/src/main/java/org/perfsonar/w ebadmin/test perfsonar-java-xml-ls perfsonar-java-xml-ls/s rc/main/java/org/perfsonar/service/lookupservice perfsonar -java-xml-ls/src/main/java/org/perfsonar/service/lookupser vice/components perfsonar-java-xml-ls/src/main/java/org/pe rfsonar/service/lookupservice/schedulerActions perfsonar-j ava-xml-ls/src/main/java/org/perfsonar/service/lookupservi ce/storage perfsonar-java-xml-ls/src/main/java/org/perfson ar/service/lookupservice/storage/exist
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r6378 - in trunk: . perfsonar-base/apt perfsonar-base/apt/src/ test perfsonar-base/apt/src/test/resources perfsonar-base/ base perfsonar-base/base/src/main/java/net/geant/perfsonar perfsonar-base/base/src/main/java/net/geant/perfsonar/res ponse perfsonar-base/base/src/main/java/net/geant/perfsona r/selftest perfsonar-base/base/src/test/java/net/geant/per fsonar perfsonar-base/base/src/test/java/net/geant/perfson ar/configuration perfsonar-base/base/src/test/java/net/gea nt/perfsonar/helpers perfsonar-base/base/src/test/resource s perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls p erfsonar-base/ls/src/test/resources perfsonar-base/messagi ng perfsonar-base/messaging/src/main/java/net/geant/perfso nar/messaging perfsonar-base/messaging/src/main/java/net/g eant/perfsonar/templates perfsonar-base/messaging/src/test perfsonar-base/messaging/src/test/java/net/geant/perfsona r/messaging perfsonar-base/messaging/src/test/java/net/gea nt/perfsonar/templat es perfsonar-base/messaging/src/test/ resources perfsonar-base/messaging-test-data perfsonar-bas e/sample-service perfsonar-base/sample-service/src/test/ja va/net/geant/perfsonar/mp/sshtelnet perfsonar-java-base2/s rc/main/java/org/perfsonar/base2/service/authn/component/w ssec perfsonar-java-base2/src/main/java/org/perfsonar/base 2/service/configuration perfsonar-java-base2/src/main/java /org/perfsonar/base2/service/messages perfsonar-java-base2 /src/main/java/org/perfsonar/base2/service/registration pe rfsonar-java-base2/src/main/java/org/perfsonar/base2/servi ce/requesthandler perfsonar-java-base2/src/main/java/org/p erfsonar/base2/service/scheduler perfsonar-java-base2/src/ main/java/org/perfsonar/base2/service/storage/xml perfsona r-java-rrd-ma-SQL_backend/doc perfsonar-java-rrd-ma-SQL _backend/src/deb/control perfsonar-java-rrd-ma-SQL_bac kend/src/main/java/org/perfsonar/service/measurementArchiv e/rrdType perfsonar-java-rrd-ma-SQL_backend/src/main/jav a/org/perfsonar/service/measureme ntArchive/rrdType/storag e/rrd perfsonar-java-rrd-ma-SQL_backend/src/main/java/or g/perfsonar/service/measurementArchive/rrdType/storage/sql perfsonar-java-rrd-ma-SQL_backend/src/rpm perfsonar-jav a-web-admin/perfsonar-java-web-admin-component/src/main/ja va/org/perfsonar/webadmin/config perfsonar-java-web-admin/ perfsonar-java-web-admin-component/src/main/java/org/perfs onar/webadmin/servlet/util perfsonar-java-web-admin/perfso nar-java-web-admin-component/src/main/java/org/perfsonar/w ebadmin/test perfsonar-java-xml-ls perfsonar-java-xml-ls/s rc/main/java/org/perfsonar/service/lookupservice perfsonar -java-xml-ls/src/main/java/org/perfsonar/service/lookupser vice/components perfsonar-java-xml-ls/src/main/java/org/pe rfsonar/service/lookupservice/schedulerActions perfsonar-j ava-xml-ls/src/main/java/org/perfsonar/service/lookupservi ce/storage perfsonar-java-xml-ls/src/main/java/org/perfson ar/service/lookupservice/storage/exist
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6378 - in trunk: . perfsonar-base/apt perfsonar-base/apt/src/ test perfsonar-base/apt/src/test/resources perfsonar-base/ base perfsonar-base/base/src/main/java/net/geant/perfsonar perfsonar-base/base/src/main/java/net/geant/perfsonar/res ponse perfsonar-base/base/src/main/java/net/geant/perfsona r/selftest perfsonar-base/base/src/test/java/net/geant/per fsonar perfsonar-base/base/src/test/java/net/geant/perfson ar/configuration perfsonar-base/base/src/test/java/net/gea nt/perfsonar/helpers perfsonar-base/base/src/test/resource s perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls p erfsonar-base/ls/src/test/resources perfsonar-base/messagi ng perfsonar-base/messaging/src/main/java/net/geant/perfso nar/messaging perfsonar-base/messaging/src/main/java/net/g eant/perfsonar/templates perfsonar-base/messaging/src/test perfsonar-base/messaging/src/test/java/net/geant/perfsona r/messaging perfsonar-base/messaging/src/test/java/net/gea nt/perfsonar/templat es perfsonar-base/messaging/src/test/ resources perfsonar-base/messaging-test-data perfsonar-bas e/sample-service perfsonar-base/sample-service/src/test/ja va/net/geant/perfsonar/mp/sshtelnet perfsonar-java-base2/s rc/main/java/org/perfsonar/base2/service/authn/component/w ssec perfsonar-java-base2/src/main/java/org/perfsonar/base 2/service/configuration perfsonar-java-base2/src/main/java /org/perfsonar/base2/service/messages perfsonar-java-base2 /src/main/java/org/perfsonar/base2/service/registration pe rfsonar-java-base2/src/main/java/org/perfsonar/base2/servi ce/requesthandler perfsonar-java-base2/src/main/java/org/p erfsonar/base2/service/scheduler perfsonar-java-base2/src/ main/java/org/perfsonar/base2/service/storage/xml perfsona r-java-rrd-ma-SQL_backend/doc perfsonar-java-rrd-ma-SQL _backend/src/deb/control perfsonar-java-rrd-ma-SQL_bac kend/src/main/java/org/perfsonar/service/measurementArchiv e/rrdType perfsonar-java-rrd-ma-SQL_backend/src/main/jav a/org/perfsonar/service/measureme ntArchive/rrdType/storag e/rrd perfsonar-java-rrd-ma-SQL_backend/src/main/java/or g/perfsonar/service/measurementArchive/rrdType/storage/sql perfsonar-java-rrd-ma-SQL_backend/src/rpm perfsonar-jav a-web-admin/perfsonar-java-web-admin-component/src/main/ja va/org/perfsonar/webadmin/config perfsonar-java-web-admin/ perfsonar-java-web-admin-component/src/main/java/org/perfs onar/webadmin/servlet/util perfsonar-java-web-admin/perfso nar-java-web-admin-component/src/main/java/org/perfsonar/w ebadmin/test perfsonar-java-xml-ls perfsonar-java-xml-ls/s rc/main/java/org/perfsonar/service/lookupservice perfsonar -java-xml-ls/src/main/java/org/perfsonar/service/lookupser vice/components perfsonar-java-xml-ls/src/main/java/org/pe rfsonar/service/lookupservice/schedulerActions perfsonar-j ava-xml-ls/src/main/java/org/perfsonar/service/lookupservi ce/storage perfsonar-java-xml-ls/src/main/java/org/perfson ar/service/lookupservice/storage/exist
- Date: Mon, 13 May 2013 20:34:02 +0100 (BST)
- Authentication-results: sfpop-ironport04.merit.edu; dkim=neutral (message not signed) header.i=none
Author: dante.delvaux
Date: 2013-05-13 20:34:02 +0100 (Mon, 13 May 2013)
New Revision: 6378
Added:
trunk/perfsonar-base/apt/src/test/resources/
trunk/perfsonar-base/apt/src/test/resources/log4j.xml
trunk/perfsonar-base/messaging/src/test/resources/
trunk/perfsonar-base/messaging/src/test/resources/log4j.xml
Removed:
trunk/perfsonar-java-rrd-ma-SQL_backend/doc/ChangeLog.txt
Modified:
trunk/BUILDING.txt
trunk/README.txt
trunk/RELEASES.txt
trunk/perfsonar-base/apt/
trunk/perfsonar-base/base/pom.xml
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/Configuration.java
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/PerfSONAR.java
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/response/EchoResponse.java
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/response/SelfTestResponse.java
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/selftest/SelfTestRunner.java
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/Handlers.java
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/configuration/ConfigurationTest.java
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/configuration/SelfTestsTest.java
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/helpers/Response.java
trunk/perfsonar-base/base/src/test/resources/log4j.xml
trunk/perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls/LSRegistrationTask.java
trunk/perfsonar-base/ls/src/test/resources/log4j.xml
trunk/perfsonar-base/messaging-test-data/pom.xml
trunk/perfsonar-base/messaging/
trunk/perfsonar-base/messaging/pom.xml
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/DeserializationException.java
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/Helper.java
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/Method.java
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/SelfTestResult.java
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/XPathDeserializer.java
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/templates/TemplateEngine.java
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/InvalidXPathsTest.java
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodOnObjectTest.java
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodTest.java
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodThrowsExceptionTest.java
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/StaticMethodTest.java
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/XPathDeserializerTest.java
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates/TemplateEngineTest.java
trunk/perfsonar-base/sample-service/
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPTest.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/authn/component/wssec/WSSecAuthNComponent.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/Actions.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/OptionEntry.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/messages/GenericMessageHandler.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/registration/AbstractRegistrationAction.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/registration/MetadataExistDBRegisterDataSource.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/requesthandler/EchoServiceEngine.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/scheduler/SchedulingComponent.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/scheduler/SimpleScheduler.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/storage/xml/XMLDBComponent.java
trunk/perfsonar-java-rrd-ma-SQL_backend/doc/Collaboration.txt
trunk/perfsonar-java-rrd-ma-SQL_backend/doc/backward-compatibility.txt
trunk/perfsonar-java-rrd-ma-SQL_backend/doc/configure.ls-registration.txt
trunk/perfsonar-java-rrd-ma-SQL_backend/doc/copyright
trunk/perfsonar-java-rrd-ma-SQL_backend/src/deb/control/changelog
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/EchoServiceEngine.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/MetadataKeyMessageHandler.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/SetupDataServiceEngine.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/rrd/RRDDataStorageDAOImpl.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/MysqlMetadataStorageDAOImpl.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/rpm/changelog
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/config/HTMLGenerator.java
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/config/ObjectMap.java
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/servlet/util/ConfigurationServletHelper.java
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/test/SOAPClient.java
trunk/perfsonar-java-xml-ls/pom.xml
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegistrationMessageHandler.java
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/DataSourceComponent.java
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/ModificationCounterComponent.java
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/XMLDBComponent.java
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/schedulerActions/CleanupSchedulerAction.java
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/schedulerActions/GLSRegistrationAction.java
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/LookupServiceDAOFactory.java
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryDAOSupportImpl.java
Log:
Rationalising logger instantiations (in base3 and base2).
Adding proper log4j configuration for base3 with velocity logs.
Correcting minor checkstyle issues.
Updating project documentation.
Modified: trunk/BUILDING.txt
===================================================================
--- trunk/BUILDING.txt 2013-05-13 09:33:12 UTC (rev 6377)
+++ trunk/BUILDING.txt 2013-05-13 19:34:02 UTC (rev 6378)
@@ -25,7 +25,7 @@
It is not immediately possible to just cd into a subdirectory and
execute Maven on a single project only. Such an attempt would fail
-because dependencies like perfSONAR Base 1 would be unavailable (this
+because dependencies like perfSONAR Base would be unavailable (this
is only partially true as we use GÉANT's continuous integration
service, Jenkins, to build the latest version and publish artifacts in
the GÉANT Artifactory repository - you would however be using the
@@ -44,8 +44,9 @@
Maven project structure
-----------------------
-The top-level directory contains the Maven aggregator project. The
-sole purpose of this project is to list sub-projects as modules.
+The top-level directory contains the Maven aggregator project. The sole
purpose
+of this project is to list sub-projects as modules and make the build work
as a
+whole (locally and in CI).
Sub-projects all refer to a parent project in the parent
directory. Common Maven settings are specified in the parent and
@@ -62,23 +63,30 @@
the version number of the plugin should only ever be specified in the
parent. This ensure consistency.
+ A few plugins are enabled for all sub-projects (see <build> section of
parent
+ pom) so the same configuration is enforced in all sub-projects.
+
- Dependency version numbers.
- Same remark as for the plugin, the dependencies are enabled in sub-
+ Same remark as for the plugins, the dependencies are enabled in sub-
projects, but for consistency, the version numbers is only specified
in the parent. In some cases (usually old packages), dependencies
version numbers are given in the sub-project, however this should be
avoided.
-- Project management information like organization, license, issue
- management, continous integration, Artficatory references, common
+- Project management information like organisation, license, issue
+ management, continuous integration, Artficatory references, common
Maven repositories.
- Reporting configuration used to generate a Maven site report.
-Note again that currently not all subproducts follow this structure.
+Note again that currently not all subproducts follow this structure, but any
new
+one MUST follow it.
+You should also refer to the documentation and comments inside the different
+pom.xml files for more information.
+
Packaging
---------
@@ -117,14 +125,19 @@
perfSONAR uses GÉANTs continuous integration platform, Jenkins, at
https://ci.geant.net/.
-The perfSONAR-CI job monitors the SVN repository and any commit
-triggers a new build. If the build is successful, all artifacts are
-published at http://artifactory.geant.net/.
+The perfSONAR-CI job monitors the SVN repository and any commit triggers a
new
+build. If the build is successful, all artifacts are then published at
+http://artifactory.geant.net/ where they are publicly downloadable.
-Statistics from static analysis are kept, and the output of Unit
-tests, findbugs, and pmd can be inspected in Jenkins.
+Statistics from static analysis are kept, and the output of Unit tests,
+findbugs, and pmd can be inspected in Jenkins.
+Releases
+--------
+Jenkins can also perform release of individual sub-projects, see the
+RELEASES.txt file for more information.
+
Legacy stuff
------------
Modified: trunk/README.txt
===================================================================
--- trunk/README.txt 2013-05-13 09:33:12 UTC (rev 6377)
+++ trunk/README.txt 2013-05-13 19:34:02 UTC (rev 6378)
@@ -1,31 +1,28 @@
perfSONAR Java Services
=======================
-perfSONAR consists of several subproducts, such as the Measurement
-Archives (MA) SQL MA and RRD MA, the Measurement Points (MP) OWAMP MP
-and BWCTL MP, and the Lookup Service (LS). Some of these are written
-in Java, collectively called the perfSONAR Java Services. These
-include the MAs and the LS.
+perfSONAR consists of several subproducts, such as the Measurement Archives
(MA)
+SQL MA and RRD MA, the Measurement Points (MP) OWAMP MP and BWCTL MP, and the
+Lookup Service (LS). Some of these are written in Java, collectively called
the
+perfSONAR Java Services. These include the MAs and the LS.
-Notably, the MPs are not written in Java and are hosted outside of
-this repository. The UI is written in Java, but still not considered
-part of the perfSONAR Java Services and not hosted in this repository.
+Notably, the MPs are not written in Java and are hosted outside of this
+repository. The UI is written in Java, but not considered part of the
perfSONAR
+Java Services and not hosted in this repository.
-
Coding style
------------
-Syntactic conventions are described and enforced using
-checkstyle. Please consult the checkstyle configuration, e.g., in
-perfsona_base/src/checkstyle/checkstyle.xml.
+Syntactic conventions are described and enforced using checkstyle and pmd.
+Please consult the checkstyle and pmd configuration, in the parent/pom.xml
+and in parent/checkstyle/checkstyle.xml.
-Due to plenty of legacy code, some modules use a slightly relaxed set
-of rules. This is only to accommodate legacy code and any checkstyle
-warning should be considered a violation in new code.
+Due to plenty of legacy code, some modules use a slightly relaxed set of
rules.
+This is only to accommodate legacy code and any checkstyle warning should be
+considered a violation in new code.
-
Programming methodology
-----------------------
@@ -91,7 +88,6 @@
Method and field level JavaDoc SHOULD be used if applicable.
-
- When using third party libraries, limit your choice to active
projects. Abandoned libraries should be replaced.
@@ -108,16 +104,16 @@
library and ask them to split the needed functionality out into a
separate library.
-
- Make your code DRY: Don't Repeat Yourself.
- The same is true for Maven project files.
+ The same is true for Maven project files, when things are repeated, they're
+ probably better be in the parent pom.
- Follow established conventions unless you have a good argument not
to.
- In particular Maven encourages convention over configuration, so
- stop fighting Maven and do it the Maven way.
+ In particular Maven encourages convention over configuration, so stop
fighting
+ Maven and do it the Maven way.
- Keep an eye on static analysis tools like PMD, FindBugs and IntelliJ.
@@ -140,6 +136,13 @@
your IDE to configuration to Maven configuration rather than the opposite.
For Eclipse, the easiest way is to checkout the whole perfsonar-java-services
-repository and then import the whole directory as Maven projects into the
-Eclipse. Eclipse should then automatically discover each enclosed projects
-and Maven dependencies.
+repository and then import the whole directory as Maven projects into
Eclipse.
+Eclipse should then automatically discover each enclosed projects and Maven
+dependencies.
+
+When publishing your directories to SVN, please exclude any local files and
+settings and all auto-generated content, in particular, the following should
be
+added to svn:ignore:
+ - Eclipse files: .classpath, .project, .settings
+ - Maven plugins files: .pmd, .pmdruleset, .checkstyle
+ - Build and work directories: /build /logs /reports /target
Modified: trunk/RELEASES.txt
===================================================================
--- trunk/RELEASES.txt 2013-05-13 09:33:12 UTC (rev 6377)
+++ trunk/RELEASES.txt 2013-05-13 19:34:02 UTC (rev 6378)
@@ -9,6 +9,7 @@
(see BUILDING.txt), they're not released together, not even at the same time.
Each java artifact has its own life cycle.
+
Releasing a java module
-----------------------
The perfSONAR java services each contain a few different java modules. Each
of
@@ -25,6 +26,7 @@
- in trunk, the version number will be increased and -SNAPSHOT added again
- the module will be published to the artifactory server
+
Replacing references to -SNAPSHOT with a new release
----------------------------------------------------
After having released a new module, run:
@@ -32,7 +34,8 @@
After having released a new parent, run:
mvn versions:update-parent
-
+
+
With Jenkins
------------
This is the recommended way of making a release: through the pS-rel Jenkins
job
@@ -61,11 +64,16 @@
This deployment (default release:perform) also publish a source and a javadoc
jars. We need to see if we want to keep this.
+
Releasing a perfSONAR service
-----------------------------
When releasing a full perfSONAR service, this one must depend on released
java
-artifacts, no SNAPSHOT package should be used!
+artifacts, no SNAPSHOT package should be used in a proper released service!
+The changelog files (usually one for .deb and another one for .rpm) must be
+updated accordingly with the development done since the last version.
+
+
Notes
-----
See mvn-settings.xml if you have some issues finding a released parent
pom.xml
Property changes on: trunk/perfsonar-base/apt
___________________________________________________________________
Modified: svn:ignore
- target
.settings
.classpath
.project
.pmd
.pmdruleset
.checkstyle
+ logs
target
.settings
.classpath
.project
.pmd
.pmdruleset
.checkstyle
Added: trunk/perfsonar-base/apt/src/test/resources/log4j.xml
===================================================================
--- trunk/perfsonar-base/apt/src/test/resources/log4j.xml
(rev 0)
+++ trunk/perfsonar-base/apt/src/test/resources/log4j.xml 2013-05-13
19:34:02 UTC (rev 6378)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+
+<!-- This is the configuration for LOG4J for perfSONAR development/testing
purposes -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <!-- Section: APPENDERS -->
+
+ <!--
+ writes log messages to the console. It outputs file name,
+ method name and line number of the caller. This is slow,
+ so just use it for debugging.
+ -->
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d - [%p] %c{1}[%M]:%L -
%m %n"/>
+ </layout>
+ </appender>
+
+ <!-- We have a log file for pSbase -->
+ <appender name="psbase" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/psbase.log"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="MaxBackupIndex" value="5"/>
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
+ </layout>
+ </appender>
+
+ <!-- We have a log file for velocity -->
+ <appender name="velocity" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/velocity.log"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="MaxBackupIndex" value="5"/>
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
+ </layout>
+ </appender>
+
+ <!-- Velocity is logged only to its own file -->
+ <logger name="velocity" additivity="false">
+ <level value="info"/>
+ <appender-ref ref="velocity"/>
+ </logger>
+
+ <!-- pSbase -->
+ <logger name="net.geant.perfsonar">
+ <level value="debug"/>
+ <appender-ref ref="psbase"/>
+ </logger>
+
+
+ <!-- Console logging for everything else -->
+ <root>
+ <level value="info"/>
+ <appender-ref ref="console"/>
+ </root>
+
+</log4j:configuration>
Property changes on: trunk/perfsonar-base/apt/src/test/resources/log4j.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/perfsonar-base/base/pom.xml
===================================================================
--- trunk/perfsonar-base/base/pom.xml 2013-05-13 09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-base/base/pom.xml 2013-05-13 19:34:02 UTC (rev 6378)
@@ -21,7 +21,7 @@
<developerConnection>scm:svn:svn+ssh:///GEANT/SA2/ps-java-services/trunk/perfsonar-base/base/</developerConnection>
<url>https://svn.geant.net/fisheye/browse/SA2T3-ps-java-services/trunk/perfsonar-base/base/</url>
</scm>
-
+
<build>
<plugins>
<plugin>
Modified:
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/Configuration.java
===================================================================
---
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/Configuration.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/Configuration.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -38,8 +38,7 @@
private static Map<String, Method> handlers = new Hashtable<String,
Method>();
private Configuration() {
- // Utility class, we don't want to be instantiated directly, we're
private
- super();
+ // Utility class, we block external instantiation
}
/**
Modified:
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/PerfSONAR.java
===================================================================
---
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/PerfSONAR.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/PerfSONAR.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -54,6 +54,7 @@
protected boolean usingAPT = false;
public PerfSONAR() {
+ logger.trace("Instanciating a new perfSONAR service");
try {
declarePrefix("nmwg", "http://ggf.org/ns/nmwg/base/2.0/");
declarePrefix("nmwgr", "http://ggf.org/ns/nmwg/result/2.0/");
@@ -68,10 +69,12 @@
any(NMWGMessage.class)));
} catch (Exception ex) {
// No exception will be thrown. It is just for compiling code.
- logger.debug("Exception caught when parsing service
configuration: {}", ex.getMessage());
+ logger.warn("Exception caught when parsing service
configuration: {}", ex.getMessage());
}
+ logger.trace("Trying to configure the new perfSONAR service");
loadConfiguration();
+ logger.trace("Configuring the EchoRequestHandler of the new
perfSONAR service");
EchoRequestHandler.setScheduler(scheduler);
EchoRequestHandler.setServiceName(getServiceName());
EchoRequestHandler.setServiceType((getServiceType() == null) ? null
: getServiceType().toString());
@@ -107,7 +110,7 @@
try {
return
Class.forName("net.geant.perfsonar.SelfTestsConfiguration");
} catch (ClassNotFoundException ex) {
- logger.debug("SelfTestConfiguration class not found!");
+ logger.trace("SelfTestConfiguration class not found!");
return null;
}
}
@@ -116,7 +119,7 @@
try {
return
Class.forName("net.geant.perfsonar.LookupServiceRegister");
} catch (ClassNotFoundException ex) {
- logger.debug("LookupServiceRegister class not found!");
+ logger.trace("LookupServiceRegister class not found!");
return null;
}
}
@@ -125,7 +128,7 @@
try {
return Class.forName("net.geant.perfsonar.Handlers");
} catch (ClassNotFoundException ex) {
- logger.debug("Handlers class not found!");
+ logger.trace("Handlers class not found!");
return null;
}
}
@@ -134,7 +137,7 @@
try {
return Class.forName("net.geant.perfsonar.XPaths");
} catch (ClassNotFoundException ex) {
- logger.debug("XPaths class not found!");
+ logger.trace("XPaths class not found!");
return null;
}
}
Modified:
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/response/EchoResponse.java
===================================================================
---
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/response/EchoResponse.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/response/EchoResponse.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -13,8 +13,7 @@
public final class EchoResponse {
private EchoResponse() {
- // Utility class, we don't want to be instantiated directly, we're
private
- super();
+ // Utility class, we block external instantiation
}
public static void writeEcho(Writer writer, String requestId) throws
IOException {
Modified:
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/response/SelfTestResponse.java
===================================================================
---
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/response/SelfTestResponse.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/response/SelfTestResponse.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -16,7 +16,7 @@
* @author <a
href="mailto:">Blazej
Pietrzak</a>
*/
public class SelfTestResponse implements SelfTestLogger {
- private static Logger logger =
LoggerFactory.getLogger(SelfTestResponse.class);
+ protected Logger logger = LoggerFactory.getLogger(getClass());
private Writer writer;
Modified:
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/selftest/SelfTestRunner.java
===================================================================
---
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/selftest/SelfTestRunner.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/selftest/SelfTestRunner.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -19,134 +19,147 @@
*/
public class SelfTestRunner implements MethodInterceptor {
- private static String name;
- private static Map<String, SelfTest> tests = new Hashtable<String,
SelfTest>();
- private static Map<String, SelfTest> parameterizedTests = new
Hashtable<String, SelfTest>();
- private static Map<Class<?>, Method> testData = new
Hashtable<Class<?>, Method>();
-
- private static String successMessage;
- private static Method testDataMethod;
+ private static String name;
+ private static Map<String, SelfTest> tests = new Hashtable<String,
SelfTest>();
+ private static Map<String, SelfTest> parameterizedTests = new
Hashtable<String, SelfTest>();
+ private static Map<Class<?>, Method> testData = new Hashtable<Class<?>,
Method>();
- public void runSuite(final Scheduler scheduler, final SelfTestLogger
logger) throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException, InstantiationException {
- proccessParameterizedTests();
-// final List<Runnable> tasks = new ArrayList<Runnable>();
- for (final String testName : tests.keySet()) {
- final Runnable task = createTask(testName, logger);
- task.run();
- //scheduler.runInParallel(task);
- //tasks.add(task);
- }
-// try {
-// scheduler.waitToFinish(tasks.toArray(new
Runnable[0]));
-// } catch (Exception ex) {
-// throw new RuntimeException("Cannot run self tests:",
ex);
-// }
- }
-
- public void runTest(final String testName, final Scheduler scheduler,
final SelfTestLogger logger) throws IllegalArgumentException,
IllegalAccessException, InvocationTargetException, InstantiationException {
- proccessParameterizedTests();
- final Runnable task = createTask(testName, logger);
- scheduler.runInParallel(task);
- try {
- scheduler.waitToFinish(task);
- } catch (Exception ex) {
- logger.failure(testName, ex.getMessage());
- }
- }
+ private static String successMessage;
+ private static Method testDataMethod;
- private Runnable createTask(final String testName, final
SelfTestLogger logger) {
- return new Runnable(){
- @Override
- public void run() {
- final SelfTest test = tests.get(testName);
- if (test == null)
- throw new RuntimeException("Cannot
find self test named: " + testName);
- test.run(logger);
- }
- };
- }
-
- private void proccessParameterizedTests() throws
IllegalArgumentException, IllegalAccessException, InvocationTargetException,
InstantiationException {
- for (SelfTest test : parameterizedTests.values()) {
- Method data = testData.get(test.getParameterType());
- if (data == null)
- throw new RuntimeException("Self test without
self test data: " + test.getName());
-
- int i = 0;
- for (Object arg : (List<?>)
data.invoke(newInstance(data))) {
- final SelfTest temp = new
SelfTest(test.getName(), test.getSuccessMessage(), test.getMethod(), i++,
arg);
- tests.put(temp.getName(), temp);
- }
- }
-
- parameterizedTests.clear();
- }
+ public void runSuite(final Scheduler scheduler, final SelfTestLogger
logger) throws
+ IllegalAccessException, InvocationTargetException,
InstantiationException {
+ proccessParameterizedTests();
+ // final List<Runnable> tasks = new ArrayList<Runnable>();
+ for (final String testName : tests.keySet()) {
+ final Runnable task = createTask(testName, logger);
+ task.run();
+ // scheduler.runInParallel(task);
+ // tasks.add(task);
+ }
+ // try {
+ // scheduler.waitToFinish(tasks.toArray(new Runnable[0]));
+ // } catch (Exception ex) {
+ // throw new RuntimeException("Cannot run self tests:", ex);
+ // }
+ }
- private Object newInstance(Method m) throws InstantiationException,
IllegalAccessException {
- return m.getDeclaringClass().newInstance();
- }
+ public void runTest(final String testName, final Scheduler scheduler,
final SelfTestLogger logger)
+ throws IllegalAccessException, InvocationTargetException,
InstantiationException {
+ proccessParameterizedTests();
+ final Runnable task = createTask(testName, logger);
+ scheduler.runInParallel(task);
+ try {
+ scheduler.waitToFinish(task);
+ } catch (Exception ex) {
+ logger.failure(testName, ex.getMessage());
+ }
+ }
- @SuppressWarnings("unchecked")
- public static <T> T addSelfTest(String name, String successMessage,
Class<T> test) {
- SelfTestRunner.name = name;
- SelfTestRunner.successMessage = successMessage;
- return (T) Enhancer.create(test, new SelfTestRunner());
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T selfTestData(Class<T> testData) {
- SelfTestRunner.name = null;
- SelfTestRunner.successMessage = null;
- return (T) Enhancer.create(testData, new SelfTestRunner());
- }
-
- public static <T> void configureForType(Class<T> type, List<T>
methodInvocation) {
- SelfTestRunner.testData.put(type,
SelfTestRunner.testDataMethod);
- SelfTestRunner.testDataMethod = null;
- }
-
- public static <T> T any(Class<T> type) {
- return null;
- }
+ private Runnable createTask(final String testName, final SelfTestLogger
logger) {
+ return new Runnable() {
+ @Override
+ public void run() {
+ final SelfTest test = tests.get(testName);
+ if (test == null) {
+ throw new RuntimeException("Cannot find self test named:
" + testName);
+ }
+ test.run(logger);
+ }
+ };
+ }
- @SuppressWarnings("rawtypes")
- @Override
- public Object intercept(Object obj, Method method, Object[] args,
MethodProxy proxy) throws Throwable {
- if (method.getName().equals("toString") ||
method.getName().equals("hashCode")) {
- return proxy.invokeSuper(obj, args);
- }
-
- if (!method.getReturnType().equals(Void.TYPE) &&
!isSelfTestData())
- throw new RuntimeException(method.toString() + ":
Self test method should be of type void.");
- else if (isSelfTestData()) {
- if (!method.getReturnType().isInstance(new
ArrayList()))
- throw new RuntimeException(method.toString()
+ ": Self test data method must be of List<E> type where E is type of self
test's argument type.");
- if (method.getParameterTypes().length != 0)
- throw new RuntimeException(method.toString()
+ ": Self test data method cannot have any arguments.");
- SelfTestRunner.testDataMethod = method;
- return null;
- }
-
- if (method.getParameterTypes().length > 1)
- throw new RuntimeException(method.toString() + ";
Self test method can have zero or one arguments.");
-
- if (method.getParameterTypes().length == 1)
-
SelfTestRunner.parameterizedTests.put(SelfTestRunner.name, new
SelfTest(SelfTestRunner.name, SelfTestRunner.successMessage, method));
- else
- SelfTestRunner.tests.put(SelfTestRunner.name, new
SelfTest(SelfTestRunner.name, SelfTestRunner.successMessage, method));
- return null;
- }
+ private void proccessParameterizedTests() throws IllegalAccessException,
+ InvocationTargetException, InstantiationException {
+ for (SelfTest test : parameterizedTests.values()) {
+ Method data = testData.get(test.getParameterType());
+ if (data == null) {
+ throw new RuntimeException("Self test without self test
data: " + test.getName());
+ }
- private boolean isSelfTestData() {
- return SelfTestRunner.name == null &&
SelfTestRunner.successMessage == null;
- }
+ int i = 0;
+ for (Object arg : (List<?>) data.invoke(newInstance(data))) {
+ final SelfTest temp = new SelfTest(test.getName(),
test.getSuccessMessage(), test.getMethod(), i++, arg);
+ tests.put(temp.getName(), temp);
+ }
+ }
- public static void clearConfiguration() {
- SelfTestRunner.parameterizedTests.clear();
- SelfTestRunner.name = null;
- SelfTestRunner.successMessage = null;
- SelfTestRunner.testData.clear();
- SelfTestRunner.testDataMethod = null;
- SelfTestRunner.tests.clear();
- }
+ parameterizedTests.clear();
+ }
+
+ private Object newInstance(Method m) throws InstantiationException,
IllegalAccessException {
+ return m.getDeclaringClass().newInstance();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T addSelfTest(String name, String successMessage,
Class<T> test) {
+ SelfTestRunner.name = name;
+ SelfTestRunner.successMessage = successMessage;
+ return (T) Enhancer.create(test, new SelfTestRunner());
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T selfTestData(Class<T> testData) {
+ SelfTestRunner.name = null;
+ SelfTestRunner.successMessage = null;
+ return (T) Enhancer.create(testData, new SelfTestRunner());
+ }
+
+ public static <T> void configureForType(Class<T> type, List<T>
methodInvocation) {
+ SelfTestRunner.testData.put(type, SelfTestRunner.testDataMethod);
+ SelfTestRunner.testDataMethod = null;
+ }
+
+ public static <T> T any(Class<T> type) {
+ return null;
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object intercept(Object obj, Method method, Object[] args,
MethodProxy proxy) throws Throwable {
+ if (method.getName().equals("toString") ||
method.getName().equals("hashCode")) {
+ return proxy.invokeSuper(obj, args);
+ }
+
+ if (!method.getReturnType().equals(Void.TYPE) && !isSelfTestData()) {
+ throw new RuntimeException(method.toString() + ": Self test
method should be of type void.");
+ } else if (isSelfTestData()) {
+ if (!method.getReturnType().isInstance(new ArrayList())) {
+ throw new RuntimeException(
+ method.toString()
+ + ": Self test data method must be of
List<E> type where E is type of self test's argument type.");
+ }
+ if (method.getParameterTypes().length != 0) {
+ throw new RuntimeException(method.toString() + ": Self test
data method cannot have any arguments.");
+ }
+ SelfTestRunner.testDataMethod = method;
+ return null;
+ }
+
+ if (method.getParameterTypes().length > 1) {
+ throw new RuntimeException(method.toString() + "; Self test
method can have zero or one arguments.");
+ }
+
+ if (method.getParameterTypes().length == 1) {
+ SelfTestRunner.parameterizedTests.put(SelfTestRunner.name, new
SelfTest(SelfTestRunner.name,
+ SelfTestRunner.successMessage, method));
+ } else {
+ SelfTestRunner.tests.put(SelfTestRunner.name, new
SelfTest(SelfTestRunner.name,
+ SelfTestRunner.successMessage, method));
+ }
+ return null;
+ }
+
+ private boolean isSelfTestData() {
+ return SelfTestRunner.name == null && SelfTestRunner.successMessage
== null;
+ }
+
+ public static void clearConfiguration() {
+ SelfTestRunner.parameterizedTests.clear();
+ SelfTestRunner.name = null;
+ SelfTestRunner.successMessage = null;
+ SelfTestRunner.testData.clear();
+ SelfTestRunner.testDataMethod = null;
+ SelfTestRunner.tests.clear();
+ }
}
Modified:
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/Handlers.java
===================================================================
--- trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/Handlers.java
2013-05-13 09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/Handlers.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -1,6 +1,8 @@
package net.geant.perfsonar;
import static net.geant.perfsonar.Configuration.*;
+//import static net.geant.perfsonar.Configuration.configure;
+//import static net.geant.perfsonar.Configuration.when;
/**
* Test class for testing handler methods.
Modified:
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
===================================================================
---
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -10,6 +10,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
@@ -31,6 +32,7 @@
static final String REQUEST_ID = "request1";
private PerfSONARClient client;
+
private PerfSONAR service = new PerfSONAR() {
@Override
@@ -46,6 +48,7 @@
@Before
public void givenPerfSONARClient() {
+ logger.debug("Preparing for a unit test for perfSONAR tests");
addSelfTest("constant", "Success Message.",
SampleTests.class).constantTest();
addSelfTest("add test ${index}", "Added ${arg}.",
SampleTests.class).add(any(Integer.class));
configureForType(Integer.class,
selfTestData(SampleTests.class).values());
@@ -60,7 +63,10 @@
@Test
public void shouldLoadConfiguration() throws Exception {
- assertEquals(PerfSONARTest.class.getMethod("dummyMethod"),
Configuration.getHandler("TestRequest"));
+ logger.info("•••• Testing configuration loading.");
+ Method dM = Configuration.getHandler("TestRequest");
+ logger.debug("Method is: {}", dM);
+ assertEquals(PerfSONARTest.class.getMethod("dummyMethod"), dM);
}
// Needed for above test
@@ -70,11 +76,13 @@
@Test
public void checkEchoConfiguration() throws Exception {
+ logger.info("•••• Testing echo request configuration.");
assertNotNull(Configuration.getHandler("EchoRequest"));
}
@Test
public void checkEcho() throws Exception {
+ logger.info("•••• Testing echo request response.");
assertEquals(new Response(NMWG.toEchoResponse(REQUEST_ID)),
client.echo(REQUEST_ID));
}
@@ -86,6 +94,7 @@
*/
@Test
public void checkEchoLogging() throws Exception {
+ logger.info("•••• Testing echo request logging.");
Response expectedResponse = new
Response(NMWG.toEchoResponse(REQUEST_ID));
Response generatedResponse = client.echo(REQUEST_ID);
logger.debug("Expected response: {}", expectedResponse);
@@ -95,6 +104,7 @@
@Test
public void checkSelfTest() throws Throwable {
+ logger.info("•••• Testing a simple self test.");
SelfTestResult expectedResult = success("constant", "Success
Message.", service.getServiceName(), service
.getServiceType().toString());
SelfTestResult generatedResult = client.selfTest(REQUEST_ID,
"constant");
@@ -105,6 +115,7 @@
@Test
public void checkAllSelfTests() throws Throwable {
+ logger.info("•••• Testing all self tests.");
assertEquals(
asList(success("add test 0", "Added 1.",
service.getServiceName(), service.getServiceType().toString()),
success("add test 1", "Added 2.",
service.getServiceName(), service.getServiceType().toString()),
Modified:
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/configuration/ConfigurationTest.java
===================================================================
---
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/configuration/ConfigurationTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/configuration/ConfigurationTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -7,20 +7,25 @@
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import static net.geant.perfsonar.Configuration.any;
import static net.geant.perfsonar.Configuration.configure;
import static net.geant.perfsonar.Configuration.when;
public class ConfigurationTest {
+ protected Logger logger = LoggerFactory.getLogger(getClass());
@Before
public void setUp() throws Exception {
+ logger.debug("Preparing for a unit test");
Configuration.clearConfiguration();
}
@Test
public void shouldListAvailableCommands() throws Exception {
+ logger.info("•••• Trying to list available commands");
configure(when("MetadataKeyRequest").then(ServiceController.class).listAvailableRoutersAndCommands());
assertEquals(ServiceController.class.getMethod("listAvailableRoutersAndCommands"),
@@ -29,6 +34,7 @@
@Test
public void shouldExecuteCommand() throws Exception {
+ logger.info("•••• Trying to execute a command");
configure(when("SetupDataRequest").then(ServiceController.class).execute(any(String.class)));
assertEquals(ServiceController.class.getMethod("execute",
String.class),
Modified:
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/configuration/SelfTestsTest.java
===================================================================
---
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/configuration/SelfTestsTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/configuration/SelfTestsTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -23,8 +23,12 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class SelfTestsTest {
+ protected Logger logger = LoggerFactory.getLogger(getClass());
+
private Scheduler scheduler = new Scheduler() {
@Override
public void runInParallel(Runnable task) {
@@ -48,7 +52,7 @@
}
};
- private SelfTestLogger logger = new SelfTestLogger() {
+ private SelfTestLogger mySelfTestLogger = new SelfTestLogger() {
@Override
public void success(String name, String successMessage) {
testResults.add(SelfTestResult.success(name, successMessage,
"name", "type"));
@@ -65,6 +69,7 @@
@Before
public void givenSelfTests() {
+ logger.debug("Preparing for a unit test for self tests");
addSelfTest("constant", "Success Message",
SampleTests.class).constantTest();
addSelfTest("add test ${index}", "Added ${arg}.",
SampleTests.class).add(any(Integer.class));
configureForType(Integer.class,
selfTestData(SampleTests.class).values());
@@ -80,13 +85,15 @@
@Test
public void shouldRunTest() throws IllegalAccessException,
InvocationTargetException, InstantiationException {
- new SelfTestRunner().runTest("add test 1", scheduler, logger);
+ logger.info("•••• Trying to run a self test through the scheduler");
+ new SelfTestRunner().runTest("add test 1", scheduler,
mySelfTestLogger);
assertEquals(asList(success("add test 1", "Added 2.", "name",
"type")), testResults);
}
@Test
public void shouldRunSuite() throws Exception {
- new SelfTestRunner().runSuite(scheduler, logger);
+ logger.info("•••• Trying to run a self suite through the scheduler");
+ new SelfTestRunner().runSuite(scheduler, mySelfTestLogger);
assertEquals(
Arrays.asList(success("add test 0", "Added 1.", "name",
"type"),
success("add test 1", "Added 2.", "name", "type"),
Modified:
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/helpers/Response.java
===================================================================
---
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/helpers/Response.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/helpers/Response.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -17,11 +17,9 @@
public class Response {
protected Logger logger = LoggerFactory.getLogger(getClass());
private final Reader input;
- // The stream can only be parsed once, so we need to store it as a
string to
- // re-use it
+ // The stream can only be parsed once, so we need to store it as a
string to re-use it
// Otherwise, we run into "Premature end of file errors" when parsing
twice
- // See
- //
http://www.danielschneller.com/2008/01/saxparseexception-1-1-premature-end-of.html
+ // See
http://www.danielschneller.com/2008/01/saxparseexception-1-1-premature-end-of.html
private String inputString;
public Response(InputStream input) {
Modified: trunk/perfsonar-base/base/src/test/resources/log4j.xml
===================================================================
--- trunk/perfsonar-base/base/src/test/resources/log4j.xml 2013-05-13
09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-base/base/src/test/resources/log4j.xml 2013-05-13
19:34:02 UTC (rev 6378)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
-<!-- This is the configuration for LOG4J for perfSONAR testing purposes -->
+<!-- This is the configuration for LOG4J for perfSONAR development/testing
purposes -->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
@@ -23,30 +23,40 @@
<appender name="psbase" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="logs/psbase.log"/>
<param name="MaxFileSize" value="10MB"/>
- <param name="MaxBackupIndex" value="7"/>
+ <param name="MaxBackupIndex" value="5"/>
<param name="Encoding" value="UTF-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
- </layout>
+ </layout>
</appender>
- <!-- Disabling verbose logging from included libs -->
- <category name="org" additivity="false">
- <priority value="warn"/>
- <appender-ref ref="console"/>
- <appender-ref ref="psbase"/>
- </category>
+ <!-- We have a log file for velocity -->
+ <appender name="velocity" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/velocity.log"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="MaxBackupIndex" value="5"/>
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
+ </layout>
+ </appender>
+
+ <!-- Velocity is logged only to its own file -->
+ <logger name="velocity" additivity="false">
+ <level value="info"/>
+ <appender-ref ref="velocity"/>
+ </logger>
- <!-- psBase logging, including test output -->
- <category name="net.geant.perfsonar" additivity="false">
- <priority value="debug"/>
+ <!-- pSbase -->
+ <logger name="net.geant.perfsonar" additivity="false">
+ <level value="trace"/>
<appender-ref ref="psbase"/>
- </category>
+ </logger>
- <!-- Console logging -->
+ <!-- Console logging for everything else -->
<root>
- <priority value="info"/>
+ <level value="info"/>
<appender-ref ref="console"/>
</root>
Modified:
trunk/perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls/LSRegistrationTask.java
===================================================================
---
trunk/perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls/LSRegistrationTask.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls/LSRegistrationTask.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -28,6 +28,7 @@
import net.sf.cglib.proxy.Enhancer;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
/**
@@ -67,7 +68,7 @@
}
private Map<String, String> keys = new Hashtable<String, String>();
- private Logger logger;
+ protected Logger logger = LoggerFactory.getLogger(getClass());
private PerfSONAR service;
public LSRegistrationTask(Logger logger, PerfSONAR service) {
Modified: trunk/perfsonar-base/ls/src/test/resources/log4j.xml
===================================================================
--- trunk/perfsonar-base/ls/src/test/resources/log4j.xml 2013-05-13
09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-base/ls/src/test/resources/log4j.xml 2013-05-13
19:34:02 UTC (rev 6378)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
-<!-- This is the configuration for LOG4J for perfSONAR testing purposes -->
+<!-- This is the configuration for LOG4J for perfSONAR development/testing
purposes -->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
@@ -19,49 +19,42 @@
</layout>
</appender>
- <!-- We have a log file for perfSONAR -->
- <appender name="perfsonar" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="logs/perfsonar.log"/>
+ <!-- We have a log file for pSbase -->
+ <appender name="psbase" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/psbase.log"/>
<param name="MaxFileSize" value="10MB"/>
- <param name="MaxBackupIndex" value="7"/>
+ <param name="MaxBackupIndex" value="5"/>
<param name="Encoding" value="UTF-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
- </layout>
+ </layout>
</appender>
- <!-- We have a log file for pSbase -->
- <appender name="psbase" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="logs/psbase.log"/>
+ <!-- We have a log file for velocity -->
+ <appender name="velocity" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/velocity.log"/>
<param name="MaxFileSize" value="10MB"/>
- <param name="MaxBackupIndex" value="7"/>
+ <param name="MaxBackupIndex" value="5"/>
<param name="Encoding" value="UTF-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
- </layout>
+ </layout>
</appender>
- <!-- Disabling verbose logging from included libs -->
- <category name="org" additivity="true">
- <priority value="warn"/>
- <appender-ref ref="console"/>
- <appender-ref ref="psbase"/>
- </category>
+ <!-- Velocity is logged only to its own file -->
+ <logger name="velocity" additivity="false">
+ <level value="info"/>
+ <appender-ref ref="velocity"/>
+ </logger>
- <!-- perfSONAR base -->
- <category name="net.geant.perfsonar.base" additivity="false">
- <priority value="debug"/>
+ <!-- pSbase -->
+ <logger name="net.geant.perfsonar">
+ <level value="debug"/>
<appender-ref ref="psbase"/>
- </category>
+ </logger>
- <!-- perfSONAR, including test output -->
- <category name="net.geant.perfsonar" additivity="false">
- <priority value="info"/>
- <appender-ref ref="perfsonar"/>
- </category>
-
- <!-- All other messages are going to the perfsonar log (root logger) -->
+ <!-- Console logging for everything else -->
<root>
<level value="info"/>
<appender-ref ref="console"/>
Property changes on: trunk/perfsonar-base/messaging
___________________________________________________________________
Modified: svn:ignore
- .settings
.project
.classpath
target
velocity.log*
.pmd
.pmdruleset
+ .settings
.project
.classpath
.pmd
.pmdruleset
logs
target
Modified: trunk/perfsonar-base/messaging/pom.xml
===================================================================
--- trunk/perfsonar-base/messaging/pom.xml 2013-05-13 09:33:12 UTC (rev
6377)
+++ trunk/perfsonar-base/messaging/pom.xml 2013-05-13 19:34:02 UTC (rev
6378)
@@ -122,12 +122,10 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <scope>test</scope>
</dependency>
</dependencies>
Modified:
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/DeserializationException.java
===================================================================
---
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/DeserializationException.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/DeserializationException.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -5,54 +5,57 @@
import java.util.List;
/**
- * Aggregate exception for exceptions that are thrown when deserializing
objects.
+ * Aggregate exception for exceptions that are thrown when deserializing
+ * objects.
*
* @author <a
href="mailto:">Blazej
Pietrzak</a>
*/
public class DeserializationException extends Exception implements
Iterable<Throwable> {
- private static final long serialVersionUID = 2627705969628394226L;
- private List<Throwable> exceptions = new ArrayList<Throwable>();
+ private static final long serialVersionUID = 2627705969628394226L;
+ private List<Throwable> exceptions = new ArrayList<Throwable>();
- public DeserializationException(List<Throwable> exceptions) {
- super(toString(exceptions));
- this.exceptions.addAll(exceptions);
- }
+ public DeserializationException(List<Throwable> exceptions) {
+ super(toString(exceptions));
+ this.exceptions.addAll(exceptions);
+ }
- public DeserializationException(Throwable... ex) {
- super(toString(ex));
- for (Throwable t : ex) {
- exceptions.add(t);
- }
- }
-
- private static String toString(Throwable[] ex) {
- final StringBuffer text = new StringBuffer();
- boolean firstTime = true;
- for (Throwable t : ex) {
- if (firstTime)
- firstTime = false;
- else
- text.append("\n");
- text.append(t.getMessage());
- }
- return text.toString();
- }
+ public DeserializationException(Throwable... ex) {
+ super(toString(ex));
+ for (Throwable t : ex) {
+ exceptions.add(t);
+ }
+ }
- private static String toString(List<Throwable> exceptions) {
- final StringBuffer text = new StringBuffer();
- boolean firstTime = true;
- for (Throwable ex : exceptions) {
- if (firstTime)
- firstTime = false;
- else
- text.append("\n");
- text.append(ex.getMessage());
- }
- return text.toString();
- }
+ private static String toString(Throwable[] ex) {
+ final StringBuffer text = new StringBuffer();
+ boolean firstTime = true;
+ for (Throwable t : ex) {
+ if (firstTime) {
+ firstTime = false;
+ } else {
+ text.append("\n");
+ }
+ text.append(t.getMessage());
+ }
+ return text.toString();
+ }
- @Override
- public Iterator<Throwable> iterator() {
- return exceptions.iterator();
- }
+ private static String toString(List<Throwable> exceptions) {
+ final StringBuffer text = new StringBuffer();
+ boolean firstTime = true;
+ for (Throwable ex : exceptions) {
+ if (firstTime) {
+ firstTime = false;
+ } else {
+ text.append("\n");
+ }
+ text.append(ex.getMessage());
+ }
+ return text.toString();
+ }
+
+ @Override
+ public Iterator<Throwable> iterator() {
+ return exceptions.iterator();
+ }
}
Modified:
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/Helper.java
===================================================================
---
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/Helper.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/Helper.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -7,9 +7,9 @@
*/
public final class Helper {
private Helper() {
- // Utility class, we don't want to be instantiated directly, we're
private
- super();
+ // Utility class, we block external instantiation
}
+
/**
* @return <code>true</code> if the object is a subclass generated by
* <code>createMock</code> method.
Modified:
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/Method.java
===================================================================
---
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/Method.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/Method.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -12,123 +12,142 @@
* @author <a
href="mailto:">Blazej
Pietrzak</a>
*/
public class Method {
- private final java.lang.reflect.Method method;
- private final java.lang.reflect.Method identifierMethod;
- private final Object object;
-
- private int count = 0;
-
- public Method(java.lang.reflect.Method method) {
- this(method, null, null);
- }
+ private final java.lang.reflect.Method method;
+ private final java.lang.reflect.Method identifierMethod;
+ private final Object object;
- /**
- * @param method method to be executed when XPath evaluates
successfully
- * @param identifierMethod method providing object unique identifier
- */
- public Method(java.lang.reflect.Method method,
java.lang.reflect.Method identifierMethod) {
- this(method, identifierMethod, null);
- }
-
- /**
- * @param method method to be executed when XPath evaluates
successfully
- * @param identifierMethod method providing object unique identifier
- * @param object object on which given method should be executed
- */
- public Method(java.lang.reflect.Method method,
java.lang.reflect.Method identifierMethod, Object object) {
- this.method = method;
- this.identifierMethod = identifierMethod;
- this.object = object;
- }
-
- /**
- * Executes the method. It creates object of the method's declaring
class if needed and adds it to instances
- * provided in instances argument.
- * @param arg method argument
- * @param instances list of instances (execution may add new object)
- * @throws Throwable if method throws exception or method cannot be
invoked.
- */
- public synchronized void execute(String arg, Map<Class<?>,
List<Object>> instances) throws Throwable {
- final Object instance;
- try {
- instance = getInstance(instances);
- if (getParameterType().equals(String.class)) {
- method.invoke(instance, arg);
- } else {
- final Object reference =
getReference(instances, arg);
- if (reference == null)
- return;
- method.invoke(instance, reference);
- }
- } catch (InvocationTargetException ex) {
- throw new RuntimeException("Method: " + toString(),
ex.getTargetException());
- }
-
- putInstance(instances, instance);
-
- count++;
- }
-
- private void putInstance(Map<Class<?>, List<Object>> instances,
Object instance) {
- if (instances.get(method.getDeclaringClass()) == null) {
- instances.put(method.getDeclaringClass(), new
ArrayList<Object>());
- }
- if (instances.get(method.getDeclaringClass()).size() < count
+ 1)
-
instances.get(method.getDeclaringClass()).add(instance);
- }
+ private int count = 0;
- public synchronized int getCount() {
- return count;
- }
-
- public synchronized void resetCount() {
- count = 0;
- }
-
- protected synchronized Object getInstance(Map<Class<?>, List<Object>>
instances) throws InstantiationException, IllegalAccessException {
- if (Modifier.isStatic(method.getModifiers()))
- throw new IllegalStateException("Static methods are
forbidden for xpath configuration: " + method);
- if (object != null)
- return object;
-
- if (instances.get(method.getDeclaringClass()) == null)
- return method.getDeclaringClass().newInstance();
-
- if (instances.get(method.getDeclaringClass()).size() > count)
{
- return
instances.get(method.getDeclaringClass()).get(count);
- }
-
- return method.getDeclaringClass().newInstance();
- }
-
- protected Object getReference(Map<Class<?>, List<Object>> instances,
String value) throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException {
- if (identifierMethod == null)
- return null;
-
- if (instances.get(identifierMethod.getDeclaringClass()) ==
null)
- return null;
-
- for (Object instance :
instances.get(identifierMethod.getDeclaringClass())) {
- try {
- if
(identifierMethod.invoke(instance).equals(value))
- return instance;
- } catch (NullPointerException ex) {
- throw new NullPointerException("Identifier
value is not set for " + instance
- + ". Check xpath for setting
identifier or verify whether xpath for reference is correct.");
- }
- }
-
- return null;
- }
+ public Method(java.lang.reflect.Method method) {
+ this(method, null, null);
+ }
- private Class<?> getParameterType() {
- return method.getParameterTypes()[0];
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return this.method.toString() + " [" + count + "]";
- }
+ /**
+ * @param method
+ * method to be executed when XPath evaluates successfully
+ * @param identifierMethod
+ * method providing object unique identifier
+ */
+ public Method(java.lang.reflect.Method method, java.lang.reflect.Method
identifierMethod) {
+ this(method, identifierMethod, null);
+ }
+
+ /**
+ * @param method
+ * method to be executed when XPath evaluates successfully
+ * @param identifierMethod
+ * method providing object unique identifier
+ * @param object
+ * object on which given method should be executed
+ */
+ public Method(java.lang.reflect.Method method, java.lang.reflect.Method
identifierMethod, Object object) {
+ this.method = method;
+ this.identifierMethod = identifierMethod;
+ this.object = object;
+ }
+
+ /**
+ * Executes the method. It creates object of the method's declaring
class if
+ * needed and adds it to instances provided in instances argument.
+ *
+ * @param arg
+ * method argument
+ * @param instances
+ * list of instances (execution may add new object)
+ * @throws Throwable
+ * if method throws exception or method cannot be invoked.
+ */
+ public synchronized void execute(String arg, Map<Class<?>, List<Object>>
instances) throws Throwable {
+ final Object instance;
+ try {
+ instance = getInstance(instances);
+ if (getParameterType().equals(String.class)) {
+ method.invoke(instance, arg);
+ } else {
+ final Object reference = getReference(instances, arg);
+ if (reference == null) {
+ return;
+ }
+ method.invoke(instance, reference);
+ }
+ } catch (InvocationTargetException ex) {
+ throw new RuntimeException("Method: " + toString(),
ex.getTargetException());
+ }
+
+ putInstance(instances, instance);
+
+ count++;
+ }
+
+ private void putInstance(Map<Class<?>, List<Object>> instances, Object
instance) {
+ if (instances.get(method.getDeclaringClass()) == null) {
+ instances.put(method.getDeclaringClass(), new
ArrayList<Object>());
+ }
+ if (instances.get(method.getDeclaringClass()).size() < count + 1) {
+ instances.get(method.getDeclaringClass()).add(instance);
+ }
+ }
+
+ public synchronized int getCount() {
+ return count;
+ }
+
+ public synchronized void resetCount() {
+ count = 0;
+ }
+
+ protected synchronized Object getInstance(Map<Class<?>, List<Object>>
instances) throws InstantiationException,
+ IllegalAccessException {
+ if (Modifier.isStatic(method.getModifiers())) {
+ throw new IllegalStateException("Static methods are forbidden
for xpath configuration: " + method);
+ }
+ if (object != null) {
+ return object;
+ }
+
+ if (instances.get(method.getDeclaringClass()) == null) {
+ return method.getDeclaringClass().newInstance();
+ }
+
+ if (instances.get(method.getDeclaringClass()).size() > count) {
+ return instances.get(method.getDeclaringClass()).get(count);
+ }
+
+ return method.getDeclaringClass().newInstance();
+ }
+
+ protected Object getReference(Map<Class<?>, List<Object>> instances,
String value) throws IllegalAccessException,
+ InvocationTargetException {
+ if (identifierMethod == null) {
+ return null;
+ }
+
+ if (instances.get(identifierMethod.getDeclaringClass()) == null) {
+ return null;
+ }
+
+ for (Object instance :
instances.get(identifierMethod.getDeclaringClass())) {
+ try {
+ if (identifierMethod.invoke(instance).equals(value)) {
+ return instance;
+ }
+ } catch (NullPointerException ex) {
+ throw new NullPointerException("Identifier value is not set
for " + instance
+ + ". Check xpath for setting identifier or verify
whether xpath for reference is correct.");
+ }
+ }
+
+ return null;
+ }
+
+ private Class<?> getParameterType() {
+ return method.getParameterTypes()[0];
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return this.method.toString() + " [" + count + "]";
+ }
}
Modified:
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/SelfTestResult.java
===================================================================
---
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/SelfTestResult.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/SelfTestResult.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -4,158 +4,166 @@
import static net.geant.perfsonar.messaging.XPathDeserializer.declarePrefix;
import static net.geant.perfsonar.messaging.XPathDeserializer.whenXPath;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
- * Represents result of running Self Test.
- *
- * @author <a
href=mailto:">Blazej
Pietrzak</a>, <a
href="mailto:">Antoine
Delvaux</a>
+ * This class is used in unit tests to check the behavior of a service wrt
self
+ * tests
+ *
+ * @author Blazej Pietrzak -
+ * @author Antoine Delvaux -
+ *
*/
public class SelfTestResult implements Comparable<SelfTestResult> {
- static {
- declarePrefix("nmwg", "http://ggf.org/ns/nmwg/base/2.0/");
- try {
-
whenXPath("nmwg:message/nmwg:data/nmwg:metadata/@id").then(
-
SelfTestResult.class).setName(any(String.class));
+ private static final Logger LOGGER =
LoggerFactory.getLogger(SelfTestResult.class);
+ static {
+ declarePrefix("nmwg", "http://ggf.org/ns/nmwg/base/2.0/");
+ try {
+
whenXPath("nmwg:message/nmwg:data/nmwg:metadata/@id").then(SelfTestResult.class).setName(any(String.class));
-
whenXPath("nmwg:message/nmwg:data/nmwg:data/nmwg:datum/text()")
-
.then(SelfTestResult.class).setMessage(any(String.class));
+
whenXPath("nmwg:message/nmwg:data/nmwg:data/nmwg:datum/text()").then(SelfTestResult.class).setMessage(
+ any(String.class));
- whenXPath(
-
"nmwg:message/nmwg:data/nmwg:metadata/nmwg:eventType/text()")
-
.then(SelfTestResult.class).setEventType(any(String.class));
- } catch (Exception ex) {
- ex.printStackTrace();
- //Added try-catch block only for compilation.
- }
- }
+
whenXPath("nmwg:message/nmwg:data/nmwg:metadata/nmwg:eventType/text()").then(SelfTestResult.class)
+ .setEventType(any(String.class));
+ } catch (Exception ex) {
+ LOGGER.debug("{}: {}", ex.getClass(), ex.getMessage());
+ }
+ }
- protected String name;
- protected String message;
- protected String status;
- protected String serviceName;
- protected String serviceType;
+ protected String name;
+ protected String message;
+ protected String status;
+ protected String serviceName;
+ protected String serviceType;
- public SelfTestResult(String name, String message, String status,
- String serviceName, String serviceType) {
- this.name = name;
- this.message = message;
- this.status = status;
- this.serviceName = serviceName;
- this.serviceType = serviceType;
- }
+ public SelfTestResult(String name, String message, String status, String
serviceName, String serviceType) {
+ this.name = name;
+ this.message = message;
+ this.status = status;
+ this.serviceName = serviceName;
+ this.serviceType = serviceType;
+ }
- public SelfTestResult() {
- }
+ public SelfTestResult() {
+ }
- public static SelfTestResult failure(String name, String message,
- String serviceName, String serviceType) {
- return new SelfTestResult(name, message, "failure",
serviceName,
- serviceType);
- }
+ public static SelfTestResult failure(String name, String message, String
serviceName, String serviceType) {
+ return new SelfTestResult(name, message, "failure", serviceName,
serviceType);
+ }
- public static SelfTestResult success(String name, String message,
- String serviceName, String serviceType) {
- return new SelfTestResult(name, message, "success",
serviceName,
- serviceType);
- }
+ public static SelfTestResult success(String name, String message, String
serviceName, String serviceType) {
+ return new SelfTestResult(name, message, "success", serviceName,
serviceType);
+ }
- public void setName(String name) {
- this.name = name;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public void setMessage(String message) {
- this.message = message;
- }
+ public void setMessage(String message) {
+ this.message = message;
+ }
- public String getMessage() {
- return message;
- }
+ public String getMessage() {
+ return message;
+ }
- public void setStatus(String status) {
- this.status = status;
- }
+ public void setStatus(String status) {
+ this.status = status;
+ }
- public String getStatus() {
- return status;
- }
+ public String getStatus() {
+ return status;
+ }
- @Override
- public int compareTo(SelfTestResult arg) {
- return getName().compareTo(arg.getName());
- }
+ @Override
+ public int compareTo(SelfTestResult arg) {
+ return getName().compareTo(arg.getName());
+ }
- public void setEventType(String eventType) {
- if (eventType.contains("success"))
- status = "success";
- else
- status = "failure";
+ public void setEventType(String eventType) {
+ if (eventType.contains("success")) {
+ status = "success";
+ } else {
+ status = "failure";
+ }
- String[] elems = eventType.substring(
-
"http://schemas.perfsonar.net/tools/admin/selftest/".length())
- .split("/");
-
- serviceType = elems[0];
- serviceName = elems[1];
- }
+ String[] elems =
eventType.substring("http://schemas.perfsonar.net/tools/admin/selftest/".length()).split("/");
- @Override
- public String toString() {
- return status + " (name=" + name + ", message=" + message
- + ", service-name=" + serviceName + ",
service-type="
- + serviceType + ")";
- }
+ serviceType = elems[0];
+ serviceName = elems[1];
+ }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((message == null) ? 0 :
message.hashCode());
- result = prime * result + ((name == null) ? 0 :
name.hashCode());
- result = prime * result
- + ((serviceName == null) ? 0 :
serviceName.hashCode());
- result = prime * result
- + ((serviceType == null) ? 0 :
serviceType.hashCode());
- result = prime * result + ((status == null) ? 0 :
status.hashCode());
- return result;
- }
+ @Override
+ public String toString() {
+ return status + " (name=" + name + ", message=" + message + ",
service-name=" + serviceName + ", service-type="
+ + serviceType + ")";
+ }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- SelfTestResult other = (SelfTestResult) obj;
- if (message == null) {
- if (other.message != null)
- return false;
- } else if (!message.equals(other.message))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (serviceName == null) {
- if (other.serviceName != null)
- return false;
- } else if (!serviceName.equals(other.serviceName))
- return false;
- if (serviceType == null) {
- if (other.serviceType != null)
- return false;
- } else if (!serviceType.equals(other.serviceType))
- return false;
- if (status == null) {
- if (other.status != null)
- return false;
- } else if (!status.equals(other.status))
- return false;
- return true;
- }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((message == null) ? 0 :
message.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((serviceName == null) ? 0 :
serviceName.hashCode());
+ result = prime * result + ((serviceType == null) ? 0 :
serviceType.hashCode());
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SelfTestResult other = (SelfTestResult) obj;
+ if (message == null) {
+ if (other.message != null) {
+ return false;
+ }
+ } else if (!message.equals(other.message)) {
+ return false;
+ }
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ if (serviceName == null) {
+ if (other.serviceName != null) {
+ return false;
+ }
+ } else if (!serviceName.equals(other.serviceName)) {
+ return false;
+ }
+ if (serviceType == null) {
+ if (other.serviceType != null) {
+ return false;
+ }
+ } else if (!serviceType.equals(other.serviceType)) {
+ return false;
+ }
+ if (status == null) {
+ if (other.status != null) {
+ return false;
+ }
+ } else if (!status.equals(other.status)) {
+ return false;
+ }
+ return true;
+ }
}
Modified:
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/XPathDeserializer.java
===================================================================
---
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/XPathDeserializer.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/messaging/XPathDeserializer.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -22,180 +22,206 @@
/**
* Deserializes data from XML stream.
*
- * <p>This class provides API for configuring XPath expressions that trigger
- * method invocation with values of the expression evaluation.
- * Please note that it uses streaming XPaths, so only a subset of
expressions can
- * be used. Those that require creation of DOM tree are not allowed.
- * There are two approaches to configure deserializer: via API or via
annotations.</p>
+ * <p>
+ * This class provides API for configuring XPath expressions that trigger
method
+ * invocation with values of the expression evaluation. Please note that it
uses
+ * streaming XPaths, so only a subset of expressions can be used. Those that
+ * require creation of DOM tree are not allowed. There are two approaches to
+ * configure deserializer: via API or via annotations.
+ * </p>
*
- * <p>By invoking:<br/>
+ * <p>
+ * By invoking:<br/>
* <code>declarePrefix("nmwg", uri)</code><br/>
- * one informs the deserializer about prefixes for various namespaces.</p>
+ * one informs the deserializer about prefixes for various namespaces.
+ * </p>
*
- * <p>By invoking:<br/>
- *
<code>whenXPath("/nmwg:message/@id").then(NMWGMessage.class).setId(any(String.class))</code><br/>
- * deserializer will fire setId method from instance of NMWGMesssage class
and provide
- * as an argument the result of XPath expression provided in whenXPath
method.
- * During configuration no real method is executed.
- * The following configuration is developer friendly. It statically checks
whether
- * the method exists and in case of refactoring it will be reconfigured
automatically.</p>
+ * <p>
+ * By invoking:<br/>
+ *
<code>whenXPath("/nmwg:message/@id").then(NMWGMessage.class).setId(any(String.class))</code>
+ * <br/>
+ * deserializer will fire setId method from instance of NMWGMesssage class
and
+ * provide as an argument the result of XPath expression provided in
whenXPath
+ * method. During configuration no real method is executed. The following
+ * configuration is developer friendly. It statically checks whether the
method
+ * exists and in case of refactoring it will be reconfigured automatically.
+ * </p>
*
- * <p>By invoking:<br/>
+ * <p>
+ * By invoking:<br/>
* <code>whenXPath("nmwg:message/nmwg:data[starts-with(@metadataIdRef,
'metadata')]/@metadataIdRef")
* .then(Command.class).setCurrentRouter(
- * getReference(Router.class,
identifier(Router.class).getId()));</code><br/>
- *
- * deserializer will invoke setCurrentRouter method and will provide a real
instance (not string)
- * of Router class identified by getId method defined in Router class.</p>
+ * getReference(Router.class,
identifier(Router.class).getId()));</code>
+ * <br/>
*
- * <p>Configuring deserializer via annotations requires
net.geant.perfsonar.base/apt tool to be present on
- * the classpath during compilation. Namespaces are defined globally, so it
is not needed to define the same
- * namespace in all xpaths.</p>
- * <p>When declaring:<br/>
+ * deserializer will invoke setCurrentRouter method and will provide a real
+ * instance (not string) of Router class identified by getId method defined
in
+ * Router class.
+ * </p>
+ *
+ * <p>
+ * Configuring deserializer via annotations requires
+ * net.geant.perfsonar.base/apt tool to be present on the classpath during
+ * compilation. Namespaces are defined globally, so it is not needed to
define
+ * the same namespace in all xpaths.
+ * </p>
+ * <p>
+ * When declaring:<br/>
*
<code>@XPath(xpath="nmwg:message/nmwg:metadata[@id='meta']/nmwg:eventType/text()",
- *
namespaces=@Namespace(prefix="nmwg",
uri=NMWG_URI))<br/>
+ *
namespaces=@Namespace(prefix="nmwg",
uri=NMWG_URI))<br/>
* public void setEventType(String type)</code><br/>
- * setEventType method will be invoked when the xpath will be evaluated.</p>
- *
- * <p>One can declare multiple xpaths for the given method using XPaths
annotation.
- * If any of these xpaths is evaluated successfully then the given method is
invoked. Below is the example:<br/>
+ * setEventType method will be invoked when the xpath will be evaluated.
+ * </p>
+ *
+ * <p>
+ * One can declare multiple xpaths for the given method using XPaths
annotation.
+ * If any of these xpaths is evaluated successfully then the given method is
+ * invoked. Below is the example:<br/>
* <code>@XPaths({<br/>
-
@XPath(xpath="nmwg:message/nmwg:metadata/@metadataIdRef"),<br/>
- @XPath(xpath="nmwg:message/@id",
namespaces=@Namespace(prefix="nmwg",
uri=NMWG_URI))<br/>
- })</code><br/>
*
- * <p>In order to configure identifier method one must annotate the method
with Identifier annotation
- * (see example below).<br/>
- * <code>@Identifier<br/>
+ * @XPath(xpath="nmwg:message/nmwg:metadata/@metadataIdRef"),<br/>
+ * @XPath(xpath="nmwg:message/@id",
namespaces=@Namespace(prefix="nmwg",
+ * uri=NMWG_URI))<br/> })</code><br/>
+ *
+ * <p>
+ * In order to configure identifier method
one
+ * must annotate the method with Identifier
+ * annotation (see example below).<br/>
+ * <code>@Identifier<br/>
* public String getId();</code><br/>
- * </p>
+ * </p>
* @author <a
href="mailto:">Blazej
Pietrzak</a>
*/
public class XPathDeserializer {
- private final static DefaultNamespaceContext context = new
DefaultNamespaceContext();
- private final static Map<String, Method> xpaths = new
Hashtable<String, Method>();
- private final static Map<Class<?>, java.lang.reflect.Method>
identifiers = new Hashtable<Class<?>, java.lang.reflect.Method>();
-
- public static void declarePrefix(String prefix, String uri) {
- context.declarePrefix(prefix, uri);
- }
-
- public static XPathConfiguration whenXPath(String xpath) {
- return new XPathConfiguration(xpath);
- }
-
- public static <T> T getReference(Class<T> type, String id) throws
InstantiationException, IllegalAccessException {
- return type.newInstance();
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T identifier(Class<T> type) {
- return (T) Enhancer.create(type, new ReferenceInterceptor());
- }
-
- public static java.lang.reflect.Method findIdentifier(Class<?> type) {
- return identifiers.get(type);
- }
-
- public static <T> T any(Class<T> type) {
- return null;
- }
-
- public static void putXPath(String xpath, Object object,
java.lang.reflect.Method method) {
- xpaths.put(xpath, new Method(method,
identifiers.get(method.getParameterTypes()[0]), object));
- }
-
- public static synchronized void putXPath(String xpath,
java.lang.reflect.Method method) {
- xpaths.put(xpath, new Method(method,
identifiers.get(method.getParameterTypes()[0])));
- }
-
- protected static void putIdentifier(Class<?> declaringClass,
java.lang.reflect.Method method) {
- XPathDeserializer.identifiers.put(declaringClass, method);
- }
-
- public static void clearConfiguration() {
- xpaths.clear();
- }
-
- private static synchronized Set<String> getXPaths() {
- return xpaths.keySet();
- }
-
- protected static Method getXPathMethod(String xpath) {
- return xpaths.get(xpath);
- }
-
- public static Map<String, Method> getConfiguration() {
- return xpaths;
- }
+ private static final DefaultNamespaceContext CONTEXT = new
DefaultNamespaceContext();
+ private static final Map<String, Method> XPATHS = new Hashtable<String,
Method>();
+ private static final Map<Class<?>, java.lang.reflect.Method> IDENTIFIERS
= new Hashtable<Class<?>, java.lang.reflect.Method>();
- public XPathDeserializer() {
- }
-
- public static String validate(String xpath) {
- final XMLDog dog = new XMLDog(context);
- try {
- dog.addXPath(xpath);
- } catch (XPathSyntaxException ex) {
- return "Invalid XPath: " + ex.getMultilineMessage();
- } catch (SAXPathException ex) {
- return "Invalid XPath: " + ex.getMessage();
- }
-
- return null;
- }
+ public static void declarePrefix(String prefix, String uri) {
+ CONTEXT.declarePrefix(prefix, uri);
+ }
- /**
- * Deserializes objects from xml stream using streaming XPath
expressions.
- * @throws DeserializationException list of exceptions thrown while
deserializing
- */
- public List<?> deserialize(InputSource reader) throws
DeserializationException {
- final XMLDog dog = new XMLDog(context);
- final List<Throwable> exceptions = new ArrayList<Throwable>();
- for (Iterator<String> iter =
XPathDeserializer.getXPaths().iterator(); iter.hasNext(); ) {
- try {
- dog.addXPath(iter.next());
- } catch (XPathSyntaxException ex) {
- exceptions.add(new XPathException("Invalid
XPath: " + ex.getMultilineMessage()));
- } catch (SAXPathException ex) {
- exceptions.add(new XPathException("Invalid
XPath: " + ex.getMessage()));
- }
- }
-
- if (exceptions.size() > 0)
- throw new DeserializationException(exceptions);
-
- final Event event = dog.createEvent(); // must be after all
expressions are added.
- event.setXMLBuilder(new DOMBuilder());
-
- final InMemoryInstancesListener listener = new
InMemoryInstancesListener();
-
- event.setListener(listener);
-
- try {
- dog.sniff(event, reader, false/*useSTAX*/);
- } catch (XPathException ex) {
- throw new DeserializationException(ex);
- } finally {
- for (Method method : xpaths.values()) {
- method.resetCount();
- }
- }
-
- if (listener.getExceptions().size() > 0)
- throw new
DeserializationException(listener.getExceptions());
-
- return listener.getObjects();
- }
-
- @SuppressWarnings("unchecked")
- public <T> List<T> getObjects(Class<T> type, List<Object> objects) {
- final List<T> result = new ArrayList<T>();
- for (Object obj : objects) {
- if (obj.getClass().equals(type)) {
- result.add((T) obj);
- }
- }
- return result;
- }
+ public static XPathConfiguration whenXPath(String xpath) {
+ return new XPathConfiguration(xpath);
+ }
+
+ public static <T> T getReference(Class<T> type, String id) throws
InstantiationException, IllegalAccessException {
+ return type.newInstance();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T identifier(Class<T> type) {
+ return (T) Enhancer.create(type, new ReferenceInterceptor());
+ }
+
+ public static java.lang.reflect.Method findIdentifier(Class<?> type) {
+ return IDENTIFIERS.get(type);
+ }
+
+ public static <T> T any(Class<T> type) {
+ return null;
+ }
+
+ public static void putXPath(String xpath, Object object,
java.lang.reflect.Method method) {
+ XPATHS.put(xpath, new Method(method,
IDENTIFIERS.get(method.getParameterTypes()[0]), object));
+ }
+
+ public static synchronized void putXPath(String xpath,
java.lang.reflect.Method method) {
+ XPATHS.put(xpath, new Method(method,
IDENTIFIERS.get(method.getParameterTypes()[0])));
+ }
+
+ protected static void putIdentifier(Class<?> declaringClass,
java.lang.reflect.Method method) {
+ IDENTIFIERS.put(declaringClass, method);
+ }
+
+ public static void clearConfiguration() {
+ XPATHS.clear();
+ }
+
+ private static synchronized Set<String> getXPaths() {
+ return XPATHS.keySet();
+ }
+
+ protected static Method getXPathMethod(String xpath) {
+ return XPATHS.get(xpath);
+ }
+
+ public static Map<String, Method> getConfiguration() {
+ return XPATHS;
+ }
+
+ public XPathDeserializer() {
+ }
+
+ public static String validate(String xpath) {
+ final XMLDog dog = new XMLDog(CONTEXT);
+ try {
+ dog.addXPath(xpath);
+ } catch (XPathSyntaxException ex) {
+ return "Invalid XPath: " + ex.getMultilineMessage();
+ } catch (SAXPathException ex) {
+ return "Invalid XPath: " + ex.getMessage();
+ }
+
+ return null;
+ }
+
+ /**
+ * Deserializes objects from xml stream using streaming XPath
expressions.
+ *
+ * @throws DeserializationException
+ * list of exceptions thrown while deserializing
+ */
+ public List<?> deserialize(InputSource reader) throws
DeserializationException {
+ final XMLDog dog = new XMLDog(CONTEXT);
+ final List<Throwable> exceptions = new ArrayList<Throwable>();
+ for (Iterator<String> iter =
XPathDeserializer.getXPaths().iterator(); iter.hasNext();) {
+ try {
+ dog.addXPath(iter.next());
+ } catch (XPathSyntaxException ex) {
+ exceptions.add(new XPathException("Invalid XPath: " +
ex.getMultilineMessage()));
+ } catch (SAXPathException ex) {
+ exceptions.add(new XPathException("Invalid XPath: " +
ex.getMessage()));
+ }
+ }
+
+ if (exceptions.size() > 0) {
+ throw new DeserializationException(exceptions);
+ }
+
+ final Event event = dog.createEvent(); // must be after all
expressions
+ // are added.
+ event.setXMLBuilder(new DOMBuilder());
+
+ final InMemoryInstancesListener listener = new
InMemoryInstancesListener();
+
+ event.setListener(listener);
+
+ try {
+ dog.sniff(event, reader, false/* useSTAX */);
+ } catch (XPathException ex) {
+ throw new DeserializationException(ex);
+ } finally {
+ for (Method method : XPATHS.values()) {
+ method.resetCount();
+ }
+ }
+
+ if (listener.getExceptions().size() > 0) {
+ throw new DeserializationException(listener.getExceptions());
+ }
+
+ return listener.getObjects();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> List<T> getObjects(Class<T> type, List<Object> objects) {
+ final List<T> result = new ArrayList<T>();
+ for (Object obj : objects) {
+ if (obj.getClass().equals(type)) {
+ result.add((T) obj);
+ }
+ }
+ return result;
+ }
}
Modified:
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/templates/TemplateEngine.java
===================================================================
---
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/templates/TemplateEngine.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/main/java/net/geant/perfsonar/templates/TemplateEngine.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -7,6 +7,7 @@
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -18,29 +19,31 @@
*
*/
public final class TemplateEngine {
- private static final Logger LOGGER =
LoggerFactory.getLogger("SelfTestResult");
+ private static final Logger LOGGER =
LoggerFactory.getLogger(TemplateEngine.class);
private static final VelocityEngine TEMPLATE_ENGINE = new
VelocityEngine();
private static final VelocityContext CONTEXT = new VelocityContext();
private TemplateEngine() {
- // Utility class, we don't want to be instantiated directly, we're
private
- super();
+ // Utility class, we block external instantiation
}
static {
- try {
- TEMPLATE_ENGINE.init();
- } catch (Exception ex) {
- LOGGER.debug("Exception during engine initialisation ({}): {}",
ex.getClass(), ex.getMessage());
- }
+ LOGGER.info("Initialising the Velocity template engine.");
+ // We set correct defaults to use Log4J for the velocity log
("velocity" category)
+
TEMPLATE_ENGINE.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
+ "org.apache.velocity.runtime.log.Log4JLogChute");
+ TEMPLATE_ENGINE.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM +
".log4j.logger",
+ "velocity");
+ TEMPLATE_ENGINE.init();
}
private static InputStream getTemplate(Class<?> homeDir, String name)
throws IOException {
-
final InputStream in = homeDir.getResourceAsStream(name);
if (in == null) {
- throw new IOException("Template " + name + " cannot be found.");
+ String msg = "Template " + name + " cannot be found in " +
homeDir + ".";
+ LOGGER.warn(msg);
+ throw new IOException(msg);
}
return in;
}
Modified:
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/InvalidXPathsTest.java
===================================================================
---
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/InvalidXPathsTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/InvalidXPathsTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -26,72 +26,70 @@
* @author <a
href="mailto:">Blazej
Pietrzak</a>
*/
public class InvalidXPathsTest {
- private static final String REQUEST_ID = "1";
+ private static final String REQUEST_ID = "1";
- private Reader reader;
- private XPathDeserializer deserializer;
+ private Reader reader;
+ private XPathDeserializer deserializer;
- @Before
- public void givenMessageAndDeserializationConfigured() throws
Exception {
- reader = NMWG.toMetadataKeyResponse(REQUEST_ID, new
Router("metadata0",
- "test1",
InetAddress.getAllByName("192.168.1.1")[0],
- Command.PING_IPV6));
+ @Before
+ public void givenMessageAndDeserializationConfigured() throws Exception {
+ reader = NMWG.toMetadataKeyResponse(REQUEST_ID,
+ new Router("metadata0", "test1",
InetAddress.getAllByName("192.168.1.1")[0], Command.PING_IPV6));
- declarePrefix("nmwg", "http://ggf.org/ns/nmwg/base/2.0/");
- deserializer = new XPathDeserializer();
- }
+ declarePrefix("nmwg", "http://ggf.org/ns/nmwg/base/2.0/");
+ deserializer = new XPathDeserializer();
+ }
- @After
- public void clearConfiguration() {
- XPathDeserializer.clearConfiguration();
- reader = null;
- deserializer = null;
- }
+ @After
+ public void clearConfiguration() {
+ XPathDeserializer.clearConfiguration();
+ reader = null;
+ deserializer = null;
+ }
- @Test
- public void shouldThrowExceptionWhenInvalidXPathSyntax() throws
Exception {
- whenXPath("invalid
xpath1").then(Router.class).setId(any(String.class));
- whenXPath("invalid xpath2").then(Router.class).setAddress(
- any(String.class));
+ @Test
+ public void shouldThrowExceptionWhenInvalidXPathSyntax() throws
Exception {
+ whenXPath("invalid
xpath1").then(Router.class).setId(any(String.class));
+ whenXPath("invalid
xpath2").then(Router.class).setAddress(any(String.class));
- try {
- deserializer.deserialize(new InputSource(reader));
- fail("DeserializationException was not thrown");
- } catch (DeserializationException ex) {
- final Iterator<Throwable> iter = ex.iterator();
- assertEquals(XPathException.class,
iter.next().getClass());
- assertEquals(XPathException.class,
iter.next().getClass());
- assertFalse(iter.hasNext());
- }
- }
+ try {
+ deserializer.deserialize(new InputSource(reader));
+ fail("DeserializationException was not thrown");
+ } catch (DeserializationException ex) {
+ final Iterator<Throwable> iter = ex.iterator();
+ assertEquals(XPathException.class, iter.next().getClass());
+ assertEquals(XPathException.class, iter.next().getClass());
+ assertFalse(iter.hasNext());
+ }
+ }
- @Test
- public void shouldThrowExceptionWhenXPathReturnsNull() throws
Exception {
-
whenXPath("nmwg:message/nmwg:metadata[nmwg:parameters]/nmwg:subject")
-
.then(Router.class).setName(any(String.class));
+ @Test
+ public void shouldThrowExceptionWhenXPathReturnsNull() throws Exception {
+
whenXPath("nmwg:message/nmwg:metadata[nmwg:parameters]/nmwg:subject").then(Router.class).setName(
+ any(String.class));
- try {
- deserializer.deserialize(new InputSource(reader));
- fail("DeserializationException was not thrown");
- } catch (DeserializationException ex) {
- final Iterator<Throwable> iter = ex.iterator();
- assertEquals(XPathException.class,
iter.next().getClass());
- assertFalse(iter.hasNext());
- }
- }
-
- @Test
- public void shouldThrowExceptionWhenUndeclaredPrefix() throws
Exception {
-
whenXPath("nmwg:message/nmwg:data/nmwgr:datum/nmwg:eventType/text()")
-
.then(Command.class).setEventType(any(String.class));
+ try {
+ deserializer.deserialize(new InputSource(reader));
+ fail("DeserializationException was not thrown");
+ } catch (DeserializationException ex) {
+ final Iterator<Throwable> iter = ex.iterator();
+ assertEquals(XPathException.class, iter.next().getClass());
+ assertFalse(iter.hasNext());
+ }
+ }
- try {
- deserializer.deserialize(new InputSource(reader));
- fail("DeserializationException was not thrown");
- } catch (DeserializationException ex) {
- final Iterator<Throwable> iter = ex.iterator();
- assertEquals(XPathException.class,
iter.next().getClass());
- assertFalse(iter.hasNext());
- }
- }
+ @Test
+ public void shouldThrowExceptionWhenUndeclaredPrefix() throws Exception {
+
whenXPath("nmwg:message/nmwg:data/nmwgr:datum/nmwg:eventType/text()").then(Command.class).setEventType(
+ any(String.class));
+
+ try {
+ deserializer.deserialize(new InputSource(reader));
+ fail("DeserializationException was not thrown");
+ } catch (DeserializationException ex) {
+ final Iterator<Throwable> iter = ex.iterator();
+ assertEquals(XPathException.class, iter.next().getClass());
+ assertFalse(iter.hasNext());
+ }
+ }
}
Modified:
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodOnObjectTest.java
===================================================================
---
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodOnObjectTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodOnObjectTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -1,6 +1,6 @@
package net.geant.perfsonar.messaging;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
import java.util.Hashtable;
import java.util.List;
@@ -16,28 +16,28 @@
* @author <a
href="mailto:">Blazej
Pietrzak</a>
*/
public class MethodOnObjectTest {
- final Map<Class<?>, List<Object>> instances = new Hashtable<Class<?>,
List<Object>>();
- final Command expected = new Command();
- private Method method;
-
- @Before
- public void givenMethodWithObject() throws Exception {
- expected.setName("object");
- method = new Method(Command.class.getMethod("setName",
String.class), null, expected);
- }
+ private final Map<Class<?>, List<Object>> instances = new
Hashtable<Class<?>, List<Object>>();
+ private final Command expected = new Command();
+ private Method method;
- @After
- public void tearDown() throws Exception {
- method = null;
- }
+ @Before
+ public void givenMethodWithObject() throws Exception {
+ expected.setName("object");
+ method = new Method(Command.class.getMethod("setName",
String.class), null, expected);
+ }
- @Test
- public void shouldReturnObject() throws Exception {
- assertTrue(expected == method.getInstance(instances));
- }
-
- @Test
- public void shouldBeEmpty() {
- assertTrue(instances.isEmpty());
- }
+ @After
+ public void tearDown() throws Exception {
+ method = null;
+ }
+
+ @Test
+ public void shouldReturnObject() throws Exception {
+ assertTrue(expected == method.getInstance(instances));
+ }
+
+ @Test
+ public void shouldBeEmpty() {
+ assertTrue(instances.isEmpty());
+ }
}
Modified:
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodTest.java
===================================================================
---
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -14,92 +14,90 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-
+
/**
* @author <a
href="mailto:">Blazej
Pietrzak</a>
*/
public class MethodTest {
- private Method eventTypeMethod;
- private Method commandNameMethod;
- private Method currentRouterMethod;
- private Method routerIdMethod;
- private Method routerNameMethod;
-
- private final Map<Class<?>, List<Object>> instances = new
Hashtable<Class<?>, List<Object>>();
- private final Map<Class<?>, List<Object>> expected = new
Hashtable<Class<?>, List<Object>>();
+ private Method eventTypeMethod;
+ private Method commandNameMethod;
+ private Method currentRouterMethod;
+ private Method routerIdMethod;
+ private Method routerNameMethod;
- @Before
- public void givenMethods() throws Throwable {
- new Command();
- eventTypeMethod = createCommandMethod("setEventType",
String.class);
- commandNameMethod = createCommandMethod("setName",
String.class);
- currentRouterMethod = new
Method(RouterReference.class.getMethod("setCurrentRouter", Router.class),
Router.class.getMethod("getId"));
- routerIdMethod = new Method(Router.class.getMethod("setId",
String.class), Router.class.getMethod("getId"));
- routerNameMethod = new
Method(Router.class.getMethod("setName", String.class),
Router.class.getMethod("getId"));
- whenExecutingMethods(instances);
- }
+ private final Map<Class<?>, List<Object>> instances = new
Hashtable<Class<?>, List<Object>>();
+ private final Map<Class<?>, List<Object>> expected = new
Hashtable<Class<?>, List<Object>>();
- private Method createCommandMethod(String methodName, Class<?>...
params) throws NoSuchMethodException {
- return new Method(Command.class.getMethod(methodName,
params), Command.class.getMethod("getId"));
- }
+ @Before
+ public void givenMethods() throws Throwable {
+ new Command();
+ eventTypeMethod = createCommandMethod("setEventType", String.class);
+ commandNameMethod = createCommandMethod("setName", String.class);
+ currentRouterMethod = new
Method(RouterReference.class.getMethod("setCurrentRouter", Router.class),
+ Router.class.getMethod("getId"));
+ routerIdMethod = new Method(Router.class.getMethod("setId",
String.class), Router.class.getMethod("getId"));
+ routerNameMethod = new Method(Router.class.getMethod("setName",
String.class), Router.class.getMethod("getId"));
+ whenExecutingMethods(instances);
+ }
- @After
- public void tearDown() throws Exception {
- instances.clear();
- expected.clear();
- new RouterReference().setCurrentRouter(null);
- this.eventTypeMethod = null;
- this.commandNameMethod = null;
- this.currentRouterMethod = null;
- this.routerIdMethod = null;
- this.routerNameMethod = null;
- }
+ private Method createCommandMethod(String methodName, Class<?>...
params) throws NoSuchMethodException {
+ return new Method(Command.class.getMethod(methodName, params),
Command.class.getMethod("getId"));
+ }
- @SuppressWarnings({ "unchecked", "rawtypes" })
- @Test
- public void shouldReturnTwoCommandsAndRouter() throws Throwable {
- final Router router = createExpectedRouter();
- expected.put((Class<?>) Router.class, (List)
Arrays.asList(createExpectedRouter()));
- expected.put((Class<?>) Command.class, (List)
router.getCommands());
- expected.put((Class<?>) RouterReference.class,
instances.get(RouterReference.class));
-
- assertEquals(expected, instances);
- }
-
- @Test
- public void shouldSetCurrentRouter() {
- assertEquals(createExpectedRouter(),
- RouterReference.getCurrentRouter());
- }
+ @After
+ public void tearDown() throws Exception {
+ instances.clear();
+ expected.clear();
+ new RouterReference().setCurrentRouter(null);
+ this.eventTypeMethod = null;
+ this.commandNameMethod = null;
+ this.currentRouterMethod = null;
+ this.routerIdMethod = null;
+ this.routerNameMethod = null;
+ }
- private Router createExpectedRouter() {
- return new Router("router2", "router", null,
- new Command("test1", null, null, "testing1"),
- new Command("test2", null, null, "testing2"));
- }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Test
+ public void shouldReturnTwoCommandsAndRouter() throws Throwable {
+ final Router router = createExpectedRouter();
+ expected.put((Class<?>) Router.class, (List)
Arrays.asList(createExpectedRouter()));
+ expected.put((Class<?>) Command.class, (List) router.getCommands());
+ expected.put((Class<?>) RouterReference.class,
instances.get(RouterReference.class));
- private void whenExecutingMethods(
- final Map<Class<?>, List<Object>> instances) throws
Throwable {
+ assertEquals(expected, instances);
+ }
- //router.setId("router2");
- routerIdMethod.execute("router2", instances);
-
- //router.setName("router");
- routerNameMethod.execute("router", instances);
-
- //RouterReference.setCurrentRouter(getReference("router2"));
- currentRouterMethod.execute("router2", instances);
-
- //command1.setEventType("testing1");
- eventTypeMethod.execute("testing1", instances);
-
- //command1.setName("test1");
- commandNameMethod.execute("test1", instances);
-
- //command2.setName("test2");
- commandNameMethod.execute("test2", instances);
-
- //command2.setEventType("testing2");
- eventTypeMethod.execute("testing2", instances);
- }
+ @Test
+ public void shouldSetCurrentRouter() {
+ assertEquals(createExpectedRouter(),
RouterReference.getCurrentRouter());
+ }
+
+ private Router createExpectedRouter() {
+ return new Router("router2", "router", null, new Command("test1",
null, null, "testing1"), new Command("test2",
+ null, null, "testing2"));
+ }
+
+ private void whenExecutingMethods(final Map<Class<?>, List<Object>>
instances) throws Throwable {
+
+ // router.setId("router2");
+ routerIdMethod.execute("router2", instances);
+
+ // router.setName("router");
+ routerNameMethod.execute("router", instances);
+
+ // RouterReference.setCurrentRouter(getReference("router2"));
+ currentRouterMethod.execute("router2", instances);
+
+ // command1.setEventType("testing1");
+ eventTypeMethod.execute("testing1", instances);
+
+ // command1.setName("test1");
+ commandNameMethod.execute("test1", instances);
+
+ // command2.setName("test2");
+ commandNameMethod.execute("test2", instances);
+
+ // command2.setEventType("testing2");
+ eventTypeMethod.execute("testing2", instances);
+ }
}
Modified:
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodThrowsExceptionTest.java
===================================================================
---
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodThrowsExceptionTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/MethodThrowsExceptionTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -1,6 +1,7 @@
package net.geant.perfsonar.messaging;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import java.util.Hashtable;
import java.util.List;
@@ -9,41 +10,46 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author <a
href="mailto:">Blazej
Pietrzak</a>
*/
public class MethodThrowsExceptionTest {
- private Method method;
- private Map<Class<?>, List<Object>> instances = new
Hashtable<Class<?>, List<Object>>();
-
- public void throwException(String arg) throws Exception {
- throw new IllegalArgumentException("test exception.");
- }
+ protected Logger logger = LoggerFactory.getLogger(getClass());
+ private Method method;
+ private Map<Class<?>, List<Object>> instances = new Hashtable<Class<?>,
List<Object>>();
- @Before
- public void whenMethodThrowsException() throws Throwable {
- method = new Method(getClass().getMethod("throwException",
String.class));
- try {
- method.execute("argument", instances);
- fail("Exception was not thrown.");
- } catch (RuntimeException ex) { }
- }
+ public void throwException(String arg) throws Exception {
+ throw new IllegalArgumentException("test exception.");
+ }
- @After
- public void tearDown() throws Exception {
- method = null;
- instances = null;
- }
+ @Before
+ public void whenMethodThrowsException() throws Throwable {
+ method = new Method(getClass().getMethod("throwException",
String.class));
+ try {
+ method.execute("argument", instances);
+ fail("Exception was not thrown.");
+ } catch (RuntimeException ex) {
+ logger.debug("{}: {}", ex.getClass(), ex.getMessage());
+ }
+ }
- @Test
- public void shouldNotInstantiateObject() throws Throwable {
- assertEquals(new Hashtable<Class<?>, List<Object>>(),
instances);
- }
-
- @Test
- public void shouldNotIncreaseCounter() {
- assertEquals(0, method.getCount());
- }
+ @After
+ public void tearDown() throws Exception {
+ method = null;
+ instances = null;
+ }
+
+ @Test
+ public void shouldNotInstantiateObject() throws Throwable {
+ assertEquals(new Hashtable<Class<?>, List<Object>>(), instances);
+ }
+
+ @Test
+ public void shouldNotIncreaseCounter() {
+ assertEquals(0, method.getCount());
+ }
}
Modified:
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/StaticMethodTest.java
===================================================================
---
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/StaticMethodTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/StaticMethodTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -15,29 +15,30 @@
* @author <a
href="mailto:">Blazej
Pietrzak</a>
*/
public class StaticMethodTest {
- final Map<Class<?>, List<Object>> instances = new Hashtable<Class<?>,
List<Object>>();
- private Method method;
-
- public static void staticMethod() { }
+ private final Map<Class<?>, List<Object>> instances = new
Hashtable<Class<?>, List<Object>>();
+ private Method method;
- @Before
- public void givenStaticMethod() throws Exception {
- method = new
Method(StaticMethodTest.class.getMethod("staticMethod"));
- }
+ public static void staticMethod() {
+ }
- @After
- public void tearDown() throws Exception {
- method = null;
- }
+ @Before
+ public void givenStaticMethod() throws Exception {
+ method = new
Method(StaticMethodTest.class.getMethod("staticMethod"));
+ }
- @Test(expected=IllegalStateException.class)
- public void shouldThrowException() throws Exception {
- assertNull(method.getInstance(instances));
- }
-
- @Test
- public void shouldBeEmpty() {
- assertTrue(instances.isEmpty());
- }
+ @After
+ public void tearDown() throws Exception {
+ method = null;
+ }
+ @Test(expected = IllegalStateException.class)
+ public void shouldThrowException() throws Exception {
+ assertNull(method.getInstance(instances));
+ }
+
+ @Test
+ public void shouldBeEmpty() {
+ assertTrue(instances.isEmpty());
+ }
+
}
Modified:
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/XPathDeserializerTest.java
===================================================================
---
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/XPathDeserializerTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/messaging/XPathDeserializerTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -26,81 +26,73 @@
* @author <a
href="mailto:">Blazej
Pietrzak</a>
*/
public class XPathDeserializerTest {
- private static final String REQUEST_ID = "1";
+ private static final String REQUEST_ID = "1";
- private Router[] routers;
- private Reader reader;
- private XPathDeserializer deserializer;
+ private Router[] routers;
+ private Reader reader;
+ private XPathDeserializer deserializer;
- @Before
- public void givenMessageAndDeserializationConfigured() throws
Exception {
+ @Before
+ public void givenMessageAndDeserializationConfigured() throws Exception {
- routers = new Router[] {
- new Router("metadata0", "test1",
-
InetAddress.getAllByName("192.168.1.1")[0],
- Command.PING_IPV6),
- new Router("metadata1", "test2",
-
InetAddress.getAllByName("192.168.1.2")[0],
- Command.SHOW_ENVIRONMENT) };
+ routers = new Router[] {
+ new Router("metadata0", "test1",
InetAddress.getAllByName("192.168.1.1")[0], Command.PING_IPV6),
+ new Router("metadata1", "test2",
InetAddress.getAllByName("192.168.1.2")[0], Command.SHOW_ENVIRONMENT) };
- reader = NMWG.toMetadataKeyResponse(REQUEST_ID, routers);
+ reader = NMWG.toMetadataKeyResponse(REQUEST_ID, routers);
- declarePrefix("nmwg", "http://ggf.org/ns/nmwg/base/2.0/");
- declarePrefix("nmwgr", "http://ggf.org/ns/nmwg/result/2.0/");
+ declarePrefix("nmwg", "http://ggf.org/ns/nmwg/base/2.0/");
+ declarePrefix("nmwgr", "http://ggf.org/ns/nmwg/result/2.0/");
- whenXPath("nmwg:message/nmwg:metadata[nmwg:parameters]/@id")
- .then(Router.class).setId(any(String.class));
+
whenXPath("nmwg:message/nmwg:metadata[nmwg:parameters]/@id").then(Router.class).setId(any(String.class));
- whenXPath(
-
"nmwg:message/nmwg:metadata/nmwg:parameters/nmwg:parameter[@name='url']/@value")
-
.then(Router.class).setAddress(any(String.class));
-
- whenXPath(
-
"nmwg:message/nmwg:metadata[nmwg:parameters]/nmwg:subject/text()")
-
.then(Router.class).setName(any(String.class));
+
whenXPath("nmwg:message/nmwg:metadata/nmwg:parameters/nmwg:parameter[@name='url']/@value").then(Router.class)
+ .setAddress(any(String.class));
- whenXPath(
-
"nmwg:message/nmwg:data[starts-with(@metadataIdRef,
'metadata')]/@metadataIdRef")
- .then(RouterReference.class).setCurrentRouter(
- getReference(Router.class,
identifier(Router.class).getId()));
+
whenXPath("nmwg:message/nmwg:metadata[nmwg:parameters]/nmwg:subject/text()").then(Router.class).setName(
+ any(String.class));
- whenXPath(
-
"nmwg:message/nmwg:data[starts-with(@metadataIdRef,
'metadata')]/nmwgr:datum/nmwg:parameters/nmwg:parameter[@name='command']/@value")
-
.then(Command.class).setName(any(String.class));
+ whenXPath("nmwg:message/nmwg:data[starts-with(@metadataIdRef,
'metadata')]/@metadataIdRef").then(
+
RouterReference.class).setCurrentRouter(getReference(Router.class,
identifier(Router.class).getId()));
- whenXPath(
-
"nmwg:message/nmwg:data[starts-with(@metadataIdRef,
'metadata')]/nmwgr:datum/nmwg:parameters/nmwg:parameter[@name='description']/@value")
-
.then(Command.class).setDescription(any(String.class));
+ whenXPath(
+ "nmwg:message/nmwg:data[starts-with(@metadataIdRef,
'metadata')]/"
+ +
"nmwgr:datum/nmwg:parameters/nmwg:parameter[@name='command']/@value")
+ .then(Command.class).setName(any(String.class));
- whenXPath(
-
"nmwg:message/nmwg:data[starts-with(@metadataIdRef,
'metadata')]/nmwgr:datum/nmwg:parameters/nmwg:parameter[@name='syntax']/@value")
-
.then(Command.class).setSyntax(any(String.class));
-
- whenXPath(
-
"nmwg:message/nmwg:data/nmwgr:datum/nmwg:eventType/text()")
-
.then(Command.class).setEventType(any(String.class));
-
- deserializer = new XPathDeserializer();
- }
+ whenXPath(
+ "nmwg:message/nmwg:data[starts-with(@metadataIdRef,
'metadata')]/"
+ +
"nmwgr:datum/nmwg:parameters/nmwg:parameter[@name='description']/@value")
+ .then(Command.class).setDescription(any(String.class));
- @After
- public void clearConfiguration() {
- XPathDeserializer.clearConfiguration();
- routers = null;
- reader = null;
- }
+ whenXPath(
+ "nmwg:message/nmwg:data[starts-with(@metadataIdRef,
'metadata')]/"
+ +
"nmwgr:datum/nmwg:parameters/nmwg:parameter[@name='syntax']/@value")
+ .then(Command.class).setSyntax(any(String.class));
- @SuppressWarnings("unchecked")
- @Test
- public void shouldReturnRouters() throws Throwable {
- final List<Object> actual = (List<Object>)
deserializer.deserialize(new InputSource(reader));
-
- assertEquals(Arrays.asList(Command.PING_IPV6,
Command.SHOW_ENVIRONMENT),
- deserializer.getObjects(Command.class, actual));
-
- assertEquals(Arrays.asList(
- new Router("metadata0", "test1",
InetAddress.getAllByName("192.168.1.1")[0], Command.PING_IPV6),
- new Router("metadata1", "test2",
InetAddress.getAllByName("192.168.1.2")[0], Command.SHOW_ENVIRONMENT)),
- deserializer.getObjects(Router.class, actual));
- }
+
whenXPath("nmwg:message/nmwg:data/nmwgr:datum/nmwg:eventType/text()").then(Command.class).setEventType(
+ any(String.class));
+
+ deserializer = new XPathDeserializer();
+ }
+
+ @After
+ public void clearConfiguration() {
+ XPathDeserializer.clearConfiguration();
+ routers = null;
+ reader = null;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void shouldReturnRouters() throws Throwable {
+ final List<Object> actual = (List<Object>)
deserializer.deserialize(new InputSource(reader));
+
+ assertEquals(Arrays.asList(Command.PING_IPV6,
Command.SHOW_ENVIRONMENT),
+ deserializer.getObjects(Command.class, actual));
+
+ assertEquals(Arrays.asList(new Router("metadata0", "test1",
InetAddress.getAllByName("192.168.1.1")[0],
+ Command.PING_IPV6), new Router("metadata1", "test2",
InetAddress.getAllByName("192.168.1.2")[0],
+ Command.SHOW_ENVIRONMENT)),
deserializer.getObjects(Router.class, actual));
+ }
}
Modified:
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates/TemplateEngineTest.java
===================================================================
---
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates/TemplateEngineTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates/TemplateEngineTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -1,6 +1,6 @@
package net.geant.perfsonar.templates;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import java.io.StringWriter;
import net.geant.perfsonar.messaging.data.Dummy;
@@ -12,12 +12,13 @@
*/
public class TemplateEngineTest {
- @Test
- public void shouldProcessTemplateFromJar() throws Exception {
- final StringWriter out = new StringWriter();
- TemplateEngine.put("name", "John Doe");
- TemplateEngine.evaluate(out, Dummy.class, "Hello.template");
- assertEquals("Hello John Doe!", out.toString());
- }
+ // This test relies on a template being present in an external jar (@see
net.geant.perfsonar.messaging.data)
+ @Test
+ public void shouldProcessTemplateFromJar() throws Exception {
+ final StringWriter out = new StringWriter();
+ TemplateEngine.put("name", "John Doe");
+ TemplateEngine.evaluate(out, Dummy.class, "Hello.template");
+ assertEquals("Hello John Doe!", out.toString());
+ }
}
Added: trunk/perfsonar-base/messaging/src/test/resources/log4j.xml
===================================================================
--- trunk/perfsonar-base/messaging/src/test/resources/log4j.xml
(rev 0)
+++ trunk/perfsonar-base/messaging/src/test/resources/log4j.xml 2013-05-13
19:34:02 UTC (rev 6378)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+
+<!-- This is the configuration for LOG4J for perfSONAR development/testing
purposes -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <!-- Section: APPENDERS -->
+
+ <!--
+ writes log messages to the console. It outputs file name,
+ method name and line number of the caller. This is slow,
+ so just use it for debugging.
+ -->
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d - [%p] %c{1}[%M]:%L -
%m %n"/>
+ </layout>
+ </appender>
+
+ <!-- We have a log file for pSbase -->
+ <appender name="psbase" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/psbase.log"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="MaxBackupIndex" value="5"/>
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
+ </layout>
+ </appender>
+
+ <!-- We have a log file for velocity -->
+ <appender name="velocity" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/velocity.log"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="MaxBackupIndex" value="5"/>
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
+ </layout>
+ </appender>
+
+ <!-- Velocity is logged only to its own file -->
+ <logger name="velocity" additivity="false">
+ <level value="info"/>
+ <appender-ref ref="velocity"/>
+ </logger>
+
+ <!-- pSbase -->
+ <logger name="net.geant.perfsonar">
+ <level value="debug"/>
+ <appender-ref ref="psbase"/>
+ </logger>
+
+
+ <!-- Console logging for everything else -->
+ <root>
+ <level value="info"/>
+ <appender-ref ref="console"/>
+ </root>
+
+</log4j:configuration>
Property changes on:
trunk/perfsonar-base/messaging/src/test/resources/log4j.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/perfsonar-base/messaging-test-data/pom.xml
===================================================================
--- trunk/perfsonar-base/messaging-test-data/pom.xml 2013-05-13 09:33:12
UTC (rev 6377)
+++ trunk/perfsonar-base/messaging-test-data/pom.xml 2013-05-13 19:34:02
UTC (rev 6378)
@@ -13,7 +13,9 @@
<artifactId>messaging-test-data</artifactId>
<version>1.0.0</version>
<name>perfSONAR base 3 Test data for Messaging</name>
- <description>Contains test data needed to properly run perfSONAR base
3 messaging tests.</description>
+ <description>Contains test data needed to properly run perfSONAR base
3 messaging tests.
+
+It is currently used by
net.geant.perfsonar.templates.TemplateEngineTest.java to check if the
TemplateEngine can read templates coming from another jar.</description>
<scm>
<connection>scm:svn:http://svn.geant.net/GEANT/SA2/ps-java-services/trunk/perfsonar-base/messaging-test-data/</connection>
Property changes on: trunk/perfsonar-base/sample-service
___________________________________________________________________
Modified: svn:ignore
- target
.settings
.project
.classpath
.pmd
.pmdruleset
+ target
logs
.settings
.project
.classpath
.pmd
.pmdruleset
Modified:
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPTest.java
===================================================================
---
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPTest.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPTest.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -26,7 +26,6 @@
import org.xml.sax.InputSource;
public class SSHTelnetMPTest {
-
protected Logger logger = LoggerFactory.getLogger(getClass());
static final String REQUEST_ID = "request1";
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/authn/component/wssec/WSSecAuthNComponent.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/authn/component/wssec/WSSecAuthNComponent.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/authn/component/wssec/WSSecAuthNComponent.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -21,7 +21,7 @@
@Override
public void destroy() throws PerfSONARException {
- LOGGER.debug("WSSecAuthNComponent: destroy");
+ logger.debug("WSSecAuthNComponent: destroy");
}
@Override
@@ -31,13 +31,13 @@
@Override
public void init() throws PerfSONARException {
- LOGGER.debug("WSSecAuthNComponent: init");
+ logger.debug("WSSecAuthNComponent: init");
}
public void requestAuthN(String messageType) throws PerfSONARException {
SecurityToken st = new
SecurityToken(SecTokenManagerFactory.getDefaultSecTokenManager());
if (!st.hasSecTokenInRequest()) {
- LOGGER.error("WSSecAuthNComponent: It has not sent any Security
Token");
+ logger.error("WSSecAuthNComponent: It has not sent any Security
Token");
throw new PerfSONARException("authn_not_sectoken");
}
st.setSecTokenFromRequest();
@@ -47,7 +47,7 @@
AADispatchManager aadm = new AADispatchManager(aadp);
AuthNResponse authnRes = aadm.getAuthentication(authnReq);
if (authnRes.getStatus() != AuthNResponse.AUTHENTICATED) {
- LOGGER.error("WSSecAuthNComponent: Authentication failed (" +
authnRes.getResultCode() + ")");
+ logger.error("WSSecAuthNComponent: Authentication failed (" +
authnRes.getResultCode() + ")");
throw new PerfSONARException(authnRes.getResultCode());
}
}
@@ -55,7 +55,7 @@
private String getResource() throws PerfSONARException {
String res = this.getOption(compIdService).getValue();
if (res == null) {
- LOGGER.error("Component ID not configured");
+ logger.error("Component ID not configured");
throw new PerfSONARException("as_edugain");
}
return res;
@@ -65,7 +65,7 @@
public void requestAuthR(String messageType, String eventType) throws
PerfSONARException {
SecurityToken st = new
SecurityToken(SecTokenManagerFactory.getDefaultSecTokenManager());
if (!st.hasSecTokenInRequest()) {
- LOGGER.error("WSSecAuthNComponent: It has not sent any Security
Token");
+ logger.error("WSSecAuthNComponent: It has not sent any Security
Token");
throw new PerfSONARException("authn_not_sectoken");
}
st.setSecTokenFromRequest();
@@ -78,7 +78,7 @@
authrReq.setSubject(SecTokenSOAPManager.getSubject(st));
} catch (Exception e) {
e.printStackTrace();
- LOGGER.error("WSSecAuthNComponent: Cannot get authR data from
the Security Token");
+ logger.error("WSSecAuthNComponent: Cannot get authR data from
the Security Token");
throw new PerfSONARException("authn_not_sectoken");
}
@@ -87,7 +87,7 @@
AADispatchManager aadm = new AADispatchManager(prot);
AuthRResponse authrRes = aadm.getAuthorization(authrReq);
if (authrRes.getStatus() != AuthRResponse.AUTHORIZED) {
- LOGGER.error("WSSecAuthNComponent: Authentication failed (" +
authrRes.getResultCode() + ")");
+ logger.error("WSSecAuthNComponent: Authentication failed (" +
authrRes.getResultCode() + ")");
throw new PerfSONARException(authrRes.getResultCode());
}
}
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/Actions.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/Actions.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/Actions.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -24,7 +24,7 @@
public void addAction(Action action) {
actions.put(action.getName(), action);
- LOGGER.debug("Action " + action.getName() + " to the scheduler");
+ logger.debug("Action " + action.getName() + " to the scheduler");
}
public Action getAction(String name) {
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/OptionEntry.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/OptionEntry.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/OptionEntry.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -22,7 +22,7 @@
protected Map<String, Option> options = null;
- protected static final Logger LOGGER =
LoggerFactory.getLogger("org.perfsonar.base2.service.configuration");
+ protected Logger logger = LoggerFactory.getLogger(getClass());
// -----------------------------------------------------------
Constructor
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/messages/GenericMessageHandler.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/messages/GenericMessageHandler.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/messages/GenericMessageHandler.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -35,7 +35,7 @@
*/
public class GenericMessageHandler implements MessageHandler {
- private static final Logger LOGGER =
LoggerFactory.getLogger(GenericMessageHandler.class);
+ protected Logger logger = LoggerFactory.getLogger(getClass());
public GenericMessageHandler() throws PerfSONARException {
@@ -51,13 +51,13 @@
protected void checkAuth(Configuration c, String messageType) throws
PerfSONARException {
try {
String authR =
c.getMessageHandler(messageType).getOption("authR").getValue();
- LOGGER.debug("Checking authorization: " + authR);
+ logger.debug("Checking authorization: " + authR);
if ("yes".equals(authR)) {
AuthNComponent authComponent = (AuthNComponent)
c.getAuxiliaryComponent("auth");
authComponent.requestAuthR(messageType, null);
} else {
String authN =
c.getMessageHandler(messageType).getOption("authN").getValue();
- LOGGER.debug("Checking authentication: " + authN);
+ logger.debug("Checking authentication: " + authN);
if ("yes".equals(authN)) {
AuthNComponent authComponent = (AuthNComponent)
c.getAuxiliaryComponent("auth");
authComponent.requestAuthN(messageType);
@@ -71,8 +71,7 @@
Message reqMessage = (Message) request.getElement();
- LOGGER.debug("Message Handler started for message type [" +
reqMessage.getType() + "]");
- //
LOGGER.debug("--------------------\n"+reqMessage+"\n------------------------\n");
+ logger.debug("Message Handler started for message type [" +
reqMessage.getType() + "]");
// get Service engine for this message
String messageType = null;
@@ -96,7 +95,7 @@
String m = "Cannot find ServiceEngine [" +
serviceEngineClassName + "] for message type [" + messageType
+ "], nested exception was:" + ex.toString();
PerfSONARException pse = new
PerfSONARException("no_service_engine", m);
- LOGGER.error(m, ex);
+ logger.error(m, ex);
response.setElement(ResultCodesUtil.generateResultMessage(null,
pse));
return; // finish when cannot execute ServiceEngine
@@ -119,7 +118,7 @@
try {
- LOGGER.debug("Request.execute: run Service Engine for
extracted request");
+ logger.debug("Request.execute: run Service Engine for
extracted request");
// run service engine and add result to output list
try {
@@ -129,7 +128,7 @@
} catch (RuntimeException rex) {
// just in case of unexpected runtime exception such as
// null, indexoutofbounds, classcast, etc.
- LOGGER.error("Service engine failed", rex);
+ logger.error("Service engine failed", rex);
throw new PerfSONARException("runtime_exception",
"Runtime exception in ServiceEngine: "
+ rex.getMessage(), rex);
}
@@ -137,7 +136,7 @@
// if an exception was thrown, convert it to result code
// and add as a new message (to be joined) to array
- LOGGER.info("Message handler result code: " + e);
+ logger.info("Message handler result code: " + e);
resSM.setElement(ResultCodesUtil.generateResultMessage(e.getResultCode(),
e.getMessage()));
}
@@ -186,7 +185,7 @@
} catch (NoSuchMetadataException e) {
// wrong MetadataIdRef, remove it
- LOGGER.warn("metadataIdRef is empty or there is no Metadata
with the given metadataIdRef, metadataIdRef="
+ logger.warn("metadataIdRef is empty or there is no Metadata
with the given metadataIdRef, metadataIdRef="
+ metadataIdRef);
}
}
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/registration/AbstractRegistrationAction.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/registration/AbstractRegistrationAction.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/registration/AbstractRegistrationAction.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -11,8 +11,6 @@
import java.util.LinkedList;
import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.perfsonar.base2.service.configuration.Action;
import org.perfsonar.base2.service.configuration.Configuration;
import org.perfsonar.base2.service.configuration.ConfigurationManager;
@@ -49,8 +47,6 @@
private boolean initialized = false;
- private Logger logger =
LoggerFactory.getLogger(AbstractRegistrationAction.class);
-
private static final String KEEP_ALIVE_OPTION = "keepAlive";
/**
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/registration/MetadataExistDBRegisterDataSource.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/registration/MetadataExistDBRegisterDataSource.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/registration/MetadataExistDBRegisterDataSource.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -28,9 +28,6 @@
protected static final String REGISTER_DATA_SOURCE_EXTENSION_NAME =
"registerExtension-registerDataSource";
- // private static final Logger LOGGER =
- // LoggerFactory.getLogger(ExistDBRegisterDataSource.class);
-
// ------------------------------------------------------------- Methods
public ServiceMessage getRegisterData() throws PerfSONARException {
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/requesthandler/EchoServiceEngine.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/requesthandler/EchoServiceEngine.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/requesthandler/EchoServiceEngine.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -22,7 +22,7 @@
// ------------------------------------------------------------- class
// fields
- private static final Logger LOGGER =
LoggerFactory.getLogger(EchoServiceEngine.class);
+ protected Logger logger = LoggerFactory.getLogger(getClass());
public static final String ECHO_EVENT_TYPE =
"http://schemas.perfsonar.net/tools/admin/echo/2.0";
@@ -36,7 +36,7 @@
public void takeAction(ServiceMessage serviceRequest, ServiceMessage
serviceResponse) throws PerfSONARException {
- LOGGER.debug("Simple echo ServiceEngine started.");
+ logger.debug("Simple echo ServiceEngine started.");
Message request = serviceRequest.getMessageElement();
String eventType = getEventType(request);
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/scheduler/SchedulingComponent.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/scheduler/SchedulingComponent.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/scheduler/SchedulingComponent.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -52,7 +52,7 @@
*/
protected void loadSettings() throws PerfSONARException {
- LOGGER.debug("SchedulingComponent - loading configuration");
+ logger.debug("SchedulingComponent - loading configuration");
// get classname
schedulerClassName = getOption("schedulerClassName").getValue();
@@ -62,7 +62,7 @@
try {
interval = Integer.parseInt(intervalStr);
} catch (Exception ex) {
- LOGGER.warn("Can not get correct interval value for scheduling
from the configuration. "
+ logger.warn("Can not get correct interval value for scheduling
from the configuration. "
+ " Default value is taken. Nester exception is: " +
ex.getMessage());
interval = DEFAULT_INTERVAL;
}
@@ -89,7 +89,7 @@
scheduler.setInterval(interval); // seconds
scheduler.start();
} else {
- LOGGER.error("Can not start the scheduler because it does not
exist");
+ logger.error("Can not start the scheduler because it does not
exist");
}
}
@@ -98,7 +98,7 @@
if (scheduler != null) {
scheduler.finish();
} else {
- LOGGER.warn("Can not stop the scheduler because it does not
exist");
+ logger.warn("Can not stop the scheduler because it does not
exist");
}
}
@@ -141,7 +141,7 @@
*/
public void registerActions() {
- LOGGER.debug("RegisterActions: Start of registering schedulling
tasks. Default interval is [" + interval
+ logger.debug("RegisterActions: Start of registering schedulling
tasks. Default interval is [" + interval
+ "] sec");
if (scheduler != null) {
@@ -157,7 +157,7 @@
actionInterval =
Integer.parseInt(action.getOption("interval").getValue());
} catch (Exception ex) {
// NullPointer if no option or NumberFormatException
- LOGGER.warn("Taking default [" + actionInterval + "]
value of action interval");
+ logger.warn("Taking default [" + actionInterval + "]
value of action interval");
}
// get option status - on/off
@@ -169,10 +169,10 @@
if ("on".equals(actionStatus)) {
scheduler.addTask(actionInterval, (SchedulerAction)
action);
- LOGGER.debug("Action [" + action.getName() + "] class ["
+ action.getClass()
+ logger.debug("Action [" + action.getName() + "] class ["
+ action.getClass()
+ "] registered to the scheduler with interval
[" + actionInterval + "] seconds");
} else {
- LOGGER.info("Action [" + action.getName() + "] class ["
+ action.getClass()
+ logger.info("Action [" + action.getName() + "] class ["
+ action.getClass()
+ "] not loaded, status set to [OFF]");
}
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/scheduler/SimpleScheduler.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/scheduler/SimpleScheduler.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/scheduler/SimpleScheduler.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -96,7 +96,6 @@
}
- // LOGGER.debug("Scheduler waits ["+interval+"] ms");
Thread.sleep(interval * 1000); // wait seconds
iteration++; // increase iteration counter
Modified:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/storage/xml/XMLDBComponent.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/storage/xml/XMLDBComponent.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/storage/xml/XMLDBComponent.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -26,7 +26,7 @@
loadSettings();
createCredential();
createDataStorage();
- LOGGER.debug("XMLDB Component created with [" +
dataStorage.getClass() + "] XML data storage");
+ logger.debug("XMLDB Component created with [" +
dataStorage.getClass() + "] XML data storage");
checkConfiguration();
}
@@ -51,13 +51,13 @@
protected void checkConfiguration() {
- LOGGER.debug("Checking DB configuration:");
- LOGGER.debug(" - uri: " + uri);
- LOGGER.debug(" - username: " + username);
- LOGGER.debug(" - password: " + password);
- LOGGER.debug(" - dataStorageClassName: " + dataStorageClassName);
- LOGGER.debug(" - dataStorage: " + dataStorage);
- LOGGER.debug(" - dataCredential: " + credential);
+ logger.debug("Checking DB configuration:");
+ logger.debug(" - uri: " + uri);
+ logger.debug(" - username: " + username);
+ logger.debug(" - password: " + password);
+ logger.debug(" - dataStorageClassName: " + dataStorageClassName);
+ logger.debug(" - dataStorage: " + dataStorage);
+ logger.debug(" - dataCredential: " + credential);
}
@@ -80,7 +80,7 @@
dataStorage = null;
try {
// get a new class for that classname
- LOGGER.debug(dataStorageClassName);
+ logger.debug(dataStorageClassName);
dataStorage = (XMLDataStorage)
Class.forName(dataStorageClassName).newInstance();
} catch (Exception e) {
// TODO: url event types
Deleted: trunk/perfsonar-java-rrd-ma-SQL_backend/doc/ChangeLog.txt
===================================================================
--- trunk/perfsonar-java-rrd-ma-SQL_backend/doc/ChangeLog.txt 2013-05-13
09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-java-rrd-ma-SQL_backend/doc/ChangeLog.txt 2013-05-13
19:34:02 UTC (rev 6378)
@@ -1,139 +0,0 @@
-Java RRD MA ChangeLog
-------------------------------------------------------------------------
-2010-02-25 Version 3.3-1
-
-- New: Use of new base library (base2)
-- Change: Removed WebAdmin. New WebAdmin will be available in the next rc
-- Change: Renamed service. Now the name of the service is:
perfsonar-java-rrd-ma
-- Change: Directory structure changed - now the main service directory is:
/usr/lib/perfsonar/services/perfsonar-java-rrd-ma
-- Change: Url changed. Now the service url is:
http://localhost:8180/perfsonar-java-rrd-ma/services/MeasurementArchiveService
-- Change: Configuration files changed. Now the main conf file is:
configuration.xml
-- Change: SVN migration. Now the SVN adress is:
http://svn.geant.net/GEANT/SA2/ps-java-services/trunk/perfsonar-java-rrd-ma
-
-2009-07-08 Version 3.2
-
-- Change: Removed Admin Guide from doc directory. Up-to-date Admin Guide is
now available only on svn
-- Change: Rename package from geant2-java-sql-ma to perfsonar-java-sql-ma
-
-2009-07-08 Version 3.1.2-1
-
-- Dummy package to rename service from geant2-java-rrd-ma to
perfsonar-java-rrd-ma
-
-2009-03-04 Version 3.1.1
-
-- Fixed Bug #724: wrong paths of log files
-
-2008-10-01 Version 3.1
-
-- New: available as deb package
-- New: EchoRequest message allows now checking: if eXist database is running
and the count the content of metadata configuration file;
- access data from random RRD file. It is also possible to request a
self-test including all above.
-- New: parameter keyword introduced in metadata block to indicate
project/organisation name
-- New: new request MeasurementArchiveStoreRequest switched off by default
-- New: performance improvements for MetadataKeyRequest message which fetches
all metadata elements
-- Change: eXist default port is 8180
-- Change: new service path /usr/lib/perfsonar/services/geant2-java-rrd-ma/
-- Change: format of log messages changed
-- Change: use of pSbase v1.0.20080902
-- Change: use of web admin library v0.9.3c
-- Change: obsolete authRealm removed from metadata configuration file
-- Fixed Bug #497: default value of service.r.access_point property
-- Fixed Bug #405: request for ability to define which domain is the
interface (solved via keyword)
-
-2008-03-10 Version 3.0
-
-- New: support of ErrorResponse message type (use of perfsonar-base library
version 1.0.20080310)
-- New: netutil namespace of datum element in the response containing
utilization value is used.
-- New: WebAdmin administration (set of servlets) added
-- New: RPM is used as the installation package
-- New: support of AuthN functionality
-- Change: supportedEventTypes parameter in metadata element (in metadata
cofiguration file)
- replaced with eventType element (the parameter is still supported)
-- Change: LS register component can now take metadata elements from xml
database directly
- (not only from XML metadata config file)
-- Change: LS register interval time updated (now it's 12 hours)
-- Change: service name has changed (now it is geant2-java-rrd-ma)
-- Fixed Bug #304: SetupDataResponse documentation not consistent
-- Fixed Bug #348: LS registration failed
-
-
-2007-11-23 Version 2.3.2
-
-- New: the dump of rrd test file added
-- Fixed Bug #264: bulding the rrdjtool library for 64 bit arch fixed
-
-
-2007-10-26 Version 2.3.1
-
-- Fixed Bug #243: problem with static default context name of eXist in URL
address
-
-
-2007-10-24 Version 2.3
-
-- New: support for two additional characteristics: ifErrors and ifDiscards
-- New: new RRD test file to reflect new characteristics
-- New: eventType paremeter added to the key
-- Change: nmwg namespace for utilization datum element
-- Change: defaultly all log messages are collected in one log file
-- Change: defaultly debug log level is switched off
-- Change: base chanining switched on, propert in service.properties exist to
switch it off
-- Change: eventType URL-based only
-- Change: service moved to new SVN structure
-- Change: ant scripts improved
-- Change: namespace of datum elements in SetupDataResponse message tied to
eventType value
-- Change: supportedEventType parameter replaced by eventType element in
metadata config file (excluding utilization).
- But the service supports both.
-- Change: use of new versions of base and NMWG libraries
-- Change: if 'jar' target is called and const.properties file does not exist
then const.properties.template
- is renamed into const.properties before compilation
-- Change: new parameters set in data element in SetupDataResponse message
containing general parameters used
- to create rrd file
-- Change: updated support for LookupInfoRequest to include all service
properties
-- Change: service can generate keys with parameters elements of different
namespaces
-- Fixed Bug #102: missing data in response
-- Fixed Bug #103: missing data in response
-- Fixed Bug #150: time interval shifted
-- Fixed Bug #157: namespace declaration
-- Fixed Bug #195: directories structure
-- Fixed Bug #198: exist database installation and initialisation limitations
-- Fixed Bug #205: collection name inside eXist is "rrdmaconfig" by default
-- Fixed Bug #221: supportedEventType vs eventType compatibility issue
-- Fixed Bug #222: overwriting parameter elements in the key
-- Fixed Bug #224: schema incomplete for LookupInfoResponse
-- Fixed Bug #225: chained metadata accepted in LookupInfo in contrary to rnc
-- Fixed Bug #226: LookupInfoRequest with no id in Data element accepted
-- Fixed Bug #234: proper strings handling
-- Fixed Bug #236: store - missing interface element
-- Fixed Bug #240: LookupInfo documentation not updated
-
-
-2007-05-22 Version 2.2
-
-- Change: default log4j parameters updated; can generate 11 archive log
files for each log level (500KB each)
-- Change: bug of wrong Context of exist war file fixed
-- Change: bug of wrong data source name when writing data into new RRD file
fixed.
- Using new eventType was causing a problem while storing new data
in RRD MA
-
-
-2007-05-15 Version 2.1
-
-- New: Support for LookupInfoRequest for getting general information about
the service
-- New: Key contains optional parameters describing RRD file: step, data
type, heartbeat, min and max value
-- New: Configure script asks for service description, contact email and
organization name
-- New: Iso time type support
-- Change: using only one exception class
-
-
-2007-03-21 Version 2.0
-
-- New: Lookup Service registration
-- New: pre-install, configure, deploy, test steps in installation process
-- New: echoRequest functionality
-- New: 64-bit Linux support for building the rrdjtool library
-- New: result codes
-- New: support for mulitple service in one Tomcat instance
-- New: removing whitespaces such as newline, tabs, etc that are present in
the request messages
-- Change: support for new utilization evenType value naming scheme
-- Change: log4J configuration in log4j.properties
-- Fixed Bug #108: installation process
-- Fixed Bug #109: installation process
Modified: trunk/perfsonar-java-rrd-ma-SQL_backend/doc/Collaboration.txt
===================================================================
--- trunk/perfsonar-java-rrd-ma-SQL_backend/doc/Collaboration.txt
2013-05-13 09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-java-rrd-ma-SQL_backend/doc/Collaboration.txt
2013-05-13 19:34:02 UTC (rev 6378)
@@ -1,27 +1,24 @@
+This software is the result of joint efforts of the following perfSONAR
project
+participants:
-This software is the result of join efforts of the following perfSONAR
project participants:
-
-- Arnes
-- CARnet
-- Cesnet
-- Dante
+- ARNES
+- CARNet
+- CESNET
+- DANTE
- Belnet
- Das Deutsche Forschungsnetz (DFN)
- Energy Sciences Network (ESnet)
- FCCN
- GARR
-- GRnet
+- GRNET
- Internet2
- IST
+- NORDUnet
- Poznan Supercomputing and Networking Center (PSNC)
- Rede Nacional de Ensino e Pesquisa (RNP)
- RedIRIS
-- Renater
+- RENATER
- SURFnet
- SWITCH
- Uninett
- University of Delaware
-
-
-
- -- Roman Lapacz
<>
Mon, 05 Jan 2009 12:00:00 +0200
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/doc/backward-compatibility.txt
===================================================================
--- trunk/perfsonar-java-rrd-ma-SQL_backend/doc/backward-compatibility.txt
2013-05-13 09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-java-rrd-ma-SQL_backend/doc/backward-compatibility.txt
2013-05-13 19:34:02 UTC (rev 6378)
@@ -2,6 +2,7 @@
Backward compatibility
----------------------------------------------------------------------------------------------------
+TODO: This document is old and should be fully reviewed in the light of the
current version (3.4.2) and upper.
1. The service ver. 4.0 does not support requests messages containing
advanced merge chaining.
@@ -43,9 +44,6 @@
4. If you want to install the service ver. 4.0 but still use the service
address
http://<host>:<port>/geant2-java-rrd-ma/services/MeasurementArchiveService
- go to the directory /usr/lib/perfsonar/services/ and create the symlink
'gent2-java-rrd-ma'
+ go to the directory /usr/lib/perfsonar/services/ and create the symlink
'geant2-java-rrd-ma'
ln -s /usr/lib/perfsonar/services/ps-mdm-rrd-ma geant2-java-rrd-ma
-
-
-
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/doc/configure.ls-registration.txt
===================================================================
--- trunk/perfsonar-java-rrd-ma-SQL_backend/doc/configure.ls-registration.txt
2013-05-13 09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-java-rrd-ma-SQL_backend/doc/configure.ls-registration.txt
2013-05-13 19:34:02 UTC (rev 6378)
@@ -1,7 +1,7 @@
********
* Note *
********
-As of RRD MA version 3.4 and upper, the AuthN component is not supported
anymore.
+As of RRD MA version 3.4 and upper, the LS registration component is not
supported anymore.
Work is in progress to provide a replacement.
Configuration of LS registration component
Modified: trunk/perfsonar-java-rrd-ma-SQL_backend/doc/copyright
===================================================================
--- trunk/perfsonar-java-rrd-ma-SQL_backend/doc/copyright 2013-05-13
09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-java-rrd-ma-SQL_backend/doc/copyright 2013-05-13
19:34:02 UTC (rev 6378)
@@ -1,3 +1,3 @@
This software is distributed under the GÉANT Standard Open Source Software
-Outward Licence. See enclosed doc/License.txt and doc/Collaboration.txt files
+Outward Licence. See enclosed License.txt and Collaboration.txt files
for copyright notice.
\ No newline at end of file
Modified: trunk/perfsonar-java-rrd-ma-SQL_backend/src/deb/control/changelog
===================================================================
--- trunk/perfsonar-java-rrd-ma-SQL_backend/src/deb/control/changelog
2013-05-13 09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-java-rrd-ma-SQL_backend/src/deb/control/changelog
2013-05-13 19:34:02 UTC (rev 6378)
@@ -4,7 +4,7 @@
* WebAdmin: added a page to empty the metadata DB
* Updated project documentation
- -- Antoine Delvaux
<>
Tue, 23 Apr 2013 18:37:01 +0000
+ -- Antoine Delvaux
<>
Fri, 10 May 2013 14:02:00 +0000
perfsonar-java-rrd-ma (3.4-7) testing; urgency=low
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/EchoServiceEngine.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/EchoServiceEngine.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/EchoServiceEngine.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -21,16 +21,11 @@
import java.util.ArrayList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public class EchoServiceEngine extends
org.perfsonar.base2.service.requesthandler.EchoServiceEngine
{
// ------------------------------------------------------------- class
fields
- protected Logger logger = LoggerFactory.getLogger(getClass());
-
// TODO: Should eventTypes for success be full URL or only the last bit
(like in the echo success from pSbase2)
public static final String ECHO_METADATA_TEST =
"http://schemas.perfsonar.net/tools/admin/selftest/1" +
".0/metadata-test";
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/MetadataKeyMessageHandler.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/MetadataKeyMessageHandler.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/MetadataKeyMessageHandler.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -82,7 +82,6 @@
Message reqMessage = (Message) request.getElement();
LOGGER.debug("Message Handler started for message type [" +
reqMessage.getType() + "]");
-
//LOGGER.debug("--------------------\n"+reqMessage+"\n------------------------\n");
//get Service engine for this message
String messageType = null;
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/SetupDataServiceEngine.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/SetupDataServiceEngine.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/SetupDataServiceEngine.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -45,7 +45,6 @@
/*
Message request = (Message)serviceRequest.getElement();
- LOGGER.info("REQUEST:\n "+request.getText());
HashMap<Metadata, Data> pairs = getMetadataDataPairs(request);
HashMap<Metadata, Data> pairsToQuery = checkMetadata(pairs);
@@ -249,7 +248,6 @@
+ npex.toString());
*/
//npex.printStackTrace();
- //LOGGER.error("PSNC ERROR:" + npex.getMessage());
//}
}
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/rrd/RRDDataStorageDAOImpl.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/rrd/RRDDataStorageDAOImpl.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/rrd/RRDDataStorageDAOImpl.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -11,16 +11,12 @@
import org.perfsonar.base2.xml.nmwg.Parameter;
import
org.perfsonar.service.measurementArchive.rrdType.storage.DataStorageDAO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import static
org.perfsonar.service.measurementArchive.rrdType.storage.rrd.Rrd.FetchData;
public class RRDDataStorageDAOImpl extends Component implements
DataStorageDAO
{
- protected Logger logger = LoggerFactory.getLogger(getClass());
-
public static final String CONSOLIDATION_AVERAGE = "AVERAGE";
public static final String CONSOLIDATION_MIN = "MIN";
public static final String CONSOLIDATION_MAX = "MAX";
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/MysqlMetadataStorageDAOImpl.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/MysqlMetadataStorageDAOImpl.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/MysqlMetadataStorageDAOImpl.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -25,13 +25,8 @@
import
org.perfsonar.service.measurementArchive.rrdType.storage.persistence.entity.Interfaces;
import
org.perfsonar.service.measurementArchive.rrdType.storage.sql.query.QueryGenerator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public class MysqlMetadataStorageDAOImpl extends Component implements
MetadataStorageDAO
{
- protected Logger logger = LoggerFactory.getLogger(getClass());
-
public static final String PERSISTENCE_UNIT_NAME =
"org.perfsonar.service.measurementArchive.rrdType.storage.sql";
protected EntityManager em;
protected final QueryGenerator qg = new QueryGenerator();
Modified: trunk/perfsonar-java-rrd-ma-SQL_backend/src/rpm/changelog
===================================================================
--- trunk/perfsonar-java-rrd-ma-SQL_backend/src/rpm/changelog 2013-05-13
09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-java-rrd-ma-SQL_backend/src/rpm/changelog 2013-05-13
19:34:02 UTC (rev 6378)
@@ -1,3 +1,8 @@
+* Fri 10 May 2013 Antoine Delvaux
<>
3.4.2-1
+- WebAdmin restored and updated
+- WebAdmin: added a page to empty the metadata DB
+- Updated project documentation
+
* Wed Aug 29 2012 Gerd Behrmann
<>
3.4-2
- Set explicit table name for interfaces table
- Reduced logging overhead of large messages
Modified:
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/config/HTMLGenerator.java
===================================================================
---
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/config/HTMLGenerator.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/config/HTMLGenerator.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -24,7 +24,7 @@
public class HTMLGenerator {
- private final Logger logger = LoggerFactory.getLogger(getClass());
+ protected Logger logger = LoggerFactory.getLogger(getClass());
public enum UIType {
DROPDOWN, RADIO, RADIOGROUP, TEXTBOX, PASSOWRD;
Modified:
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/config/ObjectMap.java
===================================================================
---
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/config/ObjectMap.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/config/ObjectMap.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -34,7 +34,7 @@
@SuppressWarnings("serial")
public class ObjectMap extends Hashtable<Integer, Object> {
- private final Logger logger = LoggerFactory.getLogger(getClass());
+ protected Logger logger = LoggerFactory.getLogger(getClass());
private Tuple<WebAdminInterface, JAXBContext> waconfig;
private String waconfigfile = "";
Modified:
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/servlet/util/ConfigurationServletHelper.java
===================================================================
---
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/servlet/util/ConfigurationServletHelper.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/servlet/util/ConfigurationServletHelper.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -15,7 +15,7 @@
public class ConfigurationServletHelper {
- private final Logger logger = LoggerFactory.getLogger(getClass());
+ protected Logger logger = LoggerFactory.getLogger(getClass());
// TODO: Isn't the Session timeout set in the WebAdmin configuration
file?
static final short SESSION_INTERVAL = 3600;
Modified:
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/test/SOAPClient.java
===================================================================
---
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/test/SOAPClient.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-web-admin/perfsonar-java-web-admin-component/src/main/java/org/perfsonar/webadmin/test/SOAPClient.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -22,7 +22,7 @@
*/
public class SOAPClient {
- private final Logger logger = LoggerFactory.getLogger(getClass());
+ protected Logger logger = LoggerFactory.getLogger(getClass());
private final String url;
Modified: trunk/perfsonar-java-xml-ls/pom.xml
===================================================================
--- trunk/perfsonar-java-xml-ls/pom.xml 2013-05-13 09:33:12 UTC (rev 6377)
+++ trunk/perfsonar-java-xml-ls/pom.xml 2013-05-13 19:34:02 UTC (rev 6378)
@@ -281,7 +281,7 @@
<dependency>
<groupId>net.geant.perfsonar</groupId>
<artifactId>perfsonar-java-base2</artifactId>
- <version>1.1.1</version>
+ <version>1.1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>exist</artifactId>
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegistrationMessageHandler.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegistrationMessageHandler.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegistrationMessageHandler.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -6,9 +6,6 @@
import java.util.List;
import java.util.Map;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.perfsonar.base2.service.exceptions.PerfSONARException;
import org.perfsonar.base2.service.messages.GenericMessageHandler;
import org.perfsonar.base2.xml.Element;
@@ -18,8 +15,6 @@
public class LSRegistrationMessageHandler extends GenericMessageHandler {
- protected Logger logger = LoggerFactory.getLogger(getClass());
-
public LSRegistrationMessageHandler() throws PerfSONARException {
super();
}
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/DataSourceComponent.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/DataSourceComponent.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/DataSourceComponent.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -3,9 +3,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.perfsonar.base2.service.configuration.Component;
import org.perfsonar.base2.service.exceptions.PerfSONARException;
@@ -19,8 +16,6 @@
*/
public class DataSourceComponent extends Component {
- protected Logger logger = LoggerFactory.getLogger(getClass());
-
private String username;
private String password;
private String usernameRO;
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/ModificationCounterComponent.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/ModificationCounterComponent.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/ModificationCounterComponent.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -2,9 +2,6 @@
import java.util.concurrent.atomic.AtomicInteger;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.perfsonar.base2.service.configuration.Component;
import org.perfsonar.base2.service.exceptions.PerfSONARException;
@@ -21,8 +18,6 @@
// nr of changes since last GLS registration
private AtomicInteger diffsBetweenRegistrationCounter = new
AtomicInteger();
- protected Logger logger = LoggerFactory.getLogger(getClass());
-
@Override
public void destroy() throws PerfSONARException {
//do nothing
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/XMLDBComponent.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/XMLDBComponent.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/XMLDBComponent.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -8,9 +8,6 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.transform.OutputKeys;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.exist.xmldb.DatabaseInstanceManager;
import org.exist.xmldb.LocalXPathQueryService;
@@ -41,7 +38,6 @@
*/
public class XMLDBComponent extends Component {
- protected Logger logger = LoggerFactory.getLogger(getClass());
private String url;
private String mainCollection;
private String username;
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/schedulerActions/CleanupSchedulerAction.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/schedulerActions/CleanupSchedulerAction.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/schedulerActions/CleanupSchedulerAction.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -1,8 +1,5 @@
package org.perfsonar.service.lookupservice.schedulerActions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.perfsonar.base2.service.configuration.Action;
import org.perfsonar.base2.service.configuration.ConfigurationManager;
import org.perfsonar.base2.service.configuration.Option;
@@ -23,8 +20,6 @@
*/
public class CleanupSchedulerAction extends Action implements
SchedulerAction {
- protected Logger logger = LoggerFactory.getLogger(getClass());
-
private boolean isInitialized = false;
private LookupServiceDAO dao;
/**
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/schedulerActions/GLSRegistrationAction.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/schedulerActions/GLSRegistrationAction.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/schedulerActions/GLSRegistrationAction.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -5,9 +5,6 @@
import java.util.LinkedList;
import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.perfsonar.base2.service.configuration.ConfigurationManager;
import org.perfsonar.base2.service.configuration.Option;
import org.perfsonar.base2.service.exceptions.PerfSONARException;
@@ -29,8 +26,6 @@
*/
public class GLSRegistrationAction extends AbstractRegistrationAction {
- protected Logger logger = LoggerFactory.getLogger(getClass());
-
private ModificationCounterComponent modificationCounterComponent;
public static final String NR_OF_GLS_REGISTRATION_PARAM =
"nrOfGLSRegistration";
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/LookupServiceDAOFactory.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/LookupServiceDAOFactory.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/LookupServiceDAOFactory.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -14,7 +14,7 @@
*/
public final class LookupServiceDAOFactory {
- protected static Logger logger =
LoggerFactory.getLogger(LookupServiceDAOFactory.class);
+ private static final Logger LOGGER =
LoggerFactory.getLogger(LookupServiceDAOFactory.class);
private static volatile LookupServiceDAO dao = null;
private static volatile LookupServiceDAO daoRO = null;
@@ -36,7 +36,7 @@
.getConfiguration().getAuxiliaryComponent(LS_DAO);
return dao;
} catch (Exception ex) {
- logger.error(ex.getMessage());
+ LOGGER.error(ex.getMessage());
throw new PerfSONARException("no_ls_dao",
"Cannot find 'lsdao' component");
}
@@ -53,7 +53,7 @@
daoRO = (LookupServiceDAO) comp;
return daoRO;
} catch (Exception ex) {
- logger.error(ex.getMessage());
+ LOGGER.error(ex.getMessage());
throw new PerfSONARException("no_ls_ro_dao",
"Cannot find 'lsdao-ro' component");
}
@@ -71,7 +71,7 @@
.getConfiguration().getAuxiliaryComponent(SUMMARIZATION_DAO);
return summariaztionDAO;
} catch (Exception ex) {
- logger.error(ex.getMessage());
+ LOGGER.error(ex.getMessage());
throw new PerfSONARException("no_summarization_dao",
"Cannot find 'summarizationdao' component");
}
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryDAOSupportImpl.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryDAOSupportImpl.java
2013-05-13 09:33:12 UTC (rev 6377)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryDAOSupportImpl.java
2013-05-13 19:34:02 UTC (rev 6378)
@@ -1,8 +1,5 @@
package org.perfsonar.service.lookupservice.storage.exist;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.perfsonar.base2.service.configuration.Component;
import org.perfsonar.base2.service.configuration.ConfigurationManager;
import org.perfsonar.base2.service.configuration.Option;
@@ -20,7 +17,6 @@
*/
public abstract class XQueryDAOSupportImpl extends Component implements
XQueryDAOSupport {
- protected Logger logger = LoggerFactory.getLogger(getClass());
protected static final String UPDATE_FOR = " for $i in ";
protected static final String UPDATE_REMOVE = " return (update delete
$i, 'removed')";
protected static final String UPDATE_INSERT = " update insert ";
- [pS-dev] [GEANT/SA2/ps-java-services] r6378 - in trunk: . perfsonar-base/apt perfsonar-base/apt/src/ test perfsonar-base/apt/src/test/resources perfsonar-base/ base perfsonar-base/base/src/main/java/net/geant/perfsonar perfsonar-base/base/src/main/java/net/geant/perfsonar/res ponse perfsonar-base/base/src/main/java/net/geant/perfsona r/selftest perfsonar-base/base/src/test/java/net/geant/per fsonar perfsonar-base/base/src/test/java/net/geant/perfson ar/configuration perfsonar-base/base/src/test/java/net/gea nt/perfsonar/helpers perfsonar-base/base/src/test/resource s perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls p erfsonar-base/ls/src/test/resources perfsonar-base/messagi ng perfsonar-base/messaging/src/main/java/net/geant/perfso nar/messaging perfsonar-base/messaging/src/main/java/net/g eant/perfsonar/templates perfsonar-base/messaging/src/test perfsonar-base/messaging/src/test/java/net/geant/perfsona r/messaging perfsonar-base/messaging/src/test/java/net/gea nt/perfsonar/templat es perfsonar-base/messaging/src/test/ resources perfsonar-base/messaging-test-data perfsonar-bas e/sample-service perfsonar-base/sample-service/src/test/ja va/net/geant/perfsonar/mp/sshtelnet perfsonar-java-base2/s rc/main/java/org/perfsonar/base2/service/authn/component/w ssec perfsonar-java-base2/src/main/java/org/perfsonar/base 2/service/configuration perfsonar-java-base2/src/main/java /org/perfsonar/base2/service/messages perfsonar-java-base2 /src/main/java/org/perfsonar/base2/service/registration pe rfsonar-java-base2/src/main/java/org/perfsonar/base2/servi ce/requesthandler perfsonar-java-base2/src/main/java/org/p erfsonar/base2/service/scheduler perfsonar-java-base2/src/ main/java/org/perfsonar/base2/service/storage/xml perfsona r-java-rrd-ma-SQL_backend/doc perfsonar-java-rrd-ma-SQL _backend/src/deb/control perfsonar-java-rrd-ma-SQL_bac kend/src/main/java/org/perfsonar/service/measurementArchiv e/rrdType perfsonar-java-rrd-ma-SQL_backend/src/main/jav a/org/perfsonar/service/measureme ntArchive/rrdType/storag e/rrd perfsonar-java-rrd-ma-SQL_backend/src/main/java/or g/perfsonar/service/measurementArchive/rrdType/storage/sql perfsonar-java-rrd-ma-SQL_backend/src/rpm perfsonar-jav a-web-admin/perfsonar-java-web-admin-component/src/main/ja va/org/perfsonar/webadmin/config perfsonar-java-web-admin/ perfsonar-java-web-admin-component/src/main/java/org/perfs onar/webadmin/servlet/util perfsonar-java-web-admin/perfso nar-java-web-admin-component/src/main/java/org/perfsonar/w ebadmin/test perfsonar-java-xml-ls perfsonar-java-xml-ls/s rc/main/java/org/perfsonar/service/lookupservice perfsonar -java-xml-ls/src/main/java/org/perfsonar/service/lookupser vice/components perfsonar-java-xml-ls/src/main/java/org/pe rfsonar/service/lookupservice/schedulerActions perfsonar-j ava-xml-ls/src/main/java/org/perfsonar/service/lookupservi ce/storage perfsonar-java-xml-ls/src/main/java/org/perfson ar/service/lookupservice/storage/exist, svn-noreply, 05/13/2013
Archive powered by MHonArc 2.6.16.