Mundorévès

Cada día me veo en un mundo al revés

Migrating Confluence Plugins to 3.1

Time to resume my journey to Confluence Plugin Nirvana this time to get the Approvals Workflow Plugin and Ad hoc Workflows to support 3.1 but still supporting earlier version of confluence with the same binaries.

Note that I am still on plugins v1, moving to v2 is a major endeavor.

TaskQueueFlushJob

UPDATE: looks like they have restored getQueueName()... however, I am still not sure about the long term solution

Seems they're trying to move everything to dependency injection. Before the key name was set through and abstract method setQueueName.

So, in my Job constructor I added:

initQueueName();

Then I created initQueueName():

private void initQueueName() {
    try {
        Method setter = getClass().getMethod("setQueueName",String.class);
        setter.invoke(this,this.getQueueName());
    } catch (NoSuchMethodException ignored) {
    } catch (Exception e) {
        log.error("",e);
    }
}

See http://jira.atlassian.com/browse/CONF-17413

Logout text changes causing Integration Unit Tests to fail.

A minor UI changes causes Integration Unit Tests to fail: AbstractConfluencePluginWebTestCase.logout() checks for a text in the response which has been changed causing the tests to fails.

All I had to do is override the logout method:

@Override
protected void logout() {
    gotoPage("/logout.action");
}

I am using an old version of the test framework (1.4.3-beta3), so my guess is that there is no issue on the latest version.

UI/Javascript Changes

Html changes affects Integration tests

I was checking for "error" in HTML responses... Problem now is that they are setting a lot of error messages in the HTML code (as of 3.1-beta2). So I had to comment the assertion out.

//        assertTextNotInElement("content","error");

Not a big deal, as it was just a safety net.

Removal of GeneralUtil.format(Date)

GeneralUtil.format(Date) has been deprecated for long time ago, so having removed it is not an issue... however, they didn't clean and left GeneralUtil.format(Object):

public static String format(Object obj) {
   try {
       if (obj instanceof Number) {
           return format((Number) obj);
       } else if (obj instanceof Date) {
           return format((Date) obj);
       } else if (obj instanceof String) {
           return format((String) obj);
       } else {
           return obj.toString();
       }
   } catch (Exception e) {
       return "";
   }
}

Which of course causes a stack overflow. As per the deprecated note, you should use $dateFormatter.format(Date) instead.

jQuery ui.core, ui.draggable and ui.sortable now included by default

I am using JQuery's Draggable and Sortable in Ad hoc Workflows, but now those libraries are now included by default in Confluence 3.1

AFIK, there is no way of conditioning web resources to versions of confluence (which would be a great thing), so the conditioning has to be done manually.
In atlassian-plugin.xml:

<web-resource key="jquerydraggable" name="jQuery Draggable Resources">
    <resource name="ui.core.js" type="download" location="templates/com/comalatech/workflow/designer/javascript/ui.core.js"/>
    <resource name="ui.draggable.js" type="download" location="templates/com/comalatech/workflow/designer/javascript/ui.draggable.js"/>
    <resource name="ui.sortable.js" type="download" location="templates/com/comalatech/workflow/designer/javascript/ui.sortable.js"/>
    <dependency>confluence.web.resources:ajs</dependency>
</web-resource>

In the velocity template:

#if ($includeDraggable)
    #requireResource("com.comalatech.workflow:jquerydraggable")
#end

The flag is set based on the confluence version:

includeDraggable = Integer.parseInt(GeneralUtil.getBuildNumber()) < 1711;

Labels

 
  1. Dec 15, 2009

    Anonymous says:

    Nice post Roberto. As for the integration tests, I believe you need to use vers...

    Nice post Roberto.

    As for the integration tests, I believe you need to use version 2.2-beta1 of the func-test library:

    <dependency>
                <groupId>com.atlassian.confluence.plugin</groupId>
                <artifactId>func-test</artifactId>
                <version>2.2-beta1</version>
                <scope>test</scope>
            </dependency>

    There may be other issues and dependencies that you need though once you add that dependency.

    Cheers,
    Keith

    1. Dec 15, 2009

      Roberto Dominguez says:

      Thanx! It's on my todo list ;) Version 2.x of the functional testing is not b...

      Thanx!

      It's on my to-do list

      Version 2.x of the functional testing is not backwards compatible with 1.4.3, so I have to spend some time on it.

      Roberto

Add Comment