Viewing Issue Advanced Details

ID 0003943 Category [DMDirc] *Unsorted Severity minor
Reproducibility always Date Submitted 2010-03-14 17:51 Last Update 2010-03-15 02:03
Reporter MD87 Assigned To MD87 View Status public
Priority normal Status resolved Resolution fixed
Platform Fixed in Version Target Version 0.6.4
Product Version Product Build
Summary 0003943: Action packs should allow git versions
Description
Action packs should allow git versions
Needs unit test no
Upstream Bug URL

Relationships

Notes

A patchset (1) related to this change has been added to gerrit by Chris Smith

Support for new action versioning

Issue 3943

Change-Id: I9f769f243178022528da65fe4c15abbd62d9e49c
Depends-On: I1419fa74d8da7f3f5d96a00dea559329db008b0e

A patchset (1) related to this change has been added to gerrit by Chris Smith

Action packs can have non-numeric versions

Fixes issue 3943

Depends-On: I9f769f243178022528da65fe4c15abbd62d9e49c
Change-Id: I1419fa74d8da7f3f5d96a00dea559329db008b0e

A patchset (2) related to this change has been added to gerrit by Chris Smith

Action packs can have non-numeric versions

Fixes issue 3943

Depends-On: I9f769f243178022528da65fe4c15abbd62d9e49c
Change-Id: I1419fa74d8da7f3f5d96a00dea559329db008b0e
authorChris Smith <chris@dmdirc.com>2010-03-15 01:30:19 (GMT)
committer Shane Mc Cormack <shane@dmdirc.com>2010-03-15 01:45:32 (GMT)
commit64451f94399a46bc78331ca77ddbf545907ebc06 (patch) (side-by-side diff)
Support for new action versioning
Issue 3943 Change-Id: I9f769f243178022528da65fe4c15abbd62d9e49c Depends-On: I1419fa74d8da7f3f5d96a00dea559329db008b0e Reviewed-on: http://gerrit.dmdirc.com/1046 Reviewed-by: Shane Mc Cormack <shane@dmdirc.com> Automatic-Compile: Shane Mc Cormack <shane@dmdirc.com>
-rw-r--r--src/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionGroupInformationPanel.java6
-rw-r--r--test/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionGroupInformationPanelTest.java7
2 files changed, 7 insertions, 6 deletions
Click to Expand/Collapse
diff src/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionGroupInformationPanel.java
@@ -112,12 +112,12 @@ public final class ActionGroupInformationPanel extends JPanel {
if (shouldDisplay()) {
infoLabel.setText(group.getDescription());
author.setText(group.getAuthor());
- version.setText(Integer.toString(group.getVersion()));
+ version.setText(group.getVersion() == null ? "" : group.getVersion().toString());
author.setVisible(group.getAuthor() != null);
- version.setVisible(group.getVersion() != -1);
+ version.setVisible(group.getVersion() != null);
authorLabel.setVisible(group.getAuthor() != null);
- versionLabel.setVisible(group.getVersion() != -1);
+ versionLabel.setVisible(group.getVersion() != null);
} else {
infoLabel.setText("");
author.setText("");
Click to Expand/Collapse
diff test/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionGroupInformationPanelTest.java
@@ -23,6 +23,7 @@
package com.dmdirc.addons.ui_swing.dialogs.actionsmanager;
import com.dmdirc.actions.ActionGroup;
+import com.dmdirc.updater.Version;
import org.junit.Test;
import org.uispec4j.Panel;
import org.uispec4j.UISpecTestCase;
@@ -53,7 +54,7 @@ public class ActionGroupInformationPanelTest extends UISpecTestCase {
public void testAllLabels() {
final ActionGroup group = mock(ActionGroup.class);
when(group.getDescription()).thenReturn("description");
- when(group.getVersion()).thenReturn(17);
+ when(group.getVersion()).thenReturn(new Version(17));
when(group.getAuthor()).thenReturn("foo <bar@baz>");
final Panel panel = new Panel(new ActionGroupInformationPanel(group));
@@ -71,7 +72,7 @@ public class ActionGroupInformationPanelTest extends UISpecTestCase {
public void testNoAuthor() {
final ActionGroup group = mock(ActionGroup.class);
when(group.getDescription()).thenReturn("description");
- when(group.getVersion()).thenReturn(17);
+ when(group.getVersion()).thenReturn(new Version(17));
final Panel panel = new Panel(new ActionGroupInformationPanel(group));
@@ -86,7 +87,7 @@ public class ActionGroupInformationPanelTest extends UISpecTestCase {
public void testNoVersion() {
final ActionGroup group = mock(ActionGroup.class);
when(group.getDescription()).thenReturn("description");
- when(group.getVersion()).thenReturn(-1);
+ when(group.getVersion()).thenReturn(null);
when(group.getAuthor()).thenReturn("foo <bar@baz>");
final Panel panel = new Panel(new ActionGroupInformationPanel(group));
authorChris Smith <chris@dmdirc.com>2010-03-15 01:29:48 (GMT)
committer Shane Mc Cormack <shane@dmdirc.com>2010-03-15 02:02:20 (GMT)
commit06dc20795ba44d625cfc5036865d9111f447fc43 (patch) (side-by-side diff)
Action packs can have non-numeric versions
Fixes issue 3943 Depends-On: I9f769f243178022528da65fe4c15abbd62d9e49c Change-Id: I1419fa74d8da7f3f5d96a00dea559329db008b0e Reviewed-on: http://gerrit.dmdirc.com/1047 Reviewed-by: Shane Mc Cormack <shane@dmdirc.com> Automatic-Compile: Shane Mc Cormack <shane@dmdirc.com>
-rw-r--r--src/com/dmdirc/actions/Action.java7
-rw-r--r--src/com/dmdirc/actions/ActionGroup.java17
-rw-r--r--src/com/dmdirc/updater/components/ActionGroupComponent.java4
-rw-r--r--test/com/dmdirc/actions/ActionGroupTest.java11
4 files changed, 18 insertions, 21 deletions
Click to Expand/Collapse
diff src/com/dmdirc/actions/Action.java
@@ -31,6 +31,7 @@ import com.dmdirc.config.prefs.PreferencesType;
import com.dmdirc.interfaces.ConfigChangeListener;
import com.dmdirc.logger.ErrorLevel;
import com.dmdirc.logger.Logger;
+import com.dmdirc.updater.Version;
import com.dmdirc.util.ConfigFile;
import com.dmdirc.util.InvalidConfigFileException;
@@ -238,11 +239,7 @@ public class Action extends ActionModel implements ConfigChangeListener {
}
if (data.containsKey("version")) {
- try {
- myGroup.setVersion(Integer.parseInt(data.get("version")));
- } catch (NumberFormatException ex) {
- // Do nothing
- }
+ myGroup.setVersion(new Version(data.get("version")));
}
if (data.containsKey("component")) {
Click to Expand/Collapse
diff src/com/dmdirc/actions/ActionGroup.java
@@ -25,6 +25,7 @@ package com.dmdirc.actions;
import com.dmdirc.Precondition;
import com.dmdirc.config.prefs.PreferencesSetting;
import com.dmdirc.logger.Logger;
+import com.dmdirc.updater.Version;
import java.util.ArrayList;
import java.util.HashMap;
@@ -61,8 +62,8 @@ public class ActionGroup implements Iterable<Action> {
/** The component number of this action group (for updating). */
private int component = -1;
- /** The version number of this action group. */
- private int version = -1;
+ /** The version of this action group. */
+ private Version version = null;
/** A list of settings used by this action group. */
private final Map<String, PreferencesSetting> settings
@@ -136,18 +137,20 @@ public class ActionGroup implements Iterable<Action> {
/**
* Retrieves the version number of this action group.
*
- * @return This action group's version number, or -1 if none is specified.
+ * @return This action group's version number, or null if none is specified.
+ * @since 0.6.4
*/
- public int getVersion() {
+ public Version getVersion() {
return version;
}
/**
* Sets the version of this action group.
*
- * @param version This action group's new version number.
+ * @param version This action group's new version.
+ * @since 0.6.4
*/
- public void setVersion(final int version) {
+ public void setVersion(final Version version) {
this.version = version;
}
@@ -225,8 +228,8 @@ public class ActionGroup implements Iterable<Action> {
settings.clear();
description = null;
author = null;
+ version = null;
component = -1;
- version = -1;
}
/**
Click to Expand/Collapse
diff src/com/dmdirc/updater/components/ActionGroupComponent.java
@@ -46,7 +46,7 @@ public class ActionGroupComponent implements UpdateComponent {
public ActionGroupComponent(final ActionGroup group) {
this.group = group;
- if (group.getComponent() != -1 && group.getVersion() != -1) {
+ if (group.getComponent() != -1 && group.getVersion() != null) {
UpdateChecker.removeComponent(getName());
UpdateChecker.registerComponent(this);
}
@@ -67,7 +67,7 @@ public class ActionGroupComponent implements UpdateComponent {
/** {@inheritDoc} */
@Override
public Version getVersion() {
- return new Version(group.getVersion());
+ return group.getVersion();
}
/** {@inheritDoc} */
Click to Expand/Collapse
diff test/com/dmdirc/actions/ActionGroupTest.java
@@ -22,10 +22,7 @@
package com.dmdirc.actions;
import com.dmdirc.config.prefs.PreferencesSetting;
-import com.dmdirc.config.prefs.PreferencesType;
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Ignore;
+import com.dmdirc.updater.Version;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
@@ -74,10 +71,10 @@ public class ActionGroupTest {
@Test
public void testGetVersion() {
ActionGroup instance = new ActionGroup("vtest");
- instance.setVersion(73);
+ instance.setVersion(new Version(73));
- int expResult = 73;
- int result = instance.getVersion();
+ Version expResult = new Version(73);
+ Version result = instance.getVersion();
assertEquals(expResult, result);
}

Issue History

Date Modified Username Field Change
2010-03-14 17:51 MD87 New Issue
2010-03-14 17:51 MD87 Status new => assigned
2010-03-14 17:51 MD87 Assigned To => MD87
2010-03-15 01:32 MD87 Checkin
2010-03-15 01:32 MD87 Note Added: 0010409
2010-03-15 01:32 MD87 Checkin
2010-03-15 01:32 MD87 Note Added: 0010410
2010-03-15 01:32 MD87 Status assigned => fix pending
2010-03-15 01:34 MD87 Checkin
2010-03-15 01:34 MD87 Note Added: 0010411
2010-03-15 01:46 MD87 Checkin
2010-03-15 01:46 MD87 Note Added: 0010412
2010-03-15 02:03 MD87 Checkin
2010-03-15 02:03 MD87 Note Added: 0010417
2010-03-15 02:03 MD87 Status fix pending => resolved
2010-03-15 02:03 MD87 Resolution open => fixed