diff options
author | Frank Becker | 2013-04-27 11:48:40 +0000 |
---|---|---|
committer | Frank Becker | 2013-04-27 11:48:40 +0000 |
commit | 3f06de687d2aa99e29671cb119821c336d734fcf (patch) | |
tree | c0c8a14f1ae412f3c03452de522fdd795f76bdad /org.eclipse.mylyn.bugzilla.tests/src | |
parent | 2afb23e0e13a0bccd2906ed29c953f6bbe22a72b (diff) | |
download | org.eclipse.mylyn.tasks-3f06de687d2aa99e29671cb119821c336d734fcf.tar.gz org.eclipse.mylyn.tasks-3f06de687d2aa99e29671cb119821c336d734fcf.tar.xz org.eclipse.mylyn.tasks-3f06de687d2aa99e29671cb119821c336d734fcf.zip |
399803: Bugzilla puppet configuration should be reproducible
* update to latest version from 3.6.x stream
* properties are now used
Change-Id: I004bd7ee2189a594b32dc86e55d09f74ec2952cc
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=399803
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests/src')
4 files changed, 59 insertions, 45 deletions
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 7a66d6f21..91c986c73 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 @@ -349,12 +349,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { // public void testStdWorkflow() throws Exception { if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) { - 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())) - - ) { + if (!BugzillaFixture.current().isCustomWorkflow() && !BugzillaFixture.current().isCustomWorkflowAndStatus()) { doStdWorkflow32("3"); } } else { @@ -416,8 +411,13 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { TaskAttribute statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); assertEquals("CONFIRMED", statusAttribute.getValue()); TaskAttribute selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.in_progress.toString(), - BugzillaOperation.in_progress.getLabel()); + TaskAttribute operationAttribute = taskData.getRoot().getAttribute( + TaskAttribute.PREFIX_OPERATION + BugzillaOperation.in_progress.toString()); + TaskAttribute operationAttributeUppercase = taskData.getRoot().getAttribute( + TaskAttribute.PREFIX_OPERATION + BugzillaOperation.in_progress.toString().toUpperCase()); + TaskOperation.applyTo(selectedOperationAttribute, operationAttribute != null + ? operationAttribute.getValue() + : operationAttributeUppercase.getValue(), BugzillaOperation.in_progress.getLabel()); model.attributeChanged(selectedOperationAttribute); changed.clear(); changed.add(selectedOperationAttribute); @@ -478,8 +478,13 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); assertEquals("VERIFIED", statusAttribute.getValue()); selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.confirmed.toString(), - BugzillaOperation.confirmed.getLabel()); + operationAttribute = taskData.getRoot().getAttribute( + TaskAttribute.PREFIX_OPERATION + BugzillaOperation.confirmed.toString()); + operationAttributeUppercase = taskData.getRoot().getAttribute( + TaskAttribute.PREFIX_OPERATION + BugzillaOperation.confirmed.toString().toUpperCase()); + TaskOperation.applyTo(selectedOperationAttribute, operationAttribute != null + ? operationAttribute.getValue() + : operationAttributeUppercase.getValue(), BugzillaOperation.confirmed.getLabel()); model.attributeChanged(selectedOperationAttribute); changed.clear(); changed.add(selectedOperationAttribute); 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 1f45acd79..d3a9f3725 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 @@ -73,8 +73,7 @@ public class BugzillaClientTest extends TestCase { 0, config.getInstallVersion().compareMajorMinorOnly( new BugzillaVersion(BugzillaFixture.current().getVersion()))); - if (BugzillaVersion.BUGZILLA_3_6.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0 - && BugzillaFixture.CUSTOM_WF_AND_STATUS.equals(BugzillaFixture.current().getDescription())) { + if (BugzillaFixture.current().isCustomWorkflowAndStatus()) { 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()); @@ -99,8 +98,7 @@ public class BugzillaClientTest extends TestCase { } assertEquals(7, config.getOptionValues(BugzillaAttribute.BUG_SEVERITY).size()); assertEquals(3, config.getOptionValues(BugzillaAttribute.PRODUCT).size()); - if (BugzillaVersion.BUGZILLA_3_6.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0 - && BugzillaFixture.CUSTOM_WF_AND_STATUS.equals(BugzillaFixture.current().getDescription())) { + if (BugzillaFixture.current().isCustomWorkflowAndStatus()) { assertEquals(6, config.getOpenStatusValues().size()); assertEquals(1, config.getClosedStatusValues().size()); } else if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) { 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 19af49035..06402a926 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 @@ -351,7 +351,7 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { // } // } public void testGetVersion() throws Exception { - if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.XML_RPC_DISABLED)) { + if (!BugzillaFixture.current().isXmlRpcEnabled()) { return; } else { IProgressMonitor monitor = new NullProgressMonitor(); @@ -365,7 +365,7 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { @SuppressWarnings("unchecked") public void testUserInfo() throws Exception { - if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.XML_RPC_DISABLED)) { + if (!BugzillaFixture.current().isXmlRpcEnabled()) { return; } else { IProgressMonitor monitor = new NullProgressMonitor(); @@ -400,7 +400,7 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { @SuppressWarnings("unchecked") public void testProductInfo() throws Exception { - if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.XML_RPC_DISABLED)) { + if (!BugzillaFixture.current().isXmlRpcEnabled()) { return; } else { IProgressMonitor monitor = new NullProgressMonitor(); @@ -441,7 +441,7 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { int uID = -1; IProgressMonitor monitor = new NullProgressMonitor(); BugzillaFixture a = BugzillaFixture.current(); - if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.XML_RPC_DISABLED)) { + if (!BugzillaFixture.current().isXmlRpcEnabled()) { try { uID = bugzillaClient.login(monitor); fail("Never reach this! We should get an XmlRpcException"); @@ -459,7 +459,7 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { if (BugzillaFixture.current().getBugzillaVersion().isSmaller(BugzillaVersion.BUGZILLA_3_6)) { return; - } else if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.XML_RPC_DISABLED)) { + } else if (!BugzillaFixture.current().isXmlRpcEnabled()) { return; } else { CustomTransitionManager ctm = new CustomTransitionManager(); @@ -475,9 +475,9 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { * way to determine (using the operation 'reopen') whether "REOPEN" or "UNCONFIRMED" * is valid. */ - if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.CUSTOM_WF)) { + if (BugzillaFixture.current().isCustomWorkflow()) { expectTransitions = fixtureTransitionsMap.get(BugzillaFixture.CUSTOM_WF); - } else if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.CUSTOM_WF_AND_STATUS)) { + } else if (BugzillaFixture.current().isCustomWorkflowAndStatus()) { expectTransitions = fixtureTransitionsMap.get(BugzillaFixture.CUSTOM_WF_AND_STATUS); } else if (BugzillaFixture.current().getBugzillaVersion().isSmaller(BugzillaVersion.BUGZILLA_4_0)) { expectTransitions = fixtureTransitionsMap.get(BUGZILLA_LE_4_0); @@ -502,8 +502,7 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { } public void testXmlRpcBugGet() throws Exception { - if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.XML_RPC_DISABLED) - || BugzillaVersion.BUGZILLA_3_4.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0) { + if (!BugzillaFixture.current().isXmlRpcEnabled()) { return; } else { Set<String> taskIds = new HashSet<String>(); @@ -675,8 +674,7 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { } public void testUpdateProductInfo() throws Exception { - if (BugzillaFixture.current().getDescription().equals(BugzillaFixture.XML_RPC_DISABLED) - || BugzillaVersion.BUGZILLA_3_4.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0) { + if (!BugzillaFixture.current().isXmlRpcEnabled()) { 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 acb6951f2..053f89e33 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 @@ -15,6 +15,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Collections; +import java.util.HashMap; import java.util.Map; import junit.framework.AssertionFailedError; @@ -44,7 +45,6 @@ import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; import org.eclipse.mylyn.tasks.core.data.TaskData; import org.eclipse.mylyn.tasks.core.data.TaskDataCollector; import org.eclipse.mylyn.tests.util.TestFixture; -import org.eclipse.osgi.util.NLS; /** * @author Steffen Pingel @@ -57,8 +57,6 @@ public class BugzillaFixture extends TestFixture { public static final String CUSTOM_WF_AND_STATUS = "Custom Workflow and Status"; - public static final String XML_RPC_DISABLED = "XML-RPC disabled"; - private static BugzillaFixture current; private final String version; @@ -67,6 +65,14 @@ public class BugzillaFixture extends TestFixture { private final Map<String, String> properties; + private final Map<String, String> defaultproperties = new HashMap<String, String>() { + private static final long serialVersionUID = 6995247925138693239L; + + { + put("xmlrpc_enabled", "true"); + } + }; + private BugzillaRepositoryConnector connector; public BugzillaFixture(FixtureConfiguration config) { @@ -89,10 +95,6 @@ public class BugzillaFixture extends TestFixture { return bugzillaVersion; } - public Map<String, String> getProperties() { - return properties; - } - public static void cleanup010() throws Exception { } @@ -137,8 +139,8 @@ public class BugzillaFixture extends TestFixture { public BugzillaClient client(AbstractWebLocation location, String encoding) throws CoreException { TaskRepository taskRepository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, location.getUrl()); - if (properties.get("desciptorfile") != null) { - String filepath = "testdata/repository/" + properties.get("desciptorfile"); + if (getDsciptorfile() != null) { + String filepath = "testdata/repository/" + getDsciptorfile(); try { File file = BugzillaFixture.getFile(filepath); if (file != null) { @@ -156,6 +158,7 @@ public class BugzillaFixture extends TestFixture { taskRepository.setCredentials(AuthenticationType.HTTP, location.getCredentials(AuthenticationType.HTTP), false); taskRepository.setCharacterEncoding(encoding); + taskRepository.setProperty(IBugzillaConstants.BUGZILLA_USE_XMLRPC, getProperty("xmlrpc_enabled")); connector = new BugzillaRepositoryConnector(); BugzillaClientManager bugzillaClientManager = connector.getClientManager(); @@ -166,14 +169,6 @@ public class BugzillaFixture extends TestFixture { return client; } - private String getRepositoryName(String url) { - int i = url.lastIndexOf("/"); - if (i == -1) { - throw new IllegalArgumentException(NLS.bind("Unable to determine repository name for {0}", url)); - } - return url.substring(i + 1); - } - public BugzillaClient client(PrivilegeLevel level) throws Exception { AbstractWebLocation location = location(level); return client(location, "UTF-8"); @@ -251,14 +246,32 @@ public class BugzillaFixture extends TestFixture { } public String getProperty(String key) { + String result = null; if (properties != null) { - return properties.get(key); + result = properties.get(key); + if (result == null) { + result = defaultproperties.get(key); + } + } else { + result = defaultproperties.get(key); } - return null; + return result; } public boolean isCustomWorkflowAndStatus() { - return Boolean.parseBoolean(properties.get("custom_wf_and_status")); + return Boolean.parseBoolean(getProperty("custom_wf_and_status")); + } + + public boolean isCustomWorkflow() { + return Boolean.parseBoolean(getProperty("custom_wf")); + } + + public boolean isXmlRpcEnabled() { + return Boolean.parseBoolean(getProperty("xmlrpc_enabled")); + } + + public String getDsciptorfile() { + return getProperty("desciptorfile"); } } |