Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jubula.client.alm.mylyn.ui/src/org/eclipse/jubula/client/alm/mylyn/ui/handler/AbstractALMReportHandler.java9
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ITestResultSummaryPO.java5
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TestResultSummaryPO.java16
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/TestResultPM.java20
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/ExportTestResultDetailsWizard.java15
-rw-r--r--org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/open/OpenTestResultViewerHandler.java3
-rw-r--r--org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/propertytester/TestResultSummaryPropertyTester.java34
-rw-r--r--org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/views/TestresultSummaryView.java25
8 files changed, 45 insertions, 82 deletions
diff --git a/org.eclipse.jubula.client.alm.mylyn.ui/src/org/eclipse/jubula/client/alm/mylyn/ui/handler/AbstractALMReportHandler.java b/org.eclipse.jubula.client.alm.mylyn.ui/src/org/eclipse/jubula/client/alm/mylyn/ui/handler/AbstractALMReportHandler.java
index be8794013..f3a41b551 100644
--- a/org.eclipse.jubula.client.alm.mylyn.ui/src/org/eclipse/jubula/client/alm/mylyn/ui/handler/AbstractALMReportHandler.java
+++ b/org.eclipse.jubula.client.alm.mylyn.ui/src/org/eclipse/jubula/client/alm/mylyn/ui/handler/AbstractALMReportHandler.java
@@ -16,8 +16,6 @@ import java.util.List;
import org.eclipse.jubula.client.core.model.ITestResultSummaryPO;
import org.eclipse.jubula.client.core.model.ITestResultSummaryPO.AlmReportStatus;
-import org.eclipse.jubula.client.core.persistence.GeneralStorage;
-import org.eclipse.jubula.client.core.persistence.TestResultPM;
import org.eclipse.jubula.client.ui.handlers.AbstractSelectionBasedHandler;
/**
@@ -36,10 +34,9 @@ public abstract class AbstractALMReportHandler extends
Object o = iterator.next();
if (o instanceof ITestResultSummaryPO) {
ITestResultSummaryPO summary = (ITestResultSummaryPO) o;
- if (TestResultPM.hasTestResultDetails(GeneralStorage
- .getInstance().getMasterSession(), summary.getId())
- && AlmReportStatus.NOT_YET_REPORTED.equals(summary
- .getAlmReportStatus())) {
+ if (summary.hasTestResultDetails()
+ && AlmReportStatus.NOT_YET_REPORTED.equals(summary
+ .getAlmReportStatus())) {
pendingSummaries.add(summary);
}
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ITestResultSummaryPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ITestResultSummaryPO.java
index 6c77d548c..cdffbfdc2 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ITestResultSummaryPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ITestResultSummaryPO.java
@@ -76,4 +76,9 @@ public interface ITestResultSummaryPO extends IArchivableTestResultSummary,
* @return the monitoring report for this test result summary
*/
public abstract MonitoringReportPO getMonitoringReport();
+
+ /**
+ * @return whether this result has corresponding test result details
+ */
+ public boolean hasTestResultDetails();
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TestResultSummaryPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TestResultSummaryPO.java
index 91bca2aca..79c68b63c 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TestResultSummaryPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TestResultSummaryPO.java
@@ -40,6 +40,8 @@ import javax.persistence.Transient;
import javax.persistence.Version;
import org.eclipse.jubula.client.core.i18n.Messages;
+import org.eclipse.jubula.client.core.persistence.GeneralStorage;
+import org.eclipse.jubula.client.core.persistence.TestResultPM;
import org.eclipse.jubula.tools.internal.constants.StringConstants;
import org.eclipse.jubula.tools.internal.objects.IMonitoringValue;
import org.eclipse.jubula.tools.internal.objects.MonitoringValue;
@@ -200,6 +202,9 @@ class TestResultSummaryPO implements ITestResultSummaryPO {
/** the URL of the dashboard */
private String m_dashboardURL = null;
+ /** whether this report has test result details */
+ private Boolean m_hasDetails = null;
+
/**
* only for Persistence (JPA / EclipseLink)
*/
@@ -1164,4 +1169,15 @@ class TestResultSummaryPO implements ITestResultSummaryPO {
public List<IALMReportingRulePO> getALMReportingRules() {
return m_reportingRules;
}
+
+ /** {@inheritDoc} */
+ @Transient
+ public boolean hasTestResultDetails() {
+ if (m_hasDetails == null) {
+ m_hasDetails = TestResultPM.hasTestResultDetails(GeneralStorage
+ .getInstance().getMasterSession(), getId());
+ }
+
+ return m_hasDetails;
+ }
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/TestResultPM.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/TestResultPM.java
index e1df9476a..1fd01097c 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/TestResultPM.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/TestResultPM.java
@@ -19,7 +19,6 @@ import javax.persistence.EntityTransaction;
import javax.persistence.Query;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Path;
import javax.persistence.criteria.Root;
import org.apache.commons.lang.time.DateUtils;
@@ -311,21 +310,4 @@ public class TestResultPM {
return (ITestResultSummaryPO) session.createQuery(query)
.getSingleResult();
}
-
- /**
- * @param session
- * The session in which to execute the Persistence (JPA / EclipseLink) query.
- * @return a list of test result ids that have test result details
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public static List<Number>
- computeTestresultIdsWithDetails(EntityManager session) {
-
- CriteriaBuilder builder = session.getCriteriaBuilder();
- CriteriaQuery query = builder.createQuery();
- Path from = query.from(PoMaker.getTestResultClass()).get("internalTestResultSummaryID"); //$NON-NLS-1$
- query.select(from).distinct(true);
-
- return session.createQuery(query).getResultList();
- }
-}
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/ExportTestResultDetailsWizard.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/ExportTestResultDetailsWizard.java
index f637222f6..4a71f32dd 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/ExportTestResultDetailsWizard.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/ExportTestResultDetailsWizard.java
@@ -32,9 +32,7 @@ import org.eclipse.jubula.client.core.businessprocess.FileXMLReportWriter;
import org.eclipse.jubula.client.core.model.ITestResultSummaryPO;
import org.eclipse.jubula.client.core.model.SummarizedTestResult;
import org.eclipse.jubula.client.core.model.TestResultNode;
-import org.eclipse.jubula.client.core.persistence.GeneralStorage;
import org.eclipse.jubula.client.core.persistence.Persistor;
-import org.eclipse.jubula.client.core.persistence.TestResultPM;
import org.eclipse.jubula.client.ui.editors.TestResultViewer.GenerateTestResultTreeOperation;
import org.eclipse.jubula.client.ui.rcp.Plugin;
import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
@@ -295,16 +293,13 @@ public class ExportTestResultDetailsWizard extends Wizard
// DB connection. Otherwise we will receive an NPE
// while trying to initialize the Master Session.
if (Persistor.instance() != null) {
- List<Number> idsWithDetails =
- TestResultPM.computeTestresultIdsWithDetails(
- GeneralStorage.getInstance().getMasterSession());
for (Object selectedElement : selection.toArray()) {
if (selectedElement instanceof ITestResultSummaryPO
- && idsWithDetails.contains(
- ((ITestResultSummaryPO)selectedElement).getId())) {
-
- selectedSummaryList.add(
- (ITestResultSummaryPO)selectedElement);
+ && ((ITestResultSummaryPO) selectedElement)
+ .hasTestResultDetails()) {
+
+ selectedSummaryList
+ .add((ITestResultSummaryPO) selectedElement);
}
}
}
diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/open/OpenTestResultViewerHandler.java b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/open/OpenTestResultViewerHandler.java
index ab2be0274..0f379e6cb 100644
--- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/open/OpenTestResultViewerHandler.java
+++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/open/OpenTestResultViewerHandler.java
@@ -109,8 +109,7 @@ public class OpenTestResultViewerHandler
if (firstElement instanceof ITestResultSummaryPO) {
ITestResultSummaryPO result =
(ITestResultSummaryPO) firstElement;
- if (TestResultPM.hasTestResultDetails(
- session, result.getId())) {
+ if (result.hasTestResultDetails()) {
editorInput = new TestResultEditorInput(result);
}
} else {
diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/propertytester/TestResultSummaryPropertyTester.java b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/propertytester/TestResultSummaryPropertyTester.java
index cfb3cb1de..af66a441a 100644
--- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/propertytester/TestResultSummaryPropertyTester.java
+++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/propertytester/TestResultSummaryPropertyTester.java
@@ -10,12 +10,8 @@
*******************************************************************************/
package org.eclipse.jubula.client.ui.propertytester;
-import javax.persistence.EntityManager;
-
import org.eclipse.jubula.client.core.model.ITestResultSummaryPO;
import org.eclipse.jubula.client.core.model.ITestResultSummaryPO.AlmReportStatus;
-import org.eclipse.jubula.client.core.persistence.GeneralStorage;
-import org.eclipse.jubula.client.core.persistence.TestResultPM;
import org.eclipse.jubula.client.core.propertytester.AbstractBooleanPropertyTester;
/**
@@ -45,21 +41,14 @@ public class TestResultSummaryPropertyTester
/** {@inheritDoc} */
public boolean testImpl(Object receiver, String property, Object[] args) {
- final GeneralStorage instance = GeneralStorage.getInstance();
- if (instance != null) {
- final EntityManager masterSession = instance.getMasterSession();
- if (masterSession.isOpen()) {
- ITestResultSummaryPO summary = (ITestResultSummaryPO) receiver;
- if (property.equals(HAS_MONITORING_DATA_PROP)) {
- return summary.isReportWritten();
- }
- if (property.equals(HAS_TEST_RESULT_DETAILS_PROP)) {
- return TestResultPM.hasTestResultDetails(masterSession,
- summary.getId());
- } else if (property.equals(HAS_PENDING_ALM_REPORT_PROP)) {
- return hasPendingALMReport(summary, masterSession);
- }
- }
+ ITestResultSummaryPO summary = (ITestResultSummaryPO) receiver;
+ if (property.equals(HAS_MONITORING_DATA_PROP)) {
+ return summary.isReportWritten();
+ }
+ if (property.equals(HAS_TEST_RESULT_DETAILS_PROP)) {
+ return summary.hasTestResultDetails();
+ } else if (property.equals(HAS_PENDING_ALM_REPORT_PROP)) {
+ return hasPendingALMReport(summary);
}
return false;
@@ -68,14 +57,11 @@ public class TestResultSummaryPropertyTester
/**
* @param summary
* the summary to check
- * @param session
- * the session to use
* @return the pending status
*/
- public static boolean hasPendingALMReport(ITestResultSummaryPO summary,
- final EntityManager session) {
+ public static boolean hasPendingALMReport(ITestResultSummaryPO summary) {
return summary.isTestsuiteRelevant()
- && TestResultPM.hasTestResultDetails(session, summary.getId())
+ && summary.hasTestResultDetails()
&& summary.getAlmReportStatus() == AlmReportStatus.NOT_YET_REPORTED;
}
diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/views/TestresultSummaryView.java b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/views/TestresultSummaryView.java
index 2e702168d..b178c1d9d 100644
--- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/views/TestresultSummaryView.java
+++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/views/TestresultSummaryView.java
@@ -54,9 +54,6 @@ import org.eclipse.jubula.client.core.model.ITestResultSummaryPO;
import org.eclipse.jubula.client.core.model.ITestResultSummaryPO.AlmReportStatus;
import org.eclipse.jubula.client.core.model.ProjectVersion;
import org.eclipse.jubula.client.core.model.TestResultNode;
-import org.eclipse.jubula.client.core.persistence.GeneralStorage;
-import org.eclipse.jubula.client.core.persistence.Persistor;
-import org.eclipse.jubula.client.core.persistence.TestResultPM;
import org.eclipse.jubula.client.core.persistence.TestResultSummaryPM;
import org.eclipse.jubula.client.core.utils.DatabaseStateDispatcher;
import org.eclipse.jubula.client.core.utils.DatabaseStateEvent;
@@ -383,9 +380,6 @@ public class TestresultSummaryView extends ViewPart implements
/** search string textfield for filter*/
private Text m_searchText;
- /** the list of summary ids that have details */
- private List<Number> m_detailedSummaryIds = new ArrayList<Number>();
-
/**
* <code>m_filterJob</code>
*/
@@ -584,9 +578,7 @@ public class TestresultSummaryView extends ViewPart implements
column.getColumn().setMoveable(true);
column.setLabelProvider(new TestresultSummaryViewColumnLabelProvider() {
public Image getImage(Object element) {
- String text = String.valueOf(m_detailedSummaryIds
- .contains(((ITestResultSummaryPO)element).getId()));
- if (text.equals(Boolean.TRUE.toString())) {
+ if (((ITestResultSummaryPO)element).hasTestResultDetails()) {
return IconConstants.TRSV_DETAILS;
}
return IconConstants.TRSV_NODETAILS;
@@ -600,10 +592,8 @@ public class TestresultSummaryView extends ViewPart implements
@Override
protected int doCompare(Viewer viewer, Object e1, Object e2) {
return getCommonsComparator().compare(
- m_detailedSummaryIds
- .contains(((ITestResultSummaryPO)e1).getId()),
- m_detailedSummaryIds
- .contains(((ITestResultSummaryPO)e2).getId()));
+ ((ITestResultSummaryPO)e1).hasTestResultDetails(),
+ ((ITestResultSummaryPO)e2).hasTestResultDetails());
}
};
}
@@ -889,12 +879,6 @@ public class TestresultSummaryView extends ViewPart implements
maxNoOfDays * -1);
metaList = TestResultSummaryPM
.findAllTestResultSummaries(startTime);
- if (Persistor.instance() != null) {
- m_detailedSummaryIds = TestResultPM
- .computeTestresultIdsWithDetails(
- GeneralStorage.getInstance()
- .getMasterSession());
- }
if (metaList != null) {
m_tableViewer.setInput(metaList.toArray());
@@ -2082,8 +2066,7 @@ public class TestresultSummaryView extends ViewPart implements
metaValue = String.valueOf(m.isTestsuiteRelevant());
} else if (m_filterType
.equals(TESTRESULT_SUMMARY_DETAILS_AVAILABLE)) {
- metaValue = String.valueOf(m_detailedSummaryIds.contains(m
- .getId()));
+ metaValue = String.valueOf(m.hasTestResultDetails());
} else if (m_filterType
.equals(TESTRESULT_SUMMARY_NUMBER_OF_FAILED_CAPS)) {
metaValue = String.valueOf(m.getTestsuiteFailedTeststeps());

Back to the top