chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1028010 [2/2] - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-test/chemistry-opencmis-test-tck/ chemistry-opencmis-test/chemistry-opencmis-test-tck/src/ chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/ chemistry-o...
Date Wed, 27 Oct 2010 15:43:25 GMT
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/report/XmlReport.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/report/XmlReport.java?rev=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/report/XmlReport.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/report/XmlReport.java Wed Oct 27 15:43:24 2010
@@ -0,0 +1,129 @@
+/*
+ * 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.tck.report;
+
+import java.io.Writer;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.chemistry.opencmis.tck.CmisTest;
+import org.apache.chemistry.opencmis.tck.CmisTestGroup;
+import org.apache.chemistry.opencmis.tck.CmisTestResult;
+
+/**
+ * XML Report.
+ */
+public class XmlReport extends AbstractCmisTestReport {
+    private static final String TAG_REPORT = "report";
+    private static final String TAG_PARAMETERS = "parameters";
+    private static final String TAG_PARAMETER = "parameter";
+    private static final String TAG_GROUP = "group";
+    private static final String TAG_TEST = "test";
+    private static final String TAG_RESULT = "result";
+
+    private static final String ATTR_KEY = "key";
+    private static final String ATTR_VALUE = "value";
+    private static final String ATTR_NAME = "name";
+    private static final String ATTR_TIME = "time";
+    private static final String ATTR_STATUS = "status";
+    private static final String ATTR_MESSAGE = "message";
+
+    public XmlReport() {
+    }
+
+    @Override
+    public void createReport(Map<String, String> parameters, List<CmisTestGroup> groups, Writer writer)
+            throws Exception {
+        XMLOutputFactory factory = XMLOutputFactory.newInstance();
+        XMLStreamWriter xml = factory.createXMLStreamWriter(writer);
+
+        // start doc
+        xml.writeStartDocument();
+
+        xml.writeStartElement(TAG_REPORT);
+
+        if (parameters != null) {
+            xml.writeStartElement(TAG_PARAMETERS);
+
+            for (Map.Entry<String, String> p : (new TreeMap<String, String>(parameters)).entrySet()) {
+                xml.writeStartElement(TAG_PARAMETER);
+                xml.writeAttribute(ATTR_KEY, p.getKey());
+                xml.writeAttribute(ATTR_VALUE, p.getValue());
+                xml.writeEndElement();
+            }
+
+            xml.writeEndElement();
+        }
+
+        if (groups != null) {
+            for (CmisTestGroup group : groups) {
+                printGroupResults(group, xml);
+            }
+        }
+
+        xml.writeEndElement();
+
+        // end document
+        xml.writeEndDocument();
+        xml.flush();
+    }
+
+    private void printGroupResults(CmisTestGroup group, XMLStreamWriter xml) throws Exception {
+        xml.writeStartElement(TAG_GROUP);
+        xml.writeAttribute(ATTR_NAME, group.getName());
+
+        if (group.getTests() != null) {
+            for (CmisTest test : group.getTests()) {
+                printTestResults(test, xml);
+            }
+        }
+
+        xml.writeEndElement();
+    }
+
+    private void printTestResults(CmisTest test, XMLStreamWriter xml) throws Exception {
+        xml.writeStartElement(TAG_TEST);
+        xml.writeAttribute(ATTR_NAME, test.getName());
+        xml.writeAttribute(ATTR_TIME, "" + test.getTime());
+
+        if (test.getResults() != null) {
+            for (CmisTestResult result : test.getResults()) {
+                printResult(result, xml);
+            }
+        }
+
+        xml.writeEndElement();
+    }
+
+    private void printResult(CmisTestResult result, XMLStreamWriter xml) throws Exception {
+        xml.writeStartElement(TAG_RESULT);
+        xml.writeAttribute(ATTR_STATUS, result.getStatus().toString());
+        xml.writeAttribute(ATTR_MESSAGE, result.getMessage());
+
+        for (CmisTestResult child : result.getChildren()) {
+            printResult(child, xml);
+        }
+
+        xml.writeEndElement();
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/report/XmlReport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java Wed Oct 27 15:43:24 2010
@@ -0,0 +1,218 @@
+/*
+ * 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.tck.runner;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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.impl.WrapperCmisTestGroup;
+
+/**
+ * Base class for runners.
+ */
+public abstract class AbstractRunner {
+    public static final String OVERRIDE_KEY = "org.apache.chemistry";
+    public static final String DEFAULT_TCK_GROUPS = "/cmis-tck-groups.txt";
+
+    private Map<String, String> parameters;
+    private List<CmisTestGroup> groups = new ArrayList<CmisTestGroup>();
+
+    // --- parameters ---
+
+    public void setParameters(Map<String, String> orgParameters) {
+        this.parameters = new HashMap<String, String>();
+        if (orgParameters != null) {
+            this.parameters.putAll(orgParameters);
+        }
+
+        // override with system properties
+        for (String key : System.getProperties().stringPropertyNames()) {
+            if (!key.startsWith(OVERRIDE_KEY)) {
+                continue;
+            }
+
+            parameters.put(key, System.getProperties().getProperty(key));
+        }
+
+    }
+
+    public void loadParameters(File file) throws Exception {
+        if ((file == null) || (!file.isFile())) {
+            throw new IllegalArgumentException("File not found!");
+        }
+
+        loadParameters(new FileInputStream(file));
+    }
+
+    public void loadParameters(InputStream stream) throws Exception {
+        if (stream == null) {
+            throw new IllegalArgumentException("Stream is null!");
+        }
+
+        BufferedReader reader = null;
+        Map<String, String> loadParams = new HashMap<String, String>();
+
+        try {
+            reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
+
+            String line;
+            while ((line = reader.readLine()) != null) {
+                line = line.trim();
+                if (line.startsWith("#") || (line.length() == 0)) {
+                    continue;
+                }
+
+                int x = line.indexOf('=');
+                if (x < 0) {
+                    loadParams.put(line.trim(), "");
+                } else {
+                    loadParams.put(line.substring(0, x).trim(), line.substring(x + 1).trim());
+                }
+            }
+
+            setParameters(loadParams);
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (Exception e) {
+                }
+            }
+        }
+    }
+
+    public Map<String, String> getParameters() {
+        return parameters;
+    }
+
+    // --- groups ---
+
+    public void loadDefaultTCKGroups() throws Exception {
+        loadGroups(this.getClass().getResourceAsStream(DEFAULT_TCK_GROUPS));
+    }
+
+    public void loadGroups(File file) throws Exception {
+        if ((file == null) || (!file.isFile())) {
+            throw new IllegalArgumentException("File not found!");
+        }
+
+        loadGroups(new FileInputStream(file));
+    }
+
+    public void loadGroups(InputStream stream) throws Exception {
+        if (stream == null) {
+            throw new IllegalArgumentException("Stream is null!");
+        }
+
+        BufferedReader reader = null;
+
+        try {
+            reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
+
+            String line;
+            while ((line = reader.readLine()) != null) {
+                line = line.trim();
+                if (line.startsWith("#") || (line.length() == 0)) {
+                    continue;
+                }
+
+                addGroup(line);
+            }
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (Exception e) {
+                }
+            }
+        }
+    }
+
+    public void addGroups(String[] groupClasses) throws Exception {
+        if (groupClasses == null) {
+            return;
+        }
+
+        for (String groupClass : groupClasses) {
+            addGroup(groupClass);
+        }
+    }
+
+    public void addGroup(String groupClass) throws Exception {
+        if (groupClass == null) {
+            return;
+        }
+
+        groupClass = groupClass.trim();
+        if (groupClass.length() == 0) {
+            return;
+        }
+
+        Class<?> clazz = Class.forName(groupClass);
+        Object o = clazz.newInstance();
+        CmisTestGroup group = null;
+
+        if (o instanceof CmisTestGroup) {
+            group = (CmisTestGroup) o;
+        } else if (o instanceof CmisTest) {
+            group = new WrapperCmisTestGroup((CmisTest) o);
+        } else {
+            throw new Exception("Not a CmisTestGroup or CmisTest class!");
+        }
+
+        group.init(parameters);
+        addGroup(group);
+    }
+
+    public void addGroup(CmisTestGroup group) {
+        if (group != null) {
+            groups.add(group);
+        }
+    }
+
+    public List<CmisTestGroup> getGroups() {
+        return groups;
+    }
+
+    // --- run ---
+
+    /**
+     * Runs all configured groups.
+     */
+    public void run(CmisTestProgressMonitor monitor) throws Exception {
+        for (CmisTestGroup group : groups) {
+            if ((group == null) || (!group.isEnabled())) {
+                continue;
+            }
+
+            group.setProgressMonitor(monitor);
+            group.run();
+        }
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/CmisTckAntTask.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/CmisTckAntTask.java Wed Oct 27 15:43:24 2010
@@ -0,0 +1,151 @@
+/*
+ * 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.tck.runner;
+
+import java.io.File;
+
+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.CmisTestReport;
+import org.apache.chemistry.opencmis.tck.report.HtmlReport;
+import org.apache.chemistry.opencmis.tck.report.TextReport;
+import org.apache.chemistry.opencmis.tck.report.XmlReport;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * CMIS TCK Ant Task.
+ */
+public class CmisTckAntTask extends Task {
+    private final static String REPORT_TEXT = "text";
+    private final static String REPORT_XML = "xml";
+    private final static String REPORT_HTML = "html";
+
+    private final static String DEFAULT_REPORT_NAME = "cmis-tck-report";
+
+    private File parameters;
+    private File groups;
+    private File output;
+    private String format;
+
+    @Override
+    public void init() throws BuildException {
+        super.init();
+        parameters = null;
+        groups = null;
+        output = null;
+        format = REPORT_TEXT;
+    }
+
+    public void setParameters(File parameters) {
+        this.parameters = parameters;
+    }
+
+    public void setGroups(File groups) {
+        this.groups = groups;
+    }
+
+    public void setOutput(File output) {
+        this.output = output;
+    }
+
+    public void setFormat(String format) {
+        this.format = format;
+    }
+
+    @Override
+    public void execute() throws BuildException {
+        try {
+            AntRunner runner = new AntRunner();
+
+            if (parameters == null) {
+                runner.setParameters(null);
+            } else {
+                runner.loadParameters(parameters);
+            }
+
+            if (groups == null) {
+                runner.loadDefaultTCKGroups();
+            } else {
+                runner.loadGroups(groups);
+            }
+
+            CmisTestReport report = null;
+
+            if (format == null) {
+                report = new TextReport();
+                if (output == null) {
+                    output = new File(DEFAULT_REPORT_NAME + ".txt");
+                }
+            } else {
+                format = format.trim().toLowerCase();
+                if (REPORT_TEXT.equals(format)) {
+                    report = new TextReport();
+                    if (output == null) {
+                        output = new File(DEFAULT_REPORT_NAME + ".txt");
+                    }
+                } else if (REPORT_XML.equals(format)) {
+                    report = new XmlReport();
+                    if (output == null) {
+                        output = new File(DEFAULT_REPORT_NAME + ".xml");
+                    }
+                } else if (REPORT_HTML.equals(format)) {
+                    report = new HtmlReport();
+                    if (output == null) {
+                        output = new File(DEFAULT_REPORT_NAME + ".html");
+                    }
+                } else {
+                    throw new Exception("Unknown format!");
+                }
+            }
+
+            runner.run(new AntProgressMonitor());
+
+            log("CMIS TCK Report: " + output.getAbsolutePath());
+            report.createReport(runner.getParameters(), runner.getGroups(), output);
+        } catch (Exception e) {
+            throw new BuildException("OpenCMIS TCK run failed!", e);
+        }
+    }
+
+    private class AntRunner extends AbstractRunner {
+
+    }
+
+    private class AntProgressMonitor implements CmisTestProgressMonitor {
+        public void startGroup(CmisTestGroup group) {
+            log(group.getName() + " (" + group.getTests().size() + " tests)");
+        }
+
+        public void endGroup(CmisTestGroup group) {
+        }
+
+        public void startTest(CmisTest test) {
+            log("  " + test.getName());
+        }
+
+        public void endTest(CmisTest test) {
+        }
+
+        public void message(String msg) {
+            log(msg);
+        }
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/CmisTckAntTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/ConsoleRunner.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/ConsoleRunner.java Wed Oct 27 15:43:24 2010
@@ -0,0 +1,80 @@
+/*
+ * 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.tck.runner;
+
+import java.io.File;
+import java.io.PrintWriter;
+
+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.CmisTestReport;
+import org.apache.chemistry.opencmis.tck.report.TextReport;
+
+/**
+ * Console Runner.
+ * 
+ * This runner can be started for a console and accepts two parameters: OpenCMIS
+ * Session parameters file name and group list file name.
+ */
+public class ConsoleRunner extends AbstractRunner {
+    public ConsoleRunner(String[] args) throws Exception {
+        if (args.length < 1) {
+            setParameters(null);
+        } else {
+            loadParameters(new File(args[0]));
+        }
+
+        if (args.length < 2) {
+            loadDefaultTCKGroups();
+        } else {
+            loadGroups(new File(args[1]));
+        }
+
+        run(new ConsoleProgressMonitor());
+
+        CmisTestReport report = new TextReport();
+        report.createReport(getParameters(), getGroups(), new PrintWriter(System.out));
+    }
+
+    private static class ConsoleProgressMonitor implements CmisTestProgressMonitor {
+        public void startGroup(CmisTestGroup group) {
+            System.out.println(group.getName() + " (" + group.getTests().size() + " tests)");
+        }
+
+        public void endGroup(CmisTestGroup group) {
+            System.out.println();
+        }
+
+        public void startTest(CmisTest test) {
+            System.out.print(".");
+        }
+
+        public void endTest(CmisTest test) {
+        }
+
+        public void message(String msg) {
+            System.out.println(msg);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        new ConsoleRunner(args);
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/ConsoleRunner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java Wed Oct 27 15:43:24 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.tck.tests.basics;
+
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTestGroup;
+
+/**
+ * This test group contains tests that check the CMIS basics such the repository
+ * info or types.
+ */
+public class BasicsTestGroup extends AbstractSessionTestGroup {
+    @Override
+    public void init(Map<String, String> parameters) throws Exception {
+        super.init(parameters);
+
+        setName("Basics");
+
+        addTest(new RepositoryInfoTest());
+        addTest(new RootFolderTest());
+        addTest(new TypesTest());
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/BasicsTestGroup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.java Wed Oct 27 15:43:24 2010
@@ -0,0 +1,266 @@
+/*
+ * 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.tck.tests.basics;
+
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.OK;
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.WARNING;
+
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.commons.data.AclCapabilities;
+import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.definitions.PermissionDefinition;
+import org.apache.chemistry.opencmis.tck.CmisTestResult;
+import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+
+/**
+ * Repository info test.
+ */
+public class RepositoryInfoTest extends AbstractSessionTest {
+    @Override
+    public void init(Map<String, String> parameters) {
+        super.init(parameters);
+        setName("Repository Info");
+    }
+
+    @Override
+    public void run(Session session) {
+        CmisTestResult success;
+        CmisTestResult failure;
+
+        RepositoryInfo ri = getRepositoryInfo(session);
+
+        // id
+        success = createResult(OK, "Repository id: " + ri.getId());
+        failure = createResult(FAILURE, "Repository id is not set!", true);
+        addResult(assertStringNotEmpty(ri.getId(), success, failure));
+
+        // name
+        failure = createResult(FAILURE, "Repository name is not set!");
+        addResult(assertNotNull(ri.getName(), null, failure));
+
+        success = createResult(OK, "Repository name: " + ri.getName());
+        failure = createResult(WARNING, "Repository name is empty!");
+        addResult(assertStringNotEmpty(ri.getName(), success, failure));
+
+        // description
+        failure = createResult(FAILURE, "Repository description is not set!");
+        addResult(assertNotNull(ri.getDescription(), null, failure));
+
+        success = createResult(OK, "Repository description: " + ri.getDescription());
+        failure = createResult(WARNING, "Repository description is empty!");
+        addResult(assertStringNotEmpty(ri.getDescription(), success, failure));
+
+        // vendor
+        failure = createResult(FAILURE, "Vendor name is not set!");
+        addResult(assertStringNotEmpty(ri.getVendorName(), null, failure));
+
+        success = createResult(OK, "Vendor name: " + ri.getVendorName());
+        failure = createResult(WARNING, "Vendor name is empty!");
+        addResult(assertStringNotEmpty(ri.getVendorName(), success, failure));
+
+        // product name
+        failure = createResult(FAILURE, "Product name is not set!");
+        addResult(assertStringNotEmpty(ri.getProductName(), null, failure));
+
+        success = createResult(OK, "Product name: " + ri.getProductName());
+        failure = createResult(WARNING, "Product name is empty!");
+        addResult(assertStringNotEmpty(ri.getProductName(), success, failure));
+
+        // product version
+        failure = createResult(FAILURE, "Product version is not set!");
+        addResult(assertStringNotEmpty(ri.getProductVersion(), null, failure));
+
+        success = createResult(OK, "Product version: " + ri.getProductVersion());
+        failure = createResult(WARNING, "Product version is empty!");
+        addResult(assertStringNotEmpty(ri.getProductVersion(), success, failure));
+
+        // CMIS version supported
+        success = createResult(OK, "CMIS Version Supported: " + ri.getCmisVersionSupported());
+        failure = createResult(FAILURE, "CMIS Version Supported is not set!");
+        addResult(assertStringNotEmpty(ri.getCmisVersionSupported(), success, failure));
+
+        failure = createResult(FAILURE, "CMIS Version Supported is not '1.0'!");
+        addResult(assertEquals("1.0", ri.getCmisVersionSupported(), null, failure));
+
+        // root folder
+        success = createResult(OK, "Root folder id: " + ri.getRootFolderId());
+        failure = createResult(FAILURE, "Root folder id is not set!");
+        addResult(assertStringNotEmpty(ri.getRootFolderId(), success, failure));
+
+        // thin client uri
+        success = createResult(OK, "Thin client URI: " + ri.getThinClientUri());
+        failure = createResult(WARNING, "Thin client URI is not set!");
+        addResult(assertStringNotEmpty(ri.getThinClientUri(), success, failure));
+
+        // principal id anonymous
+        success = createResult(OK, "Principal Id anonymous: " + ri.getPrincipalIdAnonymous());
+        failure = createResult(WARNING, "Principal Id anonymous is not set!");
+        addResult(assertStringNotEmpty(ri.getPrincipalIdAnonymous(), success, failure));
+
+        // principal id anyone
+        success = createResult(OK, "Principal Id anyone: " + ri.getPrincipalIdAnyone());
+        failure = createResult(WARNING, "Principal Id anyone is not set!");
+        addResult(assertStringNotEmpty(ri.getPrincipalIdAnyone(), success, failure));
+
+        // latest change log token
+        success = createResult(OK, "Latest change log token: " + ri.getLatestChangeLogToken());
+        failure = createResult(WARNING, "Latest change log token is not set!");
+        addResult(assertStringNotEmpty(ri.getLatestChangeLogToken(), success, failure));
+
+        // changes incomplete
+        success = createResult(OK, "Changes Incomplete: " + ri.getChangesIncomplete());
+        failure = createResult(WARNING, "Changes Incomplete is not set!");
+        addResult(assertNotNull(ri.getChangesIncomplete(), success, failure));
+
+        // changes on type
+        success = createResult(OK, "Changes on type: " + ri.getChangesOnType());
+        failure = createResult(WARNING, "Changes on type is not set!");
+        addResult(assertNotNull(ri.getChangesOnType(), success, failure));
+
+        if (ri.getChangesOnType() != null) {
+            failure = createResult(WARNING, "Changes on type has more than 4 entries!");
+            addResult(assertIsTrue(ri.getChangesOnType().size() < 5, null, failure));
+        }
+
+        // capabilities
+        if (ri.getCapabilities() == null) {
+            addResult(createResult(FAILURE, "Capabilities are not set!"));
+        } else {
+            RepositoryCapabilities cap = ri.getCapabilities();
+
+            // ACL capability
+            success = createResult(OK, "ACL capability: " + cap.getAclCapability());
+            failure = createResult(FAILURE, "ACL capability is not set!");
+            addResult(assertNotNull(cap.getAclCapability(), success, failure));
+
+            // changes capability
+            success = createResult(OK, "Changes capability: " + cap.getChangesCapability());
+            failure = createResult(WARNING, "Changes capability is not set!");
+            addResult(assertNotNull(cap.getChangesCapability(), success, failure));
+
+            // content stream updates capability
+            success = createResult(OK, "Content stream updates capability: " + cap.getContentStreamUpdatesCapability());
+            failure = createResult(FAILURE, "Content stream updates is not set!");
+            addResult(assertNotNull(cap.getContentStreamUpdatesCapability(), success, failure));
+
+            // get descendants capability
+            success = createResult(OK, "Get descendants capability: " + cap.isGetDescendantsSupported());
+            failure = createResult(FAILURE, "Get descendants capability is not set!");
+            addResult(assertNotNull(cap.isGetDescendantsSupported(), success, failure));
+
+            // get folder tree capability
+            success = createResult(OK, "Get folder tree capability: " + cap.isGetFolderTreeSupported());
+            failure = createResult(FAILURE, "Get folder tree capability is not set!");
+            addResult(assertNotNull(cap.isGetFolderTreeSupported(), success, failure));
+
+            // multifiling capability
+            success = createResult(OK, "Multifiling capability: " + cap.isMultifilingSupported());
+            failure = createResult(FAILURE, "Multifiling capability is not set!");
+            addResult(assertNotNull(cap.isMultifilingSupported(), success, failure));
+
+            // unfiling capability
+            success = createResult(OK, "Unfiling capability: " + cap.isUnfilingSupported());
+            failure = createResult(FAILURE, "Unfiling capability is not set!");
+            addResult(assertNotNull(cap.isUnfilingSupported(), success, failure));
+
+            // version specific filing capability
+            success = createResult(OK, "Version specific filing capability: " + cap.isVersionSpecificFilingSupported());
+            failure = createResult(FAILURE, "Version specific filing capability is not set!");
+            addResult(assertNotNull(cap.isVersionSpecificFilingSupported(), success, failure));
+
+            // query capability
+            success = createResult(OK, "Query capability: " + cap.getQueryCapability());
+            failure = createResult(FAILURE, "Query capability is not set!");
+            addResult(assertNotNull(cap.getQueryCapability(), success, failure));
+
+            // JOIN capability
+            success = createResult(OK, "JOIN capability: " + cap.getJoinCapability());
+            failure = createResult(FAILURE, "JOIN capability is not set!");
+            addResult(assertNotNull(cap.getJoinCapability(), success, failure));
+
+            // all versions searchable capability
+            success = createResult(OK, "All versions searchable capability: " + cap.isAllVersionsSearchableSupported());
+            failure = createResult(FAILURE, "All versions searchable capability is not set!");
+            addResult(assertNotNull(cap.isAllVersionsSearchableSupported(), success, failure));
+
+            // PWC searchable capability
+            success = createResult(OK, "PWC searchable capability: " + cap.isPwcSearchableSupported());
+            failure = createResult(FAILURE, "PWC searchable capability is not set!");
+            addResult(assertNotNull(cap.isPwcSearchableSupported(), success, failure));
+
+            // PWC updatable capability
+            success = createResult(OK, "PWC updatable capability: " + cap.isPwcUpdatableSupported());
+            failure = createResult(FAILURE, "PWC updatable capability is not set!");
+            addResult(assertNotNull(cap.isPwcUpdatableSupported(), success, failure));
+
+            // renditions capability
+            success = createResult(OK, "Renditions capability: " + cap.getRenditionsCapability());
+            failure = createResult(FAILURE, "Renditions capability is not set!");
+            addResult(assertNotNull(cap.getRenditionsCapability(), success, failure));
+        }
+
+        // ACL capabilities
+        if (ri.getAclCapabilities() == null) {
+            addResult(createResult(WARNING, "ACL capabilities are not set!"));
+        } else {
+            AclCapabilities aclCap = ri.getAclCapabilities();
+
+            // supported permissions
+            success = createResult(OK, "Supported permissions: " + aclCap.getSupportedPermissions());
+            failure = createResult(WARNING, "Supported permissions are not set!");
+            addResult(assertNotNull(aclCap.getSupportedPermissions(), success, failure));
+
+            // ACL propagation
+            success = createResult(OK, "ACL propagation: " + aclCap.getAclPropagation());
+            failure = createResult(WARNING, "ACL propagation is not set!");
+            addResult(assertNotNull(aclCap.getAclPropagation(), success, failure));
+
+            // permissions
+            success = createResult(OK, "Permissions: "
+                    + (aclCap.getPermissions() == null ? "?" : aclCap.getPermissions().size()));
+            failure = createResult(FAILURE, "Permissions are not set!");
+            addResult(assertNotNull(aclCap.getPermissions(), success, failure));
+
+            if (aclCap.getPermissions() != null) {
+                int i = 0;
+                for (PermissionDefinition permDef : aclCap.getPermissions()) {
+                    failure = createResult(FAILURE, "Permission #" + i + " is not set!");
+                    addResult(assertNotNull(permDef, null, failure));
+
+                    if (permDef != null) {
+                        failure = createResult(FAILURE, "Id of permission #" + i + " is not set!");
+                        addResult(assertStringNotEmpty(permDef.getId(), null, failure));
+                    }
+
+                    i++;
+                }
+            }
+
+            // permission mapping
+            success = createResult(OK, "Permission mapping: "
+                    + (aclCap.getPermissionMapping() == null ? "?" : aclCap.getPermissionMapping().size()));
+            failure = createResult(WARNING, "Permission mapping is not set!");
+            addResult(assertNotNull(aclCap.getPermissionMapping(), success, failure));
+        }
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RootFolderTest.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/RootFolderTest.java?rev=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RootFolderTest.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RootFolderTest.java Wed Oct 27 15:43:24 2010
@@ -0,0 +1,90 @@
+/*
+ * 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.tck.tests.basics;
+
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.OK;
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.WARNING;
+
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.api.Folder;
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.tck.CmisTestResult;
+import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+
+/**
+ * Basic root folder tests.
+ */
+public class RootFolderTest extends AbstractSessionTest {
+    @Override
+    public void init(Map<String, String> parameters) {
+        super.init(parameters);
+        setName("Root Folder Test");
+    }
+
+    @Override
+    public void run(Session session) throws Exception {
+        CmisTestResult success;
+        CmisTestResult failure;
+
+        // check root folder id
+        RepositoryInfo ri = getRepositoryInfo(session);
+
+        success = createResult(OK, "Root folder id: " + ri.getRootFolderId());
+        failure = createResult(FAILURE, "Root folder id is not set!");
+        addResult(assertStringNotEmpty(ri.getRootFolderId(), success, failure));
+
+        // get the root folder
+        Folder rootFolder = session.getRootFolder();
+
+        addResult(checkObject(rootFolder, "Root folder object spec compliance"));
+
+        if (rootFolder == null) {
+            return;
+        }
+
+        // folder and path
+        failure = createResult(FAILURE,
+                "Root folder id in the repository info doesn't match the root folder object id!");
+        addResult(assertEquals(ri.getRootFolderId(), rootFolder.getId(), null, failure));
+
+        failure = createResult(FAILURE, "Root folder is not a cmis:folder!");
+        addResult(assertEquals(BaseTypeId.CMIS_FOLDER, rootFolder.getBaseTypeId(), null, failure));
+
+        failure = createResult(FAILURE, "Root folder path is not '/'!");
+        addResult(assertEquals("/", rootFolder.getPath(), null, failure));
+
+        failure = createResult(FAILURE, "Root folder has parents!");
+        addResult(assertEquals(0, rootFolder.getParents().size(), null, failure));
+
+        // allowable actions
+        failure = createResult(FAILURE, "Root folder has CAN_GET_FOLDER_PARENT allowable action!");
+        addResult(assertNotAllowableAction(rootFolder, Action.CAN_GET_FOLDER_PARENT, null, failure));
+
+        failure = createResult(WARNING, "Root folder has no CAN_GET_CHILDREN allowable action!");
+        addResult(assertNotAllowableAction(rootFolder, Action.CAN_GET_CHILDREN, null, failure));
+
+        // simple children test
+        addResult(checkChildren(rootFolder, "Root folder children check"));
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/RootFolderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.java Wed Oct 27 15:43:24 2010
@@ -0,0 +1,117 @@
+/*
+ * 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.tck.tests.basics;
+
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.WARNING;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.api.ObjectType;
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.client.api.Tree;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.chemistry.opencmis.tck.CmisTestResult;
+import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+
+/**
+ * Types test.
+ */
+public class TypesTest extends AbstractSessionTest {
+    @Override
+    public void init(Map<String, String> parameters) {
+        super.init(parameters);
+        setName("Types");
+    }
+
+    @Override
+    public void run(Session session) {
+        CmisTestResult failure;
+
+        // document
+        try {
+            TypeDefinition documentType = session.getTypeDefinition(BaseTypeId.CMIS_DOCUMENT.value());
+            addResult(checkTypeDefinition(documentType, "Document type spec compliance."));
+
+            failure = createResult(FAILURE, "Document type has the wrong base type: " + documentType.getBaseTypeId());
+            addResult(assertEquals(BaseTypeId.CMIS_DOCUMENT, documentType.getBaseTypeId(), null, failure));
+        } catch (CmisObjectNotFoundException e) {
+            addResult(createResult(FAILURE, "Document type not available!", e, false));
+        }
+
+        // folder
+        try {
+            TypeDefinition folderType = session.getTypeDefinition(BaseTypeId.CMIS_FOLDER.value());
+
+            addResult(checkTypeDefinition(folderType, "Folder type spec compliance."));
+
+            failure = createResult(FAILURE, "Folder type has the wrong base type: " + folderType.getBaseTypeId());
+            addResult(assertEquals(BaseTypeId.CMIS_FOLDER, folderType.getBaseTypeId(), null, failure));
+        } catch (CmisObjectNotFoundException e) {
+            addResult(createResult(FAILURE, "Folder type not available!", e, false));
+        }
+
+        // relationship
+        try {
+            TypeDefinition relationshipType = session.getTypeDefinition(BaseTypeId.CMIS_RELATIONSHIP.value());
+            addResult(checkTypeDefinition(relationshipType, "Relationship type spec compliance."));
+
+            failure = createResult(FAILURE,
+                    "Relationship type has the wrong base type: " + relationshipType.getBaseTypeId());
+            addResult(assertEquals(BaseTypeId.CMIS_RELATIONSHIP, relationshipType.getBaseTypeId(), null, failure));
+        } catch (CmisObjectNotFoundException e) {
+            addResult(createResult(WARNING, "Relationship type not available!", e, false));
+        }
+
+        // policy
+        try {
+            TypeDefinition policyType = session.getTypeDefinition(BaseTypeId.CMIS_POLICY.value());
+            addResult(checkTypeDefinition(policyType, "Policy type spec compliance."));
+
+            failure = createResult(FAILURE, "Policy type has the wrong base type: " + policyType.getBaseTypeId());
+            addResult(assertEquals(BaseTypeId.CMIS_POLICY, policyType.getBaseTypeId(), null, failure));
+        } catch (CmisObjectNotFoundException e) {
+            addResult(createResult(WARNING, "Policy type not available!", e, false));
+        }
+
+        runTypeChecks(session.getTypeDescendants(null, -1, true));
+    }
+
+    private void runTypeChecks(List<Tree<ObjectType>> types) {
+        if (types == null) {
+            return;
+        }
+
+        CmisTestResult failure;
+
+        for (Tree<ObjectType> tree : types) {
+            failure = createResult(FAILURE, "Types tree contains null leaf!");
+            addResult(assertNotNull(tree, null, failure));
+
+            if (tree != null) {
+                addResult(checkTypeDefinition(tree.getItem(), "Type spec compliance: " + tree.getItem().getId()));
+                runTypeChecks(tree.getChildren());
+            }
+        }
+    }
+
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/cmis-tck-groups.txt
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/cmis-tck-groups.txt?rev=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/cmis-tck-groups.txt (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/cmis-tck-groups.txt Wed Oct 27 15:43:24 2010
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+###############################################################
+# TCK group class list. 
+###############################################################
+
+org.apache.chemistry.opencmis.tck.tests.basics.BasicsTestGroup
\ No newline at end of file

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/cmis-tck-groups.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/sample-build.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/sample-build.xml?rev=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/sample-build.xml (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/sample-build.xml Wed Oct 27 15:43:24 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+    <!--
+        Licensed 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.
+    -->
+
+    <!--
+        CMIS TCK ant task example.
+    -->
+
+<project name="CMISTCKExample" default="main" basedir=".">
+
+    <target name="main">
+        <path id="opencmistck">
+            <fileset dir="/path/to/opencmis/jars">
+                <include name="**/*.jar"/>
+            </fileset>
+        </path>
+    
+        <taskdef name="cmistck" classname="org.apache.chemistry.opencmis.tck.runner.CmisTckAntTask">
+            <classpath refid="opencmistck"/>
+        </taskdef>
+        
+        <!--
+            parameters: OpenCMIS session parameters file (see sample-parameters.properties)
+            output:     report file
+            format:     text, xml, or html
+        -->
+
+        <cmistck parameters="/path/to/opencmis-parameters.properties" output="/path/to/output.txt" format="text" />
+    	
+     </target>
+
+</project>
\ No newline at end of file

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/sample-build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/sample-parameters.properties
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/sample-parameters.properties?rev=1028010&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/sample-parameters.properties (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/sample-parameters.properties Wed Oct 27 15:43:24 2010
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+org.apache.chemistry.opencmis.binding.spi.type=atompub
+org.apache.chemistry.opencmis.binding.atompub.url=http://localhost:8080/opencmis/atom
+org.apache.chemistry.opencmis.user=test
+org.apache.chemistry.opencmis.password=test
\ No newline at end of file

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/resources/sample-parameters.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/MIMETypes.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/MIMETypes.java?rev=1028010&r1=1028009&r2=1028010&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/MIMETypes.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/MIMETypes.java Wed Oct 27 15:43:24 2010
@@ -385,6 +385,6 @@ public class MIMETypes {
         mimeType = mimeType.trim().toLowerCase();
 
         String extension = MIME2EXT.get(mimeType);
-        return (extension == null ? "" : "." + extension);
+        return ((extension == null || extension.length() == 0) ? "" : "." + extension);
     }
 }



Mime
View raw message