From: Bruno Sinou Date: Fri, 11 Jan 2013 13:09:07 +0000 (+0000) Subject: Fix some minor bugs to enhance test processing and analysing X-Git-Tag: argeo-slc-2.1.7~485 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=a59b94ef7611d278b2ed1b60b51f15fcece52e4e;p=gpl%2Fargeo-slc.git Fix some minor bugs to enhance test processing and analysing git-svn-id: https://svn.argeo.org/slc/trunk@6018 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/SlcUiConstants.java b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/SlcUiConstants.java index 6fd862876..6aa176bfe 100644 --- a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/SlcUiConstants.java +++ b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/SlcUiConstants.java @@ -26,6 +26,5 @@ public interface SlcUiConstants { /* * MISCEALLENEOUS */ - public final static String DEFAULT_DISPLAY_DATE_FORMAT = "MM/dd/yy"; - public final static String DEFAULT_DISPLAY_DATE_TIME_FORMAT = "MM/dd/yyyy, HH:mm:ss"; + public final static String DEFAULT_DISPLAY_DATE_TIME_FORMAT = "yyyy-MM-dd, HH:mm:ss"; } diff --git a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java index e6f7a96c1..e71475648 100644 --- a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java +++ b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/decorators/ResultFailedDecorator.java @@ -23,6 +23,7 @@ import javax.jcr.RepositoryException; import org.argeo.slc.SlcException; import org.argeo.slc.client.ui.ClientUiPlugin; +import org.argeo.slc.client.ui.SlcUiConstants; import org.argeo.slc.client.ui.model.ResultParent; import org.argeo.slc.client.ui.model.SingleResultNode; import org.argeo.slc.jcr.SlcNames; @@ -41,7 +42,7 @@ public class ResultFailedDecorator extends LabelProvider implements // .getLog(ResultFailedDecorator.class); private final static DateFormat dateFormat = new SimpleDateFormat( - "yyyy-MM-dd HH:mm"); + SlcUiConstants.DEFAULT_DISPLAY_DATE_TIME_FORMAT); public ResultFailedDecorator() { super(); diff --git a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrResultTreeView.java b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrResultTreeView.java index 152e15c6e..8fcea20aa 100644 --- a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrResultTreeView.java +++ b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrResultTreeView.java @@ -15,6 +15,8 @@ */ package org.argeo.slc.client.ui.views; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; @@ -22,11 +24,8 @@ import java.util.List; import javax.jcr.Node; import javax.jcr.NodeIterator; import javax.jcr.Property; -import javax.jcr.PropertyIterator; -import javax.jcr.PropertyType; import javax.jcr.RepositoryException; import javax.jcr.Session; -import javax.jcr.Value; import javax.jcr.nodetype.NodeType; import javax.jcr.observation.Event; import javax.jcr.observation.EventListener; @@ -101,6 +100,9 @@ import org.eclipse.ui.part.ViewPart; public class JcrResultTreeView extends ViewPart { public final static String ID = ClientUiPlugin.ID + ".jcrResultTreeView"; + private final static DateFormat dateFormat = new SimpleDateFormat( + SlcUiConstants.DEFAULT_DISPLAY_DATE_TIME_FORMAT); + // private final static Log log = // LogFactory.getLog(JcrResultTreeView.class); @@ -259,11 +261,23 @@ public class JcrResultTreeView extends ViewPart { TableViewerColumn col = new TableViewerColumn(propertiesViewer, SWT.NONE); col.getColumn().setText("Name"); - col.getColumn().setWidth(200); + col.getColumn().setWidth(100); col.setLabelProvider(new ColumnLabelProvider() { public String getText(Object element) { try { - return ((Property) element).getName(); + String name = ((Property) element).getName(); + String value = null; + if (SlcNames.SLC_TEST_CASE.equals(name)) + value = "Test case"; + else if (SlcNames.SLC_COMPLETED.equals(name)) + value = "Completed on"; + else if (SlcNames.SLC_SUCCESS.equals(name)) + value = "Status"; + else if (SlcNames.SLC_MESSAGE.equals(name)) + value = "Message"; + else if (SlcNames.SLC_ERROR_MESSAGE.equals(name)) + value = "Error"; + return value; } catch (RepositoryException e) { throw new ArgeoException( "Unexpected exception in label provider", e); @@ -272,39 +286,33 @@ public class JcrResultTreeView extends ViewPart { }); col = new TableViewerColumn(propertiesViewer, SWT.NONE); col.getColumn().setText("Value"); - col.getColumn().setWidth(400); + col.getColumn().setWidth(200); col.setLabelProvider(new ColumnLabelProvider() { public String getText(Object element) { try { Property property = (Property) element; - if (property.getType() == PropertyType.BINARY) - return ""; - else if (property.isMultiple()) { - StringBuffer buf = new StringBuffer("["); - Value[] values = property.getValues(); - for (int i = 0; i < values.length; i++) { - if (i != 0) - buf.append(", "); - buf.append(values[i].getString()); + String name = property.getName(); + String value = null; + + if (SlcNames.SLC_TEST_CASE.equals(name) + || SlcNames.SLC_ERROR_MESSAGE.equals(name) + || SlcNames.SLC_MESSAGE.equals(name)) + value = property.getValue().getString(); + else if (SlcNames.SLC_COMPLETED.equals(name)) { + Calendar date = property.getValue().getDate(); + value = dateFormat.format(date.getTime()); + } else if (SlcNames.SLC_SUCCESS.equals(name)) { + if (property.getValue().getBoolean()) + value = "SUCCESS"; + else { + if (property.getParent().hasNode( + SlcNames.SLC_ERROR_MESSAGE)) + value = "ERROR"; + else + value = "FAILED"; } - buf.append(']'); - return buf.toString(); - } else - return property.getValue().getString(); - } catch (RepositoryException e) { - throw new ArgeoException( - "Unexpected exception in label provider", e); - } - } - }); - col = new TableViewerColumn(propertiesViewer, SWT.NONE); - col.getColumn().setText("Type"); - col.getColumn().setWidth(200); - col.setLabelProvider(new ColumnLabelProvider() { - public String getText(Object element) { - try { - return PropertyType.nameFromValue(((Property) element) - .getType()); + } + return value; } catch (RepositoryException e) { throw new ArgeoException( "Unexpected exception in label provider", e); @@ -777,14 +785,28 @@ public class JcrResultTreeView extends ViewPart { public Object[] getElements(Object inputElement) { try { if (inputElement instanceof Node) { - List props = new ArrayList(); - PropertyIterator pit = ((Node) inputElement) - .getProperties(); - while (pit.hasNext()) - props.add(pit.nextProperty()); - return props.toArray(); + Node node = (Node) inputElement; + if (node.isNodeType(SlcTypes.SLC_TEST_RESULT)) { + List props = new ArrayList(); + if (node.hasProperty(SlcNames.SLC_TEST_CASE)) + props.add(node.getProperty(SlcNames.SLC_TEST_CASE)); + if (node.hasProperty(SlcNames.SLC_COMPLETED)) + props.add(node.getProperty(SlcNames.SLC_COMPLETED)); + if (node.hasNode(SlcNames.SLC_STATUS)) { + Node status = node.getNode(SlcNames.SLC_STATUS); + props.add(status.getProperty(SlcNames.SLC_SUCCESS)); + if (status.hasProperty(SlcNames.SLC_MESSAGE)) + props.add(status + .getProperty(SlcNames.SLC_MESSAGE)); + if (status.hasProperty(SlcNames.SLC_ERROR_MESSAGE)) + props.add(status + .getProperty(SlcNames.SLC_ERROR_MESSAGE)); + } + return props.toArray(); + } } return new Object[] {}; + } catch (RepositoryException e) { throw new ArgeoException("Cannot get element for " + inputElement, e); diff --git a/runtime/org.argeo.slc.support.jcr/src/main/resources/org/argeo/slc/jcr/slc.cnd b/runtime/org.argeo.slc.support.jcr/src/main/resources/org/argeo/slc/jcr/slc.cnd index 96439ca60..92e81a4ef 100644 --- a/runtime/org.argeo.slc.support.jcr/src/main/resources/org/argeo/slc/jcr/slc.cnd +++ b/runtime/org.argeo.slc.support.jcr/src/main/resources/org/argeo/slc/jcr/slc.cnd @@ -99,6 +99,11 @@ mixin - slc:uuid (STRING) ! m - slc:testCase (STRING) - slc:completed (DATE) +// Added by the engine once the test has been fully processed. +// If the test is killed before it ends, this node is not created ++ slc:status (slc:check) +// DEPRECATED. This Node is now rather called slc:status (see above) +// Should be removed in Argeo 2. + slc:testStatus (slc:check) [slc:diffResult] > slc:testResult