Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/Vagrantfile7
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/files/services.cgi17
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp1
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/init.pp5
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp64
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb1
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/callchecksetup.pl.erb7
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/installPerlModules.sh.erb16
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/service.json.erb12
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java9
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java14
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java26
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java22
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java103
15 files changed, 218 insertions, 90 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
index e70216f65..bd024ae89 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
@@ -42,6 +42,10 @@ public class BugzillaVersion implements Comparable<BugzillaVersion>, Serializabl
public final static BugzillaVersion BUGZILLA_4_2 = new BugzillaVersion("4.2"); //$NON-NLS-1$
+ public final static BugzillaVersion BUGZILLA_4_4 = new BugzillaVersion("4.4"); //$NON-NLS-1$
+
+ public final static BugzillaVersion BUGZILLA_HEAD = new BugzillaVersion("4.5"); //$NON-NLS-1$
+
public final static BugzillaVersion MAX_VERSION = BUGZILLA_4_0;
private final int major;
diff --git a/org.eclipse.mylyn.bugzilla.releng/Vagrantfile b/org.eclipse.mylyn.bugzilla.releng/Vagrantfile
index b013b81cc..dc89cb225 100644
--- a/org.eclipse.mylyn.bugzilla.releng/Vagrantfile
+++ b/org.eclipse.mylyn.bugzilla.releng/Vagrantfile
@@ -1,9 +1,12 @@
Vagrant::Config.run do |config|
- config.vm.box = "precise32"
- config.vm.box_url = "http://files.vagrantup.com/precise32.box"
+ config.vm.box = "lucid32"
+ config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
+# config.vm.box = "precise32"
+# config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.forward_port 80, 2080
config.vm.forward_port 443, 2443
config.vm.provision :puppet, :module_path => "modules"
+# , :options => "--verbose --debug"
end \ No newline at end of file
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/files/services.cgi b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/files/services.cgi
new file mode 100644
index 000000000..85c28169f
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/files/services.cgi
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+echo content-type: application/json
+echo
+
+echo "["
+c=0
+for i in $(find /home/tools -name "service*.json")
+do
+ if [ $c != 0 ]
+ then
+ echo ","
+ fi
+ cat $i
+ c=c+1
+done
+echo "]" \ No newline at end of file
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp
index 9b286c0ba..900e7df93 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp
@@ -60,6 +60,7 @@ define bugzilla::defaultsites($base = $bugzilla::bugzillaBase, $userOwner = $bug
bugzilla::site { "bugs42":
major => "4",
minor => "2",
+ envdefault => "1"
}
bugzilla::site { "bugs44":
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/init.pp b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/init.pp
index 5f19793fd..bfaeb4bbf 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/init.pp
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/init.pp
@@ -116,4 +116,9 @@ class bugzilla {
require => Package[$requirements],
}
+ file { "/usr/lib/cgi-bin/services":
+ source => "puppet:///modules/bugzilla/services.cgi",
+ mode => 755,
+ require => Package[$requirements],
+ }
}
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp
index 6700ee2a9..af4b8552d 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp
@@ -27,6 +27,8 @@ define bugzilla::site (
$envid = "$title",
$userOwner = $bugzilla::userOwner,
$userGroup = $bugzilla::userGroup,
+ $envversion = "${major}.${minor}",
+ $envdefault = "0",
) {
include "bugzilla"
@@ -90,17 +92,6 @@ define bugzilla::site (
creates => "$base/$version",
require => Exec["prepare $version"]
}
-
- # we need a extras setup because for bughead we need
- # template 2.24 but libtemplate-perl from precise32 is only 2.22
- exec { "post extract bugzilla $version":
- command => "/usr/bin/perl install-module.pl Template >$base/$version/extra.out",
- cwd => "$base/$version",
- creates => "$base/$version/extra.out",
- user => "$userOwner",
- timeout => 300,
- require => Exec["extract bugzilla $version"]
- }
} else {
exec { "extract bugzilla $version":
command => "bzr co -r tag:$branchTag bzr://bzr.mozilla.org/bugzilla/$branchName $version",
@@ -110,19 +101,25 @@ define bugzilla::site (
creates => "$base/$version",
require => Exec["prepare $version"]
}
-
- # we need no extras setup because for bugzilla <= 4.4 all
- # perl libs have the correct version
- exec { "post extract bugzilla $version":
- command => "ls >$base/$version/extra.out",
- cwd => "$base/$version",
- creates => "$base/$version/extra.out",
- user => "$userOwner",
- timeout => 300,
- require => Exec["extract bugzilla $version"]
- }
+ }
+
+ file { "$base/$version/installPerlModules.sh":
+ content => template('bugzilla/installPerlModules.sh.erb'),
+ owner => "$userOwner",
+ group => "$userGroup",
+ mode => 0755,
+ require => Exec["extract bugzilla $version"],
}
+ exec { "post extract bugzilla $version":
+ command => "$base/$version/installPerlModules.sh >$base/$version/CGI.out",
+ cwd => "$base/$version",
+ creates => "$base/$version/CGI.out",
+ user => "$userOwner",
+ timeout => 300,
+ require => File["$base/$version/installPerlModules.sh"]
+ }
+
exec { "mysql-grant-${bugz_dbname}-${bugzilla::dbuser}":
unless =>
"/usr/bin/mysql --user=root --batch -e \"SELECT user FROM db WHERE Host='localhost' and Db='${bugz_dbname}' and User='${bugzilla::dbuser}'\" mysql | /bin/grep '${bugzilla::dbuser}'",
@@ -146,6 +143,14 @@ define bugzilla::site (
require => Exec["mysql-dropdb-$version"]
}
+ file { "$base/$version/callchecksetup.pl":
+ content => template('bugzilla/callchecksetup.pl.erb'),
+ owner => "$userOwner",
+ group => "$userGroup",
+ mode => 0755,
+ require => Exec["post extract bugzilla $version"],
+ }
+
file { "$base/$version/answers":
content => template('bugzilla/answers.erb'),
owner => "$userOwner",
@@ -173,26 +178,30 @@ define bugzilla::site (
}
exec { "init bugzilla_checksetup $version":
- command => "$base/$version/checksetup.pl $base/$version/answers -verbose",
+ command => "$base/$version/callchecksetup.pl",
cwd => "$base/$version",
creates => "$base/$version/localconfig",
user => "$userOwner",
+ logoutput => true,
require => [
Exec["mysql-createdb-$version"],
File["$base/$version/answers"],
+ File["$base/$version/callchecksetup.pl"],
File["$base/$version/extensions/Mylyn/Extension.pm"]]
}
exec { "update bugzilla_checksetup $version":
- command => "$base/$version/checksetup.pl $base/$version/answers -verbose",
+ command => "$base/$version/callchecksetup.pl",
cwd => "$base/$version",
user => "$userOwner",
-## logoutput => true,
+# logoutput => true,
require => [
Exec["mysql-createdb-$version"],
Exec["init bugzilla_checksetup $version"],
File["$base/$version/answers"],
- File["$base/$version/extensions/Mylyn/Extension.pm"]]
+ File["$base/$version/extensions/Mylyn/Extension.pm"],
+# File["$base/$version/localconfig"],
+ ]
}
if !$xmlrpc_enabled {
@@ -225,5 +234,4 @@ define bugzilla::site (
notify => Service["apache2"],
onlyif => "grep -qe '^Include $base/conf.d' /etc/apache2/conf.d/bugzilla.conf; test $? != 0"
}
-
-} \ No newline at end of file
+}
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb
index 7ed97ed01..2022724ca 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb
@@ -13,6 +13,7 @@ $answer{'ADMIN_REALNAME'} = 'Mylyn Admin';
$answer{'SMTP_SERVER'} = '';
$answer{'usetargetmilestone'} = '1';
$answer{'mail_delivery_method'} = 'None';
+
$answer{'insidergroup'} = 'bz_canusewhineatothers';
<% if @custom_wf_and_status %>$answer{'duplicate_or_move_bug_status'} = 'CLOSED';<% end %>
$answer{'NO_PAUSE'} = 1
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/callchecksetup.pl.erb b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/callchecksetup.pl.erb
new file mode 100644
index 000000000..2277e55b1
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/callchecksetup.pl.erb
@@ -0,0 +1,7 @@
+#!/bin/bash
+./checksetup.pl ./answers | grep "*** Installation aborted." > /dev/null 2>&1
+if [ $? -eq 0 ];then
+ exit 1
+else
+ exit 0
+fi
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/installPerlModules.sh.erb b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/installPerlModules.sh.erb
new file mode 100644
index 000000000..283b2865e
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/installPerlModules.sh.erb
@@ -0,0 +1,16 @@
+#!/bin/bash
+<% if @operatingsystemrelease == "10.04" %>
+/usr/bin/perl install-module.pl CGI
+/usr/bin/perl install-module.pl Template
+<% if @envversion > "3.6" %>
+/usr/bin/perl install-module.pl Email::MIME
+<% end %>
+<% if @envversion > "4.2" %>
+/usr/bin/perl install-module.pl List::MoreUtils
+<% end %>
+<% end %>
+<% if @operatingsystemrelease = "12.04" && @envversion > "4.4" %>
+/usr/bin/perl install-module.pl Template
+<% end %>
+echo "Ende1"
+
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/service.json.erb b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/service.json.erb
index 88c3301b2..a7806f167 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/service.json.erb
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/service.json.erb
@@ -1,6 +1,12 @@
{
"type": "<%= envtype %>",
-"url": "/<%= envid %>/",
-"version": "<%= version %>",
-"info": "<%= envinfo %>"
+"url": "/<%= envid %>",
+"version": "<%= envversion %>",
+"info": "<%= envinfo %>" ,
+ "properties":{
+ "custom_wf": "<%= custom_wf %>",
+ "custom_wf_and_status": "<%= custom_wf_and_status %>",
+ "xmlrpc_enabled": "<%= xmlrpc_enabled %>",
+ "default": "<%= envdefault %>"
+ }
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java
index 465e9879e..7fad7a747 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java
@@ -24,6 +24,7 @@ import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaTaskEditorTest;
import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaTaskHyperlinkDetectorTest;
import org.eclipse.mylyn.commons.sdk.util.ManagedTestSuite;
import org.eclipse.mylyn.commons.sdk.util.TestConfiguration;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;
/**
* @author Mik Kersten
@@ -81,13 +82,9 @@ public class AllBugzillaTests {
fixture.add(BugzillaRepositoryConnectorTest.class);
fixture.add(BugzillaAttachmentHandlerTest.class);
- // Move any tests here that are resulting in spurious failures
- // due to recent changes in Bugzilla Server head.
- if (fixture != BugzillaFixture.BUGS_HEAD) {
- }
-
// Only run this if we have custom status and Workflow
- if (fixture.equals(BugzillaFixture.BUGS_3_6_CUSTOM_WF_AND_STATUS)) {
+ if (BugzillaVersion.BUGZILLA_3_6.compareTo(fixture.getBugzillaVersion()) == 0
+ && BugzillaFixture.CUSTOM_WF_AND_STATUS.equals(fixture.getDescription())) {
fixture.add(BugzillaCustomRepositoryTest.class);
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
index 14c67cc52..bb5a88b3d 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
@@ -348,8 +348,12 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
//
public void testStdWorkflow() throws Exception {
if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
- if (BugzillaFixture.current() != BugzillaFixture.BUGS_3_6_CUSTOM_WF
- && BugzillaFixture.current() != BugzillaFixture.BUGS_3_6_CUSTOM_WF_AND_STATUS) {
+ if (!(BugzillaVersion.BUGZILLA_3_6.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0 && BugzillaFixture.CUSTOM_WF.equals(BugzillaFixture.current()
+ .getDescription()))
+ && !(BugzillaVersion.BUGZILLA_3_6.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0 && BugzillaFixture.CUSTOM_WF_AND_STATUS.equals(BugzillaFixture.current()
+ .getDescription()))
+
+ ) {
doStdWorkflow32("3");
}
} else {
@@ -1113,7 +1117,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
public void testSynchChangedReports() throws Exception {
TaskData data = BugzillaFixture.current().createTask(PrivilegeLevel.USER, null, null);
- if (BugzillaFixture.current().equals(BugzillaFixture.BUGS_HEAD)
+ if (BugzillaVersion.BUGZILLA_HEAD.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0
&& BugzillaFixture.current().getRepositoryUrl().contains("mylyn.eclipse.org")) {
//FIXME: for some actual unknown reason
// connector.preSynchronization(event, null);
@@ -1607,7 +1611,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
}
};
- if (BugzillaFixture.current().equals(BugzillaFixture.BUGS_3_4)) {
+ if (BugzillaVersion.BUGZILLA_3_4.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0) {
return;
}
final TaskData[] taskDataNew = new TaskData[1];
@@ -1692,7 +1696,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
}
};
- if (BugzillaFixture.current().equals(BugzillaFixture.BUGS_3_4)) {
+ if (BugzillaVersion.BUGZILLA_3_4.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0) {
return;
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java
index 98574cc39..1f45acd79 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java
@@ -62,13 +62,19 @@ public class BugzillaClientTest extends TestCase {
}
public void testRDFProductConfig() throws Exception {
+ if (BugzillaVersion.BUGZILLA_4_4.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0
+ || BugzillaVersion.BUGZILLA_HEAD.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0) {
+ // FIXME: need fix of bug#372600
+ return;
+ }
RepositoryConfiguration config = client.getRepositoryConfiguration();
assertNotNull(config);
assertEquals(
0,
config.getInstallVersion().compareMajorMinorOnly(
new BugzillaVersion(BugzillaFixture.current().getVersion())));
- if (BugzillaFixture.current() == BugzillaFixture.BUGS_3_6_CUSTOM_WF_AND_STATUS) {
+ if (BugzillaVersion.BUGZILLA_3_6.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0
+ && BugzillaFixture.CUSTOM_WF_AND_STATUS.equals(BugzillaFixture.current().getDescription())) {
assertEquals(10, config.getOptionValues(BugzillaAttribute.BUG_STATUS).size());
} else if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
assertEquals(7, config.getOptionValues(BugzillaAttribute.BUG_STATUS).size());
@@ -93,7 +99,8 @@ public class BugzillaClientTest extends TestCase {
}
assertEquals(7, config.getOptionValues(BugzillaAttribute.BUG_SEVERITY).size());
assertEquals(3, config.getOptionValues(BugzillaAttribute.PRODUCT).size());
- if (BugzillaFixture.current() == BugzillaFixture.BUGS_3_6_CUSTOM_WF_AND_STATUS) {
+ if (BugzillaVersion.BUGZILLA_3_6.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0
+ && BugzillaFixture.CUSTOM_WF_AND_STATUS.equals(BugzillaFixture.current().getDescription())) {
assertEquals(6, config.getOpenStatusValues().size());
assertEquals(1, config.getClosedStatusValues().size());
} else if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
@@ -107,15 +114,9 @@ public class BugzillaClientTest extends TestCase {
assertEquals(2, config.getProductOptionValues(BugzillaAttribute.COMPONENT, "ManualTest").size());
assertEquals(4, config.getProductOptionValues(BugzillaAttribute.VERSION, "ManualTest").size());
assertEquals(4, config.getProductOptionValues(BugzillaAttribute.TARGET_MILESTONE, "ManualTest").size());
- if (BugzillaFixture.current().getRepositoryUrl().contains("localhost")) {
- assertEquals(1, config.getProductOptionValues(BugzillaAttribute.COMPONENT, "TestProduct").size());
- assertEquals(1, config.getProductOptionValues(BugzillaAttribute.VERSION, "TestProduct").size());
- assertEquals(1, config.getProductOptionValues(BugzillaAttribute.TARGET_MILESTONE, "TestProduct").size());
- } else {
- assertEquals(2, config.getProductOptionValues(BugzillaAttribute.COMPONENT, "TestProduct").size());
- assertEquals(4, config.getProductOptionValues(BugzillaAttribute.VERSION, "TestProduct").size());
- assertEquals(4, config.getProductOptionValues(BugzillaAttribute.TARGET_MILESTONE, "TestProduct").size());
- }
+ assertEquals(1, config.getProductOptionValues(BugzillaAttribute.COMPONENT, "TestProduct").size());
+ assertEquals(1, config.getProductOptionValues(BugzillaAttribute.VERSION, "TestProduct").size());
+ assertEquals(1, config.getProductOptionValues(BugzillaAttribute.TARGET_MILESTONE, "TestProduct").size());
assertEquals(2, config.getProductOptionValues(BugzillaAttribute.COMPONENT, "Product with Spaces").size());
assertEquals(4, config.getProductOptionValues(BugzillaAttribute.VERSION, "Product with Spaces").size());
assertEquals(4, config.getProductOptionValues(BugzillaAttribute.TARGET_MILESTONE, "Product with Spaces").size());
@@ -202,9 +203,6 @@ public class BugzillaClientTest extends TestCase {
newData.getRoot().getMappedAttribute(TaskAttribute.SUMMARY).setValue("testCommentQuery()");
newData.getRoot().getMappedAttribute(TaskAttribute.PRODUCT).setValue("TestProduct");
newData.getRoot().getMappedAttribute(TaskAttribute.COMPONENT).setValue("TestComponent");
- if (!BugzillaFixture.current().getRepositoryUrl().contains("localhost")) {
- newData.getRoot().getMappedAttribute(BugzillaAttribute.VERSION.getKey()).setValue("1");
- }
newData.getRoot().getMappedAttribute(BugzillaAttribute.OP_SYS.getKey()).setValue("All");
long timestamp = System.currentTimeMillis();
newData.getRoot().getMappedAttribute(TaskAttribute.DESCRIPTION).setValue("" + timestamp);
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java
index ec10dbe89..19af49035 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java
@@ -343,7 +343,7 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest {
// HashMap<?, ?> x1 = bugzillaClient.getTime(monitor);
// Date x2 = bugzillaClient.getDBTime(monitor);
// Date x3 = bugzillaClient.getWebTime(monitor);
-// if (BugzillaFixture.current() != BugzillaFixture.BUGS_3_4) {
+// if (BugzillaVersion.BUGZILLA_3_4.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0) {
// Object[] xx3 = bugzillaClient.getAllFields(monitor);
// Object[] xx4 = bugzillaClient.getFieldsWithNames(monitor, new String[] { "qa_contact" });
// Object[] xx5 = bugzillaClient.getFieldsWithIDs(monitor, new Integer[] { 12, 18 });
@@ -395,22 +395,6 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest {
assertEquals("tests@mylyn.eclipse.org", ((HashMap<String, String>) userList1[0]).get("name"));
assertEquals("Mylyn Test", ((HashMap<String, String>) userList1[0]).get("real_name"));
assertEquals(((Boolean) true), ((HashMap<String, Boolean>) userList1[0]).get("can_login"));
-
- if (BugzillaFixture.current() != BugzillaFixture.BUGS_3_4) {
- Object[] userList2 = bugzillaClient.getUserInfoWithMatch(monitor, new String[] { "est" });
- assertEquals(2, userList2.length);
- assertEquals(((Integer) 3), ((HashMap<String, Integer>) userList2[0]).get("id"));
- assertEquals("guest@mylyn.eclipse.org", ((HashMap<String, String>) userList2[0]).get("email"));
- assertEquals("guest@mylyn.eclipse.org", ((HashMap<String, String>) userList2[0]).get("name"));
- assertEquals("Mylyn guest", ((HashMap<String, String>) userList2[0]).get("real_name"));
- assertEquals(((Boolean) true), ((HashMap<String, Boolean>) userList2[0]).get("can_login"));
-
- assertEquals(((Integer) 2), ((HashMap<String, Integer>) userList2[1]).get("id"));
- assertEquals("tests@mylyn.eclipse.org", ((HashMap<String, String>) userList2[1]).get("email"));
- assertEquals("tests@mylyn.eclipse.org", ((HashMap<String, String>) userList2[1]).get("name"));
- assertEquals("Mylyn Test", ((HashMap<String, String>) userList2[1]).get("real_name"));
- assertEquals(((Boolean) true), ((HashMap<String, Boolean>) userList2[1]).get("can_login"));
- }
}
}
@@ -519,7 +503,7 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest {
public void testXmlRpcBugGet() throws Exception {
if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.XML_RPC_DISABLED)
- || BugzillaFixture.current() == BugzillaFixture.BUGS_3_4) {
+ || BugzillaVersion.BUGZILLA_3_4.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0) {
return;
} else {
Set<String> taskIds = new HashSet<String>();
@@ -692,7 +676,7 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest {
public void testUpdateProductInfo() throws Exception {
if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.XML_RPC_DISABLED)
- || BugzillaFixture.current() == BugzillaFixture.BUGS_3_4) {
+ || BugzillaVersion.BUGZILLA_3_4.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0) {
return;
}
RepositoryConfiguration repositoryConfiguration = connector.getRepositoryConfiguration(repository.getRepositoryUrl());
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java
index 7df14261b..098180e6b 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java
@@ -14,7 +14,10 @@ package org.eclipse.mylyn.bugzilla.tests.support;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import junit.framework.AssertionFailedError;
@@ -26,6 +29,7 @@ import org.eclipse.mylyn.commons.net.WebLocation;
import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil;
import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.PrivilegeLevel;
+import org.eclipse.mylyn.commons.sdk.util.FixtureConfiguration;
import org.eclipse.mylyn.commons.sdk.util.TestConfiguration;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient;
@@ -78,54 +82,67 @@ public class BugzillaFixture extends TestFixture {
* @deprecated not supported any more
*/
@Deprecated
- public static BugzillaFixture BUGS_3_4 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_34_URL, //
+ private static BugzillaFixture BUGS_3_4 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_34_URL, //
"3.4.14", "");
- public static BugzillaFixture BUGS_3_6 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL, //
+ private static BugzillaFixture BUGS_3_6 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL, //
"3.6", "");
- public static BugzillaFixture BUGS_3_6_CUSTOM_WF = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL
+ private static BugzillaFixture BUGS_3_6_CUSTOM_WF = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL
+ "-custom-wf", "3.6", CUSTOM_WF);
- public static BugzillaFixture BUGS_3_6_CUSTOM_WF_AND_STATUS = new BugzillaFixture(
+ private static BugzillaFixture BUGS_3_6_CUSTOM_WF_AND_STATUS = new BugzillaFixture(
BugzillaFixture.TEST_BUGZILLA_36_URL + "-custom-wf-and-status", "3.6", CUSTOM_WF_AND_STATUS);
- public static BugzillaFixture BUGS_3_6_XML_RPC_DISABLED = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL
+ private static BugzillaFixture BUGS_3_6_XML_RPC_DISABLED = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL
+ "-xml-rpc-disabled", "3.6", XML_RPC_DISABLED);
- public static BugzillaFixture BUGS_4_0 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_40_URL, //
+ private static BugzillaFixture BUGS_4_0 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_40_URL, //
"4.0", "");
- public static BugzillaFixture BUGS_4_2 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_42_URL, //
+ private static BugzillaFixture BUGS_4_2 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_42_URL, //
"4.2", "");
- public static BugzillaFixture BUGS_4_4 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_44_URL, //
+ private static BugzillaFixture BUGS_4_4 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_44_URL, //
"4.4", "");
- public static BugzillaFixture BUGS_HEAD = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_HEAD_URL, //
+ private static BugzillaFixture BUGS_HEAD = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_HEAD_URL, //
"4.5", "");
- public static BugzillaFixture DEFAULT = BUGS_4_2;
+ public static BugzillaFixture DEFAULT;
- public static final BugzillaFixture[] ALL = new BugzillaFixture[] { BUGS_3_4, //
- BUGS_3_6, BUGS_3_6_XML_RPC_DISABLED, BUGS_3_6_CUSTOM_WF, BUGS_3_6_CUSTOM_WF_AND_STATUS, //
- BUGS_4_0, BUGS_4_2, BUGS_4_4, BUGS_HEAD };
+ public static final List<BugzillaFixture> ALL;
private final String version;
private final BugzillaVersion bugzillaVersion;
+ private final Map<String, String> properties;
+
+ public BugzillaFixture(FixtureConfiguration config) {
+ super(BugzillaCorePlugin.CONNECTOR_KIND, config.getUrl());
+ this.version = config.getVersion();
+ this.bugzillaVersion = new BugzillaVersion(version);
+ setInfo("Bugzilla", version, config.getInfo());
+ this.properties = config.getProperties();
+ }
+
public BugzillaFixture(String url, String version, String info) {
super(BugzillaCorePlugin.CONNECTOR_KIND, url);
this.version = version;
this.bugzillaVersion = new BugzillaVersion(version);
setInfo("Bugzilla", version, info);
+ this.properties = null;
}
public BugzillaVersion getBugzillaVersion() {
return bugzillaVersion;
}
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
public static void cleanup010() throws Exception {
}
@@ -285,4 +302,64 @@ public class BugzillaFixture extends TestFixture {
return (BugzillaRepositoryConnector) connector;
}
+ private static final String getServerUrl() {
+ String url = TestConfiguration.getRepositoryUrl("");
+ if (url.endsWith("/")) {
+ return url.substring(0, url.length() - 1);
+ }
+ return url;
+ }
+
+ public String getProperty(String key) {
+ if (properties != null) {
+ return properties.get(key);
+ }
+ return null;
+ }
+
+ private static BugzillaFixture getDefaultFixture(List<BugzillaFixture> fixtureList) {
+ if (fixtureList != null && fixtureList.size() > 0) {
+ String defaultFixture = System.getProperty("mylyn.test.default", "");
+ for (BugzillaFixture fixture : fixtureList) {
+ if (!"".equals(defaultFixture)) {
+ if (defaultFixture.equals(fixture.getRepositoryUrl())) {
+ return fixture;
+ }
+ } else {
+ Map<String, String> property = fixture.getProperties();
+ if (property != null) {
+ String defaultProperty = property.get("default");
+ if (defaultProperty != null && "1".equals(defaultProperty)) {
+ return fixture;
+ }
+ }
+ }
+ }
+ }
+ return BUGS_4_2;
+ }
+
+ private static List<BugzillaFixture> getAll(List<BugzillaFixture> fixtureList) {
+ if (fixtureList != null && fixtureList.size() > 0) {
+ return fixtureList;
+ }
+ List<BugzillaFixture> result = new ArrayList<BugzillaFixture>(9);
+ result.add(BUGS_3_4);
+ result.add(BUGS_3_6);
+ result.add(BUGS_3_6_XML_RPC_DISABLED);
+ result.add(BUGS_3_6_CUSTOM_WF);
+ result.add(BUGS_3_6_CUSTOM_WF_AND_STATUS);
+ result.add(BUGS_4_0);
+ result.add(BUGS_4_2);
+ result.add(BUGS_4_4);
+ result.add(BUGS_HEAD);
+ return result;
+ }
+
+ static {
+ List<BugzillaFixture> fixtureList = TestConfiguration.discover(BugzillaFixture.getServerUrl(),
+ BugzillaFixture.class, "bugzilla");
+ DEFAULT = getDefaultFixture(fixtureList);
+ ALL = getAll(fixtureList);
+ }
}

Back to the top