Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 147012 Details for
Bug 289155
[upstream] comment search broken with bugzilla 3.4
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
work around for bugzilla bug
clipboard.txt (text/plain), 12.96 KB, created by
Robert Elves
on 2009-09-11 18:50:53 EDT
(
hide
)
Description:
work around for bugzilla bug
Filename:
MIME Type:
Creator:
Robert Elves
Created:
2009-09-11 18:50:53 EDT
Size:
12.96 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java,v >retrieving revision 1.126 >diff -u -r1.126 BugzillaSearchPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java 26 Aug 2009 20:24:04 -0000 1.126 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java 11 Sep 2009 22:50:37 -0000 >@@ -40,6 +40,7 @@ > import org.eclipse.mylyn.commons.core.CoreUtil; > import org.eclipse.mylyn.commons.core.StatusHandler; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; >+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion; > import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; > import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; > import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin; >@@ -1244,9 +1245,21 @@ > appendToBuffer(sb, "&target_milestone=", target.getItem(element)); //$NON-NLS-1$ > } > >- sb.append("&long_desc_type="); //$NON-NLS-1$ >+ if (repositoryConfiguration == null >+ || repositoryConfiguration.getInstallVersion().isSmallerOrEquals(BugzillaVersion.BUGZILLA_3_4)) { >+ sb.append("&long_desc_type="); //$NON-NLS-1$ >+ } else { >+ sb.append("&longdesc_type="); //$NON-NLS-1$ >+ } >+ > sb.append(patternOperationValues[commentOperation.getSelectionIndex()]); >- appendToBuffer(sb, "&long_desc=", commentPattern.getText()); //$NON-NLS-1$ >+ >+ if (repositoryConfiguration == null >+ || repositoryConfiguration.getInstallVersion().isSmallerOrEquals(BugzillaVersion.BUGZILLA_3_4)) { >+ appendToBuffer(sb, "&long_desc=", commentPattern.getText()); //$NON-NLS-1$ >+ } else { >+ appendToBuffer(sb, "&longdesc=", commentPattern.getText()); //$NON-NLS-1$ >+ } > > selected = status.getSelectionIndices(); > for (int element : selected) { >#P org.eclipse.mylyn.bugzilla.tests >Index: src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java,v >retrieving revision 1.1 >diff -u -r1.1 BugzillaClientTest.java >--- src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java 1 Sep 2009 22:35:31 -0000 1.1 >+++ src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java 11 Sep 2009 22:50:38 -0000 >@@ -13,6 +13,8 @@ > > import java.net.InetSocketAddress; > import java.net.Proxy; >+import java.util.HashSet; >+import java.util.Set; > > import junit.framework.TestCase; > >@@ -20,12 +22,22 @@ > import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture; > import org.eclipse.mylyn.commons.net.AbstractWebLocation; > import org.eclipse.mylyn.context.tests.support.TestUtil.PrivilegeLevel; >+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; >+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttributeMapper; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClientFactory; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector; >+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion; > import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; > import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; >+import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery; >+import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; >+import org.eclipse.mylyn.tasks.core.RepositoryResponse; > import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.core.data.TaskAttribute; >+import org.eclipse.mylyn.tasks.core.data.TaskData; >+import org.eclipse.mylyn.tasks.core.data.TaskDataCollector; >+import org.eclipse.mylyn.tasks.ui.TasksUi; > > /** > * @author Robert Elves >@@ -34,8 +46,11 @@ > > private BugzillaClient client; > >+ private TaskRepository repository; >+ > @Override > protected void setUp() throws Exception { >+ repository = BugzillaFixture.current().singleRepository(); > client = BugzillaFixture.current().client(); > } > >@@ -79,6 +94,63 @@ > client.validate(new NullProgressMonitor()); > } > >+ public void testCommentQuery() throws Exception { >+ BugzillaAttributeMapper mapper = new BugzillaAttributeMapper(repository); >+ TaskData newData = new TaskData(mapper, BugzillaFixture.current().getConnectorKind(), BugzillaFixture.current() >+ .getRepositoryUrl(), ""); >+ >+ AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(BugzillaFixture.current() >+ .getConnectorKind()); >+ connector.getTaskDataHandler().initializeTaskData(repository, newData, null, new NullProgressMonitor()); >+ newData.getRoot().getMappedAttribute(TaskAttribute.SUMMARY).setValue("testCommentQuery()"); >+ newData.getRoot().getMappedAttribute(TaskAttribute.PRODUCT).setValue("TestProduct"); >+ newData.getRoot().getMappedAttribute(TaskAttribute.COMPONENT).setValue("TestComponent"); >+ 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); >+ RepositoryResponse response = client.postTaskData(newData, new NullProgressMonitor()); >+ >+ String bugid = response.getTaskId(); >+ RepositoryQuery query = new RepositoryQuery(BugzillaFixture.current().getConnectorKind(), "123"); >+ query.setRepositoryUrl(BugzillaFixture.current().getRepositoryUrl()); >+ query.setUrl("?short_desc_type=allwordssubstr&short_desc=&long_desc_type=allwordssubstr&long_desc=" + timestamp >+ + "&bug_status=NEW"); >+ >+ final Set<TaskData> returnedData = new HashSet<TaskData>(); >+ >+ TaskDataCollector collector = new TaskDataCollector() { >+ >+ @Override >+ public void accept(TaskData taskData) { >+ returnedData.add(taskData); >+ } >+ }; >+ >+ client.getSearchHits(query, collector, mapper, new NullProgressMonitor()); >+ assertEquals(1, returnedData.size()); >+ assertEquals(bugid, returnedData.iterator().next().getTaskId()); >+ if (!client.getRepositoryConfiguration().getInstallVersion().isSmallerOrEquals(BugzillaVersion.BUGZILLA_3_4)) { >+ query.setUrl("?short_desc_type=allwordssubstr&short_desc=&longdesc_type=allwordssubstr&longdesc=" >+ + timestamp + "&bug_status=NEW"); >+ >+ returnedData.clear(); >+ >+ collector = new TaskDataCollector() { >+ >+ @Override >+ public void accept(TaskData taskData) { >+ returnedData.add(taskData); >+ } >+ }; >+ >+ client.getSearchHits(query, collector, mapper, new NullProgressMonitor()); >+ assertEquals(1, returnedData.size()); >+ assertEquals(bugid, returnedData.iterator().next().getTaskId()); >+ } >+ >+ } >+ > // public void testCredentialsEncoding() throws IOException, BugzillaException, KeyManagementException, > // GeneralSecurityException { > // String poundSignUTF8 = BugzillaClient.addCredentials(IBugzillaTestConstants.TEST_BUGZILLA_222_URL, "UTF-8", >Index: src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java,v >retrieving revision 1.2 >diff -u -r1.2 BugzillaFixture.java >--- src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java 1 Sep 2009 22:35:31 -0000 1.2 >+++ src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java 11 Sep 2009 22:50:38 -0000 >@@ -22,6 +22,9 @@ > import org.eclipse.mylyn.bugzilla.tests.BugzillaTestConstants; > import org.eclipse.mylyn.commons.net.AuthenticationCredentials; > import org.eclipse.mylyn.commons.net.AuthenticationType; >+import org.eclipse.mylyn.context.tests.support.TestUtil; >+import org.eclipse.mylyn.context.tests.support.TestUtil.Credentials; >+import org.eclipse.mylyn.context.tests.support.TestUtil.PrivilegeLevel; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClientManager; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; >@@ -97,7 +100,8 @@ > } > > public BugzillaClient client() throws CoreException, IOException { >- return client(getRepositoryUrl(), "", "", "", "", "UTF-8"); >+ Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.USER); >+ return client(getRepositoryUrl(), credentials.username, credentials.password, "", "", "UTF-8"); > } > > public BugzillaClient client(String hostUrl, String username, String password, String htAuthUser, >#P org.eclipse.mylyn.bugzilla.core >Index: src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties,v >retrieving revision 1.12 >diff -u -r1.12 messages.properties >--- src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties 24 Aug 2009 22:49:25 -0000 1.12 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties 11 Sep 2009 22:50:39 -0000 >@@ -97,7 +97,7 @@ > BugzillaOperation_Resolve_as=Resolve as > BugzillaOperation_Reassign_to_default_assignee=Reassign to default assignee > >-BugzillaRepositoryConnector_BUGZILLA_SUPPORTS_2_18_TO_3_0=Bugzilla (supports uncustomized 2.18-3.2) >+BugzillaRepositoryConnector_BUGZILLA_CONNECTOR_LABEL=Bugzilla (supports 3.0 and later) > BugzillaRepositoryConnector_Check_repository_configuration=Check repository configuration: {0} > BugzillaRepositoryConnector_checking_for_changed_tasks=Checking for changed tasks > BugzillaRepositoryConnector_Query_for_changed_tasks=Query for changed tasks >Index: src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java,v >retrieving revision 1.8 >diff -u -r1.8 Messages.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java 24 Aug 2009 22:49:25 -0000 1.8 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java 11 Sep 2009 22:50:39 -0000 >@@ -199,7 +199,7 @@ > > public static String BugzillaOperation_Reassign_to_default_assignee; > >- public static String BugzillaRepositoryConnector_BUGZILLA_SUPPORTS_2_18_TO_3_0; >+ public static String BugzillaRepositoryConnector_BUGZILLA_CONNECTOR_LABEL; > > public static String BugzillaRepositoryConnector_Check_repository_configuration; > >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java,v >retrieving revision 1.168 >diff -u -r1.168 BugzillaRepositoryConnector.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 9 Sep 2009 18:57:33 -0000 1.168 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 11 Sep 2009 22:50:39 -0000 >@@ -62,7 +62,7 @@ > > private static final String CHANGED_BUGS_CGI_QUERY = "/buglist.cgi?query_format=advanced&chfieldfrom="; //$NON-NLS-1$ > >- private static final String CLIENT_LABEL = Messages.BugzillaRepositoryConnector_BUGZILLA_SUPPORTS_2_18_TO_3_0; >+ private static final String CLIENT_LABEL = Messages.BugzillaRepositoryConnector_BUGZILLA_CONNECTOR_LABEL; > > private static final String COMMENT_FORMAT = "yyyy-MM-dd HH:mm"; //$NON-NLS-1$ > >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java,v >retrieving revision 1.193 >diff -u -r1.193 BugzillaClient.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 27 Aug 2009 03:37:32 -0000 1.193 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 11 Sep 2009 22:50:39 -0000 >@@ -446,6 +446,15 @@ > if (nameValue.length == 1) { > pairs.add(new NameValuePair(nameValue[0].trim(), "")); //$NON-NLS-1$ > } else if (nameValue.length == 2 && nameValue[0] != null && nameValue[1] != null) { >+ >+ // Hack around bugzilla's change of attribute name for comment search field bug#289155 >+ if (nameValue[0].startsWith("long_desc") >+ && getRepositoryConfiguration() != null >+ && !getRepositoryConfiguration().getInstallVersion().isSmallerOrEquals( >+ BugzillaVersion.BUGZILLA_3_4)) { >+ nameValue[0] = nameValue[0].replace("long_desc", "longdesc"); >+ } >+ > pairs.add(new NameValuePair(nameValue[0].trim(), URLDecoder.decode(nameValue[1].trim(), > getCharacterEncoding()))); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 289155
:
147012
|
147025
|
147028
|
147039
|
147040