Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "OFMP/Release 1.0.0M1"

(Installation)
(Test infrastructure)
Line 81: Line 81:
 
When running tests from Eclipse you need to set 2 JVM parameters so that Spring DM Test frameyork locate bundles properly:
 
When running tests from Eclipse you need to set 2 JVM parameters so that Spring DM Test frameyork locate bundles properly:
  
  -Declipse.target.area1=D:\project\Victoria_OSGi\org.eclipse.ofmp.server\target\eclipse_plugins
+
  -Declipse.target.area1=C:\OFMP\org.eclipse.ofmp.server\target\eclipse_plugins
  -Declipse.target.area2=D:\project\Victoria_OSGi\org.eclipse.ofmp.server\target\maven_plugins
+
  -Declipse.target.area2=C:\OFMP\org.eclipse.ofmp.server\target\maven_plugins
  
 
See \org.eclipse.ofmp.security.integrationtests\launch
 
See \org.eclipse.ofmp.security.integrationtests\launch

Revision as of 19:29, 4 November 2008

Requirements

  1. Oracle XE 10.2 with system/system credentials
  2. JDK 1.5 (not JRE as Maven requires a JDK)
  3. Eclipse 3.4
  4. Maven 2.0.9
  5. m2eclipse 0.9.6
  6. Spring IDE

SCM access

:extssh:<username>@cvs.covariance.org:57022/cvsroot/ofmp.osgi

Installation

  • Ckeckout org.eclipse.ofmp.server
  • The database schema is located in the org.eclipse.ofmp.service project, sql folder. Run the build_database.xml as ant file.
  • Install the Spring OSGi bundle archetype:
mvn install:install-file -DgroupId=org.springframework.osgi -DartifactId=spring-osgi-bundle-archetype -Dversion= -Dpackaging=jar -Dfile=/path/to/org.eclipse.ofmp.server/lib/spring-osgi-bundle-archetype-1.1.2.jar
  • Ckeckout com.oracle.ojdbc Right-click on pom.xml -> Run as -> Maven install
  • Ckeckout org.apache.geronimo.transaction Right-click on pom.xml -> Run as -> Maven install
  • Ckeckout org.eclipse.ofmp.lib.jencks Right-click on pom.xml -> Run as -> Maven install (you might need to close com.oracle.ojdbc bundle to make it compile)

These 2 dependencies will be installed in the OFMP Maven repository in the future.

  • Run "mvn install" on org.eclipse.ofmp.server/target/pom.xml
  • Set Eclipse target to org.eclipse.ofmp.server/target/org.eclipse.ofmp.server.target
  • Ckeckout the following projects
    • org.eclipse.ofmp.common Right-click on pom.xml -> Run as -> Maven install
    • org.eclipse.ofmp.log Right-click on pom.xml -> Run as -> Maven install
    • com.gargoylesoftware.gsbase Right-click on pom.xml -> Run as -> Maven install + close the project (for classpath reasons)
    • org.eclipse.ofmp.datasource.oracle Right-click on pom.xml -> Run as -> Maven install
    • org.eclipse.ofmp.test Right-click on pom.xml -> Run as -> Maven install
    • org.eclipse.ofmp.security Right-click on pom.xml -> Run as -> Maven install
    • org.eclipse.ofmp.transaction Right-click on pom.xml -> Run as -> Maven install
    • org.eclipse.ofmp.currency Right-click on pom.xml -> Run as -> Maven install
    • org.eclipse.ofmp.test.integrationtests Right click on launch/SimpleSpringDMTest.launch -> Run as SimpleSpringDMTest

OFMP bundles creation

For every service to be extracted from the org.eclipse.ofmp.service.core project we have to:

  • extract bundle (scr and src.tests) from the core, mavenize and OSGify it
  • create an integration test project based on Spring DM test framework and run integration tests on it.

Procedure

  • open shell cmd line in workspace folder
  • Create the project using Spring DM Maven artifact:
mvn archetype:create -DarchetypeGroupId=org.springframework.osgi -DarchetypeArtifactId=spring-osgi-bundle-archetype -DarchetypeVersion= -DgroupId=org.eclipse.ofmp -DartifactId=org.eclipse.ofmp.<project name> -Dversion=1.0.0
mvn org.apache.felix:maven-bundle-plugin:manifest
  • Create an integrationtests bundle if required
  • Import project(s) within Eclipse workspace
  • Enable Maven Dependency Management and remove Plugin dependencies from the project Java Build Path libraries
  • Setup pom.xml (org.eclipse.ofmp.security/pom.xml is a good example)
  • Move packages from lu.kaupthing.fm.server to org.eclipse.ofmp (dont use "service" prefix for bundles)
  • Use Bnd to automate generation of Manifest.MF OSGi tags:
    • replace Require-Bundle by Import-Packages as much as possible
    • ensure proper bundles versioning AND dependencies versioning e.g.: Import-Package: osgitut.movies;version="[1.0.0,2.0.0)"
    • Hide Implementation Details: ONLY export public API packages in Manifest

Put implementation details in separate packages from the public API

org.example.foo - exported API package
org.example.foo.internal - private implementation package
  • Remove any specific wordings (victoria/apsys) in source code
  • Enable project Spring nature if required and enlist Spring files in project properties

Naming conventions

  1. every service bundle does not hold the ".service." acronym in its bundle name
  2. every lib bundle(like Jencks) should contain the ".lib." acronym in its bundle name


Test infrastructure

OFMP Test infrastructure is built on Spring DM Test framework

Have a look at

  • org.eclipse.ofmp.test/src/main/java/org/eclipse/ofmp/test/AbstractOFMPDBUnitTest
  • org.eclipse.ofmp.test/src/main/java/org/eclipse/ofmp/test/AbstractOFMSpringDMTest

The org.eclipse.ofmp.test bundle expose the service required to cleanup/initialize the database before any tests.

Tests are run automatically by maven when you install a bundle.

When running tests from Eclipse you need to set 2 JVM parameters so that Spring DM Test frameyork locate bundles properly:

-Declipse.target.area1=C:\OFMP\org.eclipse.ofmp.server\target\eclipse_plugins
-Declipse.target.area2=C:\OFMP\org.eclipse.ofmp.server\target\maven_plugins

See \org.eclipse.ofmp.security.integrationtests\launch

Open issues

Current issue

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#1': 
Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'currencyRateService': FactoryBean threw exception on object creation; 
nested exception is org.springframework.aop.framework.AopConfigException: 
Unknown advisor type class org.springframework.security.intercept.AbstractSecurityInterceptor$$EnhancerByCGLIB$$c7254c44; 
Can only include Advisor or Advice type beans in interceptorNames chain except for last entry,which may also be target or  TargetSource; 
nested exception is org.springframework.aop.framework.adapter.UnknownAdviceTypeException: 
Advice object [org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor@87ad67] 
is neither a supported subinterface of [org.aopalliance.aop.Advice] nor an [org.springframework.aop.Advisor]

TODO

Short term

  • Create our own OFMP Maven artifact to setup our Maven projects more easily
  • Create Maven modules to have a super POM parent managing common dependencies
  • Create POM base Maven project, based on the Target, to deploy all the bundles
  • Create OFMP Maven repository

Long term

  • Run FindBugs plugin on source code
  • Active checkStyle
  • Move event listeners/publishers to JMS/Camel
  • Ensure proper logging and logging levels
  • Ensure proper security on local and remote interface
  • Ensure proper transactional context of methods
  • Improve and generate Javadoc
  • Validate pre-conditions of public/protected methods using Apache Commons Lang Validate
  • Validate pre/post-conditions of private methods with java asserts
  • Use Eclipse API Tools
  • Run Code Coverage tests
  • Fix any TODO or FIXME
  • Return Quickly from Framework Callbacks: If you need to do something that takes some time then either use eventing or spin off a background thread to perform the long running work
  • Check source code copyrights
  • Check source code for copyrighted names (reuters, apsys, ebs, ...)
  • Use EasyMock for unit tests
  • Produce UMLGraph

References

Back to the top