Mundorévès

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

News from Oct 30, 2009

  2009/10/30
Migrating Confluence Plugins to 3.1
Last changed: Dec 15, 2009 09:41 by Roberto Dominguez
Labels: confluence, roller-coaster

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;
Posted at 30 Oct @ 6:41 AM by Roberto Dominguez | 2 Comments

October 2009  
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
             

Apr 17, 2009