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 236649 Details for
Bug 418300
"Show were used" for test suites
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]
Patch
0001-show-where-used-for-test-suites.patch (text/plain), 12.37 KB, created by
Sebastian Struckmann
on 2013-10-18 08:06:11 EDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sebastian Struckmann
Created:
2013-10-18 08:06:11 EDT
Size:
12.37 KB
patch
obsolete
>From 8644d7810d22f0ffbf42afdb17994d1ace41a341 Mon Sep 17 00:00:00 2001 >From: Sebastian Struckmann <sebastian.struckmann@bredex.de> >Date: Thu, 17 Oct 2013 15:34:48 +0200 >Subject: [PATCH] show where used for test suites > >--- > .../jubula/client/core/persistence/NodePM.java | 8 +- > org.eclipse.jubula.client.ui.rcp/plugin.xml | 18 ++++ > .../TestSuiteShowWhereUsedHandler.java | 37 +++++++ > .../jubula/client/ui/rcp/i18n/Messages.java | 1 + > .../jubula/client/ui/rcp/i18n/messages.properties | 1 + > .../search/query/ShowWhereUsedTestSuiteQuery.java | 117 +++++++++++++++++++++ > 6 files changed, 178 insertions(+), 4 deletions(-) > create mode 100644 org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/showwhereused/TestSuiteShowWhereUsedHandler.java > create mode 100644 org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/search/query/ShowWhereUsedTestSuiteQuery.java > >diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/NodePM.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/NodePM.java >index 870af3e..1738281 100644 >--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/NodePM.java >+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/NodePM.java >@@ -548,7 +548,7 @@ public class NodePM extends PersistenceManager { > * doesn't know the parent. > * > * @param tsGuid >- * GUID of the test case being reused. >+ * GUID of the test suite being reused. > * @param parentProjectId > * ID of the parent project of the test case being reused. > * @return all ref test suites that reference the test suite with the given >@@ -572,7 +572,7 @@ public class NodePM extends PersistenceManager { > /** > * > * @param tsGuid The GUID of the reused test suite. >- * @param parentProjectIds All returned test cases will have one of these as >+ * @param parentProjectIds All returned test suites will have one of these as > * their project parent ID. > * @param s The session into which the test cases will be loaded. > * @return list of test suites. >@@ -592,8 +592,8 @@ public class NodePM extends PersistenceManager { > queryBuffer.append(")"); //$NON-NLS-1$ > Query q = s.createQuery(queryBuffer.toString()); > q.setParameter("tsGuid", tsGuid); //$NON-NLS-1$ >- List<IRefTestSuitePO> execTcList = q.getResultList(); >- return execTcList; >+ List<IRefTestSuitePO> refTestSuiteList = q.getResultList(); >+ return refTestSuiteList; > } > > /** >diff --git a/org.eclipse.jubula.client.ui.rcp/plugin.xml b/org.eclipse.jubula.client.ui.rcp/plugin.xml >index 4731b1f..efd5b5d 100644 >--- a/org.eclipse.jubula.client.ui.rcp/plugin.xml >+++ b/org.eclipse.jubula.client.ui.rcp/plugin.xml >@@ -1751,6 +1751,10 @@ > style="push"> > </command> > <command >+ commandId="org.eclipse.jubula.client.ui.rcp.commands.ShowWhereUsed" >+ style="push"> >+ </command> >+ <command > commandId="org.eclipse.jubula.client.ui.commands.ExpandTreeItem" > style="push"> > </command> >@@ -2342,6 +2346,20 @@ > </activeWhen> > </handler> > <handler >+ class="org.eclipse.jubula.client.ui.rcp.handlers.showwhereused.TestSuiteShowWhereUsedHandler" >+ commandId="org.eclipse.jubula.client.ui.rcp.commands.ShowWhereUsed"> >+ <activeWhen> >+ <and> >+ <count value="1" /> >+ <iterate >+ ifEmpty="false" >+ operator="and"> >+ <instanceof value="org.eclipse.jubula.client.core.model.ITestSuitePO" /> >+ </iterate> >+ </and> >+ </activeWhen> >+ </handler> >+ <handler > class="org.eclipse.jubula.client.ui.rcp.handlers.showwhereused.ComponentNameShowWhereUsedHandler" > commandId="org.eclipse.jubula.client.ui.rcp.commands.ShowWhereUsed"> > <activeWhen> >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/showwhereused/TestSuiteShowWhereUsedHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/showwhereused/TestSuiteShowWhereUsedHandler.java >new file mode 100644 >index 0000000..a64b38e >--- /dev/null >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/showwhereused/TestSuiteShowWhereUsedHandler.java >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 2013 BREDEX GmbH. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * BREDEX GmbH - initial API and implementation and/or initial documentation >+ *******************************************************************************/ >+package org.eclipse.jubula.client.ui.rcp.handlers.showwhereused; >+ >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.jubula.client.core.model.ITestSuitePO; >+import org.eclipse.jubula.client.ui.rcp.search.query.ShowWhereUsedTestSuiteQuery; >+import org.eclipse.search.ui.NewSearchUI; >+ >+ >+/** >+ * Class for test suite "Show where used" handler >+ * >+ * @author BREDEX GmbH >+ * @created 17.10.2013 >+ */ >+public class TestSuiteShowWhereUsedHandler extends >+ AbstractShowWhereUsedHandler { >+ >+ /** {@inheritDoc} */ >+ public Object execute(ExecutionEvent event) { >+ init(event); >+ final Object first = getCurrentSelection().getFirstElement(); >+ ITestSuitePO testSuite = (ITestSuitePO)first; >+ NewSearchUI.runQueryInBackground( >+ new ShowWhereUsedTestSuiteQuery(testSuite)); >+ return null; >+ } >+} >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java >index de75387..bf3b7b7 100644 >--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java >@@ -844,6 +844,7 @@ public class Messages extends NLS { > public static String UIJobSearchingResponsibleCompNames; > public static String UIJobSearchingTestCases; > public static String UIJobSearchingTestDataCube; >+ public static String UIJobSearchingTestSuites; > public static String UIJobStartTestJob; > public static String UnexpectedDialogReturnCode; > public static String UnexpectedError; >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties >index f94ac64..2f0c996 100644 >--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties >@@ -830,6 +830,7 @@ UIJobSearchingCompNames=Search for usage of Component Names > UIJobSearchingResponsibleCompNames=Search for responsible specification of Component Name > UIJobSearchingTestCases=Search for usage of Test Case > UIJobSearchingTestDataCube=Search for usage of Test Data Sets >+UIJobSearchingTestSuites=Search for usage of Test Suite > UIJobStartTestJob=Start Test Job > UnexpectedDialogReturnCode=Unexpected dialog return code > UnexpectedError=Unexpected error >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/search/query/ShowWhereUsedTestSuiteQuery.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/search/query/ShowWhereUsedTestSuiteQuery.java >new file mode 100644 >index 0000000..b6ee8db >--- /dev/null >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/search/query/ShowWhereUsedTestSuiteQuery.java >@@ -0,0 +1,117 @@ >+/******************************************************************************* >+ * Copyright (c) 2013 BREDEX GmbH. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * BREDEX GmbH - initial API and implementation and/or initial documentation >+ *******************************************************************************/ >+package org.eclipse.jubula.client.ui.rcp.search.query; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.jubula.client.core.model.INodePO; >+import org.eclipse.jubula.client.core.model.IProjectPO; >+import org.eclipse.jubula.client.core.model.IRefTestSuitePO; >+import org.eclipse.jubula.client.core.model.ITestSuitePO; >+import org.eclipse.jubula.client.core.persistence.GeneralStorage; >+import org.eclipse.jubula.client.core.persistence.NodePM; >+import org.eclipse.jubula.client.ui.rcp.i18n.Messages; >+import org.eclipse.jubula.client.ui.rcp.provider.labelprovider.GeneralLabelProvider; >+import org.eclipse.jubula.client.ui.rcp.search.result.BasicSearchResult.NodeSearchResultElementAction; >+import org.eclipse.jubula.client.ui.rcp.search.result.BasicSearchResult.SearchResultElement; >+import org.eclipse.jubula.tools.constants.StringConstants; >+import org.eclipse.osgi.util.NLS; >+ >+ >+/** >+ * @author BREDEX GmbH >+ * @created 18.10.2013 >+ */ >+public class ShowWhereUsedTestSuiteQuery >+ extends AbstractShowWhereUsedQuery { >+ /** >+ * <code>m_specTC</code> >+ */ >+ private ITestSuitePO m_testSuite; >+ >+ /** >+ * @param testSuite >+ * the test suite to search the reuse for >+ */ >+ public ShowWhereUsedTestSuiteQuery(ITestSuitePO testSuite) { >+ super(null); >+ m_testSuite = testSuite; >+ } >+ >+ /** >+ * {@inheritDoc} >+ */ >+ public IStatus run(IProgressMonitor monitor) { >+ calculateReuseOfTestSuite(m_testSuite, monitor); >+ return Status.OK_STATUS; >+ } >+ >+ /** >+ * calculates and show the places of reuse for a test suite >+ * >+ * @param testSuite >+ * the test suite >+ * @param monitor >+ * the progress monitor >+ */ >+ private void calculateReuseOfTestSuite(ITestSuitePO testSuite, >+ IProgressMonitor monitor) { >+ IProjectPO currentProject = GeneralStorage.getInstance().getProject(); >+ List<IRefTestSuitePO> reuse = NodePM.getInternalRefTestSuites( >+ testSuite.getGuid(), currentProject.getId()); >+ final List<SearchResultElement> reuseLoc = >+ new ArrayList<SearchResultElement>( >+ reuse.size()); >+ List<INodePO> parentList = new ArrayList<INodePO>(); >+ >+ monitor.beginTask("Searching for reusage of Test Suite", reuse.size()); //$NON-NLS-1$ >+ for (IRefTestSuitePO refTestSuite : reuse) { >+ INodePO parent = refTestSuite.getParentNode(); >+ if (parent != null) { >+ Long id = refTestSuite.getId(); >+ String nodeName = GeneralLabelProvider.getTextImpl( >+ refTestSuite); >+ parentList.add(parent); >+ reuseLoc.add(new SearchResultElement<Long>(NLS.bind( >+ Messages.SearchResultPageElementLabel, new Object[] { >+ parent.getName(), nodeName }), id, >+ GeneralLabelProvider.getImageImpl(refTestSuite), >+ new NodeSearchResultElementAction(), refTestSuite >+ .getComment())); >+ } >+ monitor.worked(1); >+ } >+ >+ setSearchResult(reuseLoc); >+ monitor.done(); >+ } >+ >+ /** >+ * {@inheritDoc} >+ */ >+ @SuppressWarnings("nls") >+ public String getLabel() { >+ StringBuilder sb = new StringBuilder(); >+ sb.append(getTimestamp()); >+ sb.append(StringConstants.COLON); >+ sb.append(StringConstants.SPACE); >+ sb.append(Messages.UIJobSearchingTestSuites); >+ sb.append(" \""); >+ sb.append(m_testSuite.getName()); >+ sb.append("\""); >+ return sb.toString(); >+ } >+ >+} >-- >1.7.11 >
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 418300
:
236649
|
236752