felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Müller (JIRA) <j...@apache.org>
Subject [jira] Commented: (FELIX-2280) To much code duplication in DefaultJDBCLock, OracleJDBCLock and MySQLJDBCLock
Date Thu, 29 Apr 2010 17:47:54 GMT

    [ https://issues.apache.org/jira/browse/FELIX-2280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862283#action_12862283

Christian Müller commented on FELIX-2280:

Hey Jamie,

good to hear from you. :o)
You can skip my first patch, because in the mean time I have done some development. i wrote
a lot of integration test (against a real database) to discover the actual behavior. After
that, I wrote the same tests a unit tests using EasyMock. Than I updated the unit and integration
tests to a behavior, what I would expect. At present, I update the three  implementations
to succeed the tests.
At the end, I plan to provide two patches. One contains the modified code and the unit tests
(using EasyMock). The second patch will include the Integration tests (annotated with @Ignore)
which could be useful to test the implementation against a real database with less expenditure.

I was wondering, that the current implementation of MySQLJDBCLock fails in a simple integration
test (using the mysql-connector-java 5.1.12 and mysql server 5.1.44):

public class MySQLJDBCLockIntegrationTest {
    private MySQLJDBCLock lock1, lock2;
    private Properties props1;
    public void setUp() {
        BootstrapLogManager.setProperties(new Properties());
        props1 = new Properties();
        props1.put("karaf.lock.jdbc.url", "jdbc:mysql://");
        props1.put("karaf.lock.jdbc.driver", "com.mysql.jdbc.Driver");
        props1.put("karaf.lock.jdbc.user", "root");
        props1.put("karaf.lock.jdbc.password", "");
        props1.put("karaf.lock.jdbc.table", "LOCK_TABLE_1");
        props1.put("karaf.lock.jdbc.clustername", "karaf");
        props1.put("karaf.lock.jdbc.timeout", "5");

    public void lockOnSameCluster() throws Exception {
        lock1 = new MySQLJDBCLock(props1);
        lock2 = new MySQLJDBCLock(props1);
        boolean lock1Aquired = lock1.lock();
        boolean lock2Aquired = lock2.lock();
        lock2Aquired = lock2.lock();


> To much code duplication in DefaultJDBCLock, OracleJDBCLock and MySQLJDBCLock
> -----------------------------------------------------------------------------
>                 Key: FELIX-2280
>                 URL: https://issues.apache.org/jira/browse/FELIX-2280
>             Project: Felix
>          Issue Type: Improvement
>          Components: Karaf
>    Affects Versions: karaf-1.4.0
>         Environment: All
>            Reporter: Christian Müller
>         Attachments: FELIX-2280.patch
> org.apache.felix.karaf.main.DefaultJDBCLock, org.apache.felix.karaf.main.MySQLJDBCLock
and org.apache.felix.karaf.main.OracleJDBCLock has to much code duplications. I propose a
solution like in ActiveMQ [package org.apache.activemq.store.jdbc.adapter|http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/].
> And we should implement some unit tests for it.
> If it's fine for you, I will try to improve this part of karaf and provide a patch for

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message