chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1029053 - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/ chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chem...
Date Sat, 30 Oct 2010 13:00:58 GMT
Author: fmui
Date: Sat Oct 30 13:00:57 2010
New Revision: 1029053

URL: http://svn.apache.org/viewvc?rev=1029053&view=rev
Log:
- added TCK button to CMIS Workbench

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/tck.png
  (with props)
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/CmisTckAntTask.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/ConsoleRunner.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java?rev=1029053&r1=1029052&r2=1029053&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java
Sat Oct 30 13:00:57 2010
@@ -42,6 +42,7 @@ public abstract class AbstractRunner {
 
     private Map<String, String> parameters;
     private List<CmisTestGroup> groups = new ArrayList<CmisTestGroup>();
+    private boolean isCanceled = false;
 
     // --- parameters ---
 
@@ -113,7 +114,7 @@ public abstract class AbstractRunner {
 
     // --- groups ---
 
-    public void loadDefaultTCKGroups() throws Exception {
+    public void loadDefaultTckGroups() throws Exception {
         loadGroups(this.getClass().getResourceAsStream(DEFAULT_TCK_GROUPS));
     }
 
@@ -206,7 +207,13 @@ public abstract class AbstractRunner {
      * Runs all configured groups.
      */
     public void run(CmisTestProgressMonitor monitor) throws Exception {
+        isCanceled = false;
+
         for (CmisTestGroup group : groups) {
+            if (isCanceled) {
+                break;
+            }
+
             if ((group == null) || (!group.isEnabled())) {
                 continue;
             }
@@ -215,4 +222,12 @@ public abstract class AbstractRunner {
             group.run();
         }
     }
+
+    public synchronized boolean isCanceled() {
+        return isCanceled;
+    }
+
+    public synchronized void cancel() {
+        isCanceled = true;
+    }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/CmisTckAntTask.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/CmisTckAntTask.java?rev=1029053&r1=1029052&r2=1029053&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/CmisTckAntTask.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/CmisTckAntTask.java
Sat Oct 30 13:00:57 2010
@@ -82,7 +82,7 @@ public class CmisTckAntTask extends Task
             }
 
             if (groups == null) {
-                runner.loadDefaultTCKGroups();
+                runner.loadDefaultTckGroups();
             } else {
                 runner.loadGroups(groups);
             }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/ConsoleRunner.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/ConsoleRunner.java?rev=1029053&r1=1029052&r2=1029053&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/ConsoleRunner.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/ConsoleRunner.java
Sat Oct 30 13:00:57 2010
@@ -42,7 +42,7 @@ public class ConsoleRunner extends Abstr
         }
 
         if (args.length < 2) {
-            loadDefaultTCKGroups();
+            loadDefaultTckGroups();
         } else {
             loadGroups(new File(args[1]));
         }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java?rev=1029053&r1=1029052&r2=1029053&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java
Sat Oct 30 13:00:57 2010
@@ -31,7 +31,7 @@ public class BasicsTestGroup extends Abs
     public void init(Map<String, String> parameters) throws Exception {
         super.init(parameters);
 
-        setName("Basics");
+        setName("Basics Test Group");
 
         addTest(new RepositoryInfoTest());
         addTest(new RootFolderTest());

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.java?rev=1029053&r1=1029052&r2=1029053&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.java
Sat Oct 30 13:00:57 2010
@@ -39,7 +39,7 @@ public class RepositoryInfoTest extends 
     @Override
     public void init(Map<String, String> parameters) {
         super.init(parameters);
-        setName("Repository Info");
+        setName("Repository Info Test");
     }
 
     @Override

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.java?rev=1029053&r1=1029052&r2=1029053&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.java
Sat Oct 30 13:00:57 2010
@@ -42,7 +42,7 @@ public class TypesTest extends AbstractS
     @Override
     public void init(Map<String, String> parameters) {
         super.init(parameters);
-        setName("Types");
+        setName("Types Test");
     }
 
     @Override

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml?rev=1029053&r1=1029052&r2=1029053&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml
Sat Oct 30 13:00:57 2010
@@ -191,9 +191,14 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.chemistry.opencmis</groupId>
+            <groupId>${project.groupId}</groupId>
             <artifactId>chemistry-opencmis-client-impl</artifactId>
-            <version>0.2.0-incubating-SNAPSHOT</version>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>chemistry-opencmis-test-tck</artifactId>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.codehaus.groovy</groupId>

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java?rev=1029053&r1=1029052&r2=1029053&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java
Sat Oct 30 13:00:57 2010
@@ -68,10 +68,11 @@ public class ClientFrame extends JFrame 
     private static final int BUTTON_QUERY = 3;
     private static final int BUTTON_CHANGELOG = 4;
     private static final int BUTTON_CONSOLE = 5;
-    private static final int BUTTON_CREATE_DOCUMENT = 6;
-    private static final int BUTTON_CREATE_FOLDER = 7;
-    private static final int BUTTON_LOG = 8;
-    private static final int BUTTON_INFO = 9;
+    private static final int BUTTON_TCK = 6;
+    private static final int BUTTON_CREATE_DOCUMENT = 7;
+    private static final int BUTTON_CREATE_FOLDER = 8;
+    private static final int BUTTON_LOG = 9;
+    private static final int BUTTON_INFO = 10;
 
     private static final String PREFS_X = "x";
     private static final String PREFS_Y = "y";
@@ -125,7 +126,7 @@ public class ClientFrame extends JFrame 
 
         toolBar = new JToolBar("CMIS Toolbar", JToolBar.HORIZONTAL);
 
-        toolbarButton = new JButton[10];
+        toolbarButton = new JButton[11];
 
         toolbarButton[BUTTON_CONNECT] = new JButton("Connection", ClientHelper.getIcon("connect.png"));
         toolbarButton[BUTTON_CONNECT].addActionListener(new ActionListener() {
@@ -202,6 +203,16 @@ public class ClientFrame extends JFrame 
             toolbarConsolePopup.add(menuItem);
         }
 
+        toolbarButton[BUTTON_TCK] = new JButton("TCK", ClientHelper.getIcon("tck.png"));
+        toolbarButton[BUTTON_TCK].setEnabled(false);
+        toolbarButton[BUTTON_TCK].addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                new TckDialog(thisFrame, model);
+            }
+        });
+
+        toolBar.add(toolbarButton[BUTTON_TCK]);
+
         toolBar.addSeparator();
 
         toolbarButton[BUTTON_CREATE_DOCUMENT] = new JButton("Create Document", ClientHelper.getIcon("newdocument.png"));
@@ -290,6 +301,7 @@ public class ClientFrame extends JFrame 
                 toolbarButton[BUTTON_QUERY].setEnabled(model.supportsQuery());
                 toolbarButton[BUTTON_CHANGELOG].setEnabled(model.supportsChangeLog());
                 toolbarButton[BUTTON_CONSOLE].setEnabled(true);
+                toolbarButton[BUTTON_TCK].setEnabled(true);
                 toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(true);
                 toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(true);
 
@@ -300,6 +312,7 @@ public class ClientFrame extends JFrame 
                 toolbarButton[BUTTON_QUERY].setEnabled(false);
                 toolbarButton[BUTTON_CHANGELOG].setEnabled(false);
                 toolbarButton[BUTTON_CONSOLE].setEnabled(false);
+                toolbarButton[BUTTON_TCK].setEnabled(false);
                 toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(false);
                 toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(false);
 

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java?rev=1029053&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
Sat Oct 30 13:00:57 2010
@@ -0,0 +1,313 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.workbench;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Desktop;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.JTree;
+import javax.swing.SwingWorker;
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.tck.CmisTest;
+import org.apache.chemistry.opencmis.tck.CmisTestGroup;
+import org.apache.chemistry.opencmis.tck.CmisTestProgressMonitor;
+import org.apache.chemistry.opencmis.tck.report.HtmlReport;
+import org.apache.chemistry.opencmis.tck.runner.AbstractRunner;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+
+/**
+ * TCK dialog and runner.
+ */
+public class TckDialog {
+
+    private Frame owner;
+    private TckDialogRunner runner;
+
+    private JProgressBar groupsProgressBar;
+    private JProgressBar testsProgressBar;
+
+    public TckDialog(Frame owner, ClientModel model) {
+        this.owner = owner;
+        this.runner = new TckDialogRunner(model);
+
+        try {
+            runner.loadDefaultTckGroups();
+        } catch (Exception e) {
+            JOptionPane.showMessageDialog(owner, "Error: " + e.getMessage(), "TCK Error",
JOptionPane.ERROR_MESSAGE);
+            return;
+        }
+
+        JOptionPane.showMessageDialog(owner, "The TCK is brand new and incomplete. Don't
trust the results, yet!",
+                "TCK Warning", JOptionPane.WARNING_MESSAGE);
+
+        new TckSelectDialog();
+    }
+
+    private class TckSelectDialog extends JDialog {
+
+        private static final long serialVersionUID = 1L;
+
+        public TckSelectDialog() {
+            super(owner, "TCK", true);
+
+            createGUI();
+        }
+
+        private void createGUI() {
+            setPreferredSize(new Dimension(300, 500));
+            setMinimumSize(new Dimension(300, 500));
+
+            setLayout(new BorderLayout());
+
+            DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Groups");
+
+            for (CmisTestGroup group : runner.getGroups()) {
+                DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(group.getName());
+                rootNode.add(groupNode);
+                for (CmisTest test : group.getTests()) {
+                    DefaultMutableTreeNode testNode = new DefaultMutableTreeNode(test.getName());
+                    groupNode.add(testNode);
+                }
+            }
+
+            JTree groupTree = new JTree(rootNode);
+            groupTree.setRootVisible(false);
+
+            for (int i = 0; i < groupTree.getRowCount(); i++) {
+                groupTree.expandRow(i);
+            }
+
+            add(groupTree, BorderLayout.CENTER);
+
+            JButton runButton = new JButton("Run TCK");
+            runButton.setDefaultCapable(true);
+            runButton.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    int answer = JOptionPane.showConfirmDialog(owner,
+                            "Running the TCK may take a long time and may add, remove and
alter data in the repository!\n"
+                                    + "It also puts at a strain on the repository, performing
several hundred calls!\n"
+                                    + "\nAre you sure you want to proceed?", "TCK", JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE);
+
+                    if (answer == JOptionPane.YES_OPTION) {
+                        dispose();
+                        new TckRunDialog();
+                    }
+                }
+            });
+
+            add(runButton, BorderLayout.PAGE_END);
+
+            setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+            pack();
+            setLocationRelativeTo(null);
+            setVisible(true);
+        }
+    }
+
+    private class TckRunDialog extends JDialog {
+
+        private static final long serialVersionUID = 1L;
+
+        private TckTask task;
+
+        public TckRunDialog() {
+            super(owner, "TCK");
+
+            createGUI();
+
+            task = new TckTask(this, runner);
+            task.execute();
+        }
+
+        private void createGUI() {
+            setPreferredSize(new Dimension(500, 200));
+            setMinimumSize(new Dimension(500, 200));
+
+            setLayout(new BorderLayout());
+
+            JPanel progressPanel = new JPanel();
+            progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.Y_AXIS));
+            progressPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+
+            progressPanel.add(Box.createRigidArea(new Dimension(0, 10)));
+
+            JLabel groupsLabel = new JLabel("Groups:");
+            groupsLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
+            progressPanel.add(groupsLabel);
+
+            groupsProgressBar = new JProgressBar();
+            groupsProgressBar.setMinimumSize(new Dimension(500, 30));
+            groupsProgressBar.setPreferredSize(new Dimension(500, 30));
+            groupsProgressBar.setMaximumSize(new Dimension(Short.MAX_VALUE, 30));
+            groupsProgressBar.setAlignmentX(Component.LEFT_ALIGNMENT);
+            groupsProgressBar.setAlignmentY(Component.CENTER_ALIGNMENT);
+            progressPanel.add(groupsProgressBar);
+
+            progressPanel.add(Box.createRigidArea(new Dimension(0, 10)));
+
+            JLabel testsLabel = new JLabel("Tests:");
+            testsLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
+            progressPanel.add(testsLabel);
+
+            testsProgressBar = new JProgressBar();
+            testsProgressBar.setMinimumSize(new Dimension(500, 30));
+            testsProgressBar.setPreferredSize(new Dimension(500, 30));
+            testsProgressBar.setMaximumSize(new Dimension(Short.MAX_VALUE, 30));
+            testsProgressBar.setAlignmentX(Component.LEFT_ALIGNMENT);
+            testsProgressBar.setAlignmentY(Component.CENTER_ALIGNMENT);
+            progressPanel.add(testsProgressBar);
+
+            progressPanel.add(Box.createRigidArea(new Dimension(0, 10)));
+
+            add(progressPanel, BorderLayout.CENTER);
+
+            JButton cancelButton = new JButton("Cancel");
+            cancelButton.setDefaultCapable(true);
+            cancelButton.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    task.cancel(true);
+                }
+            });
+
+            add(cancelButton, BorderLayout.PAGE_END);
+
+            setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+            pack();
+            setLocationRelativeTo(null);
+            setVisible(true);
+        }
+    }
+
+    private class TckDialogRunner extends AbstractRunner {
+        public TckDialogRunner(ClientModel model) {
+            Map<String, String> parameters = new HashMap<String, String>(model.getClientSession()
+                    .getSessionParameters());
+            parameters.put(SessionParameter.REPOSITORY_ID, model.getClientSession().getSession().getRepositoryInfo()
+                    .getId());
+
+            setParameters(parameters);
+        }
+    }
+
+    private class DialogProgressMonitor implements CmisTestProgressMonitor {
+
+        public DialogProgressMonitor(int numberOfGroups) {
+            groupsProgressBar.setStringPainted(true);
+            groupsProgressBar.setMinimum(0);
+            groupsProgressBar.setMaximum(numberOfGroups);
+            groupsProgressBar.setValue(0);
+        }
+
+        public void startGroup(CmisTestGroup group) {
+            groupsProgressBar.setString(group.getName());
+
+            testsProgressBar.setStringPainted(true);
+            testsProgressBar.setMinimum(0);
+            testsProgressBar.setMaximum(group.getTests().size());
+            testsProgressBar.setValue(0);
+        }
+
+        public void endGroup(CmisTestGroup group) {
+            groupsProgressBar.setString("");
+            groupsProgressBar.setValue(testsProgressBar.getValue() + 1);
+        }
+
+        public void startTest(CmisTest test) {
+            testsProgressBar.setString(test.getName());
+        }
+
+        public void endTest(CmisTest test) {
+            testsProgressBar.setString("");
+            testsProgressBar.setValue(testsProgressBar.getValue() + 1);
+        }
+
+        public void message(String msg) {
+        }
+    }
+
+    class TckTask extends SwingWorker<Void, Void> {
+        private JDialog dialog;
+        private TckDialogRunner runner;
+
+        public TckTask(JDialog dialog, TckDialogRunner runner) {
+            this.dialog = dialog;
+            this.runner = runner;
+        }
+
+        @Override
+        public Void doInBackground() {
+            try {
+                runner.run(new DialogProgressMonitor(runner.getGroups().size()));
+            } catch (InterruptedException ie) {
+                runner.cancel();
+            } catch (Exception e) {
+                JOptionPane
+                        .showMessageDialog(owner, "Error: " + e.getMessage(), "TCK Error",
JOptionPane.ERROR_MESSAGE);
+            }
+
+            return null;
+        }
+
+        @Override
+        public void done() {
+            try {
+                // create report
+                File tempReportFile = File.createTempFile("cmistck", ".html");
+                tempReportFile.deleteOnExit();
+
+                HtmlReport report = new HtmlReport();
+                report.createReport(runner.getParameters(), runner.getGroups(), tempReportFile);
+
+                // show report
+                Desktop desktop = Desktop.getDesktop();
+                if (!desktop.isSupported(Desktop.Action.OPEN)) {
+                    JOptionPane.showMessageDialog(owner, "Report: " + tempReportFile.getAbsolutePath(),
"Report",
+                            JOptionPane.INFORMATION_MESSAGE);
+                } else {
+                    desktop.open(tempReportFile);
+                }
+            } catch (Exception e) {
+                JOptionPane.showMessageDialog(owner, "Error: " + e.getMessage(), "Report
Error",
+                        JOptionPane.ERROR_MESSAGE);
+            } finally {
+                dialog.dispose();
+            }
+        }
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java?rev=1029053&r1=1029052&r2=1029053&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
Sat Oct 30 13:00:57 2010
@@ -20,6 +20,7 @@ package org.apache.chemistry.opencmis.wo
 
 import java.net.Authenticator;
 import java.security.cert.X509Certificate;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -157,6 +158,10 @@ public class ClientSession {
         return session;
     }
 
+    public Map<String, String> getSessionParameters() {
+        return Collections.unmodifiableMap(sessionParameters);
+    }
+
     public OperationContext getObjectOperationContext() {
         return objectOperationContext;
     }

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/tck.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/tck.png?rev=1029053&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/tck.png
------------------------------------------------------------------------------
    svn:mime-type = image/png



Mime
View raw message