You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by lm...@apache.org on 2018/07/29 16:42:53 UTC

svn commit: r1836981 - in /chemistry/cmislib/branches/py3_compat: .travis.yml docker-compose.yml src/tests/cmislibtest.py src/tests/settings.py src/tests/test_cmislib.py tox.ini

Author: lmignon
Date: Sun Jul 29 16:42:53 2018
New Revision: 1836981

URL: http://svn.apache.org/viewvc?rev=1836981&view=rev
Log:
Add travis CI
Use a docker image of Alfresco to be able to run the tests on a
clean install of Alfresco

Added:
    chemistry/cmislib/branches/py3_compat/.travis.yml
    chemistry/cmislib/branches/py3_compat/docker-compose.yml
    chemistry/cmislib/branches/py3_compat/src/tests/settings.py
    chemistry/cmislib/branches/py3_compat/src/tests/test_cmislib.py
      - copied, changed from r1836980, chemistry/cmislib/branches/py3_compat/src/tests/cmislibtest.py
    chemistry/cmislib/branches/py3_compat/tox.ini
Removed:
    chemistry/cmislib/branches/py3_compat/src/tests/cmislibtest.py

Added: chemistry/cmislib/branches/py3_compat/.travis.yml
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/.travis.yml?rev=1836981&view=auto
==============================================================================
--- chemistry/cmislib/branches/py3_compat/.travis.yml (added)
+++ chemistry/cmislib/branches/py3_compat/.travis.yml Sun Jul 29 16:42:53 2018
@@ -0,0 +1,35 @@
+sudo: required
+
+cache: 
+ pip: true
+
+language: python
+
+python:
+  - "2.7"
+
+services:
+  - docker
+
+install:
+  - pip install tox-travis
+  - pip install codecov
+  - pip install codeclimate-test-reporter
+
+before_script:
+  # install alfresco
+  - git clone https://github.com/keensoft/alfresco-docker-template
+  - cd alfresco-docker-template/templates/201702-GA && docker-compose up -d
+  - cd $TRAVIS_BUILD_DIR
+  # wait alfresco startup complete
+  - until $(curl -sSf http://localhost/alfresco  -o /dev/null); do sleep 5 ; done
+  - wget http://localhost/alfresco/api/-default-/cmis/versions/1.1/browser --password=admin --user=admin
+  - cat browser
+
+script:
+  - tox
+
+after_success:
+  - codecov
+  - codeclimate-test-reporter
+

Added: chemistry/cmislib/branches/py3_compat/docker-compose.yml
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/docker-compose.yml?rev=1836981&view=auto
==============================================================================
--- chemistry/cmislib/branches/py3_compat/docker-compose.yml (added)
+++ chemistry/cmislib/branches/py3_compat/docker-compose.yml Sun Jul 29 16:42:53 2018
@@ -0,0 +1,31 @@
+version: '2'
+services:
+   alfresco:
+       image: "pdubois/docker-alfresco:master"
+       ports:
+        - "8443"
+       environment:
+        - INITIAL_PASS=admun
+        - CONTAINER_FUNCTION=tomcat
+        - ALF_1=db.url.EQ.jdbc:postgresql:\/\/postgres:5432\/alfresco
+        - ALF_2=db.password.EQ.mysecretpassword  
+        - ALF_3=db.username.EQ.postgres
+        - ALF_4=index.subsystem.name.EQ.solr6
+        - ALF_5=solr.secureComms.EQ.none
+        - ALF_6=solr.host.EQ.solr6
+        - ALF_7=solr.port.EQ.8983
+        - ALF_8=solr.port.ssl.EQ.8443
+        - DB_CONTAINER_NAME=postgres
+       depends_on:
+        - postgres
+        - solr6
+   postgres:
+       image: postgres:9.4.4
+       environment:
+        - POSTGRES_PASSWORD=mysecretpassword
+   solr6: 
+       image: pdubois/solr6:latest
+       environment:
+        - ALFRESCO_HOST=alfresco
+        - XMS=2048
+        - XMX=2048

Added: chemistry/cmislib/branches/py3_compat/src/tests/settings.py
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/settings.py?rev=1836981&view=auto
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/settings.py (added)
+++ chemistry/cmislib/branches/py3_compat/src/tests/settings.py Sun Jul 29 16:42:53 2018
@@ -0,0 +1,73 @@
+#
+#      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.
+#
+from cmislib.atompub.binding import AtomPubBinding
+from cmislib.browser.binding import BrowserBinding
+
+#
+# Override these settings with values to match your environment.
+#
+# CMIS repository's service URL
+#REPOSITORY_URL = 'http://cmis.alfresco.com/s/cmis' # Alfresco demo
+#REPOSITORY_URL = 'http://localhost:8081/chemistry/atom' # Apache Chemistry AtomPub
+#REPOSITORY_URL = 'http://localhost:8081/chemistry/browser' # Apache Chemistry Browser
+#REPOSITORY_URL = 'http://localhost:8080/alfresco/cmisatom'  # Alfresco 4.0 AtomPub
+#REPOSITORY_URL = 'http://localhost:8080/alfresco/s/api/cmis'  # Alfresco
+#REPOSITORY_URL = 'http://localhost:8080/alfresco/api/-default-/cmis/versions/1.0/atom' # Alfresco 4.2 CMIS 1.0 Atom
+#REPOSITORY_URL = 'http://localhost:8080/alfresco/api/-default-/cmis/versions/1.1/atom' # Alfresco 4.2 CMIS 1.1 Atom
+#REPOSITORY_URL = 'http://cmis.demo.nuxeo.org/nuxeo/atom/cmis' # Nuxeo demo
+#REPOSITORY_URL = 'http://localhost:8080/nuxeo/atom/cmis' # Nuxeo local
+REPOSITORY_URL = 'http://localhost:80/alfresco/api/-default-/cmis/versions/1.1/browser' # Alfresco 4.2 CMIS 1.0 Atom
+#REPOSITORY_URL = 'http://localhost:8080/alfresco/api/-default-/cmis/versions/1.1/atom' # Alfresco 4.2 CMIS 1.0 Atom
+
+# Choose a binding. The AtomPubBinding is the only one you should really be using right now
+#BINDING = AtomPubBinding()
+BINDING = BrowserBinding()
+
+# CMIS repository credentials
+USERNAME = 'admin'  # Alfresco
+PASSWORD = 'admin'  # Alfresco
+#USERNAME = ''
+#PASSWORD = ''
+#USERNAME = 'Administrator'  # Nuxeo
+#PASSWORD = 'Administrator'  # Nuxeo
+EXT_ARGS = {}
+#EXT_ARGS = {'alf_ticket': 'TICKET_cef29079d8d5341338bf372b08278bc30ec89380'}
+# Absolute path to a directory where test folders can be created, including
+# the trailing slash.
+#TEST_ROOT_PATH = '/default-domain/workspaces/cmislib'  # No trailing slash
+#TEST_ROOT_PATH = '/cmislib'  # No trailing slash
+TEST_ROOT_PATH = '/'
+# Binary test files. Assumed to exist in the same dir as this python script
+TEST_BINARY_1 = '250px-Cmis_logo.png'
+TEST_BINARY_2 = 'sample-a.pdf'
+# For repositories that support setting an ACL, the name of an existing
+# principal ID to add to the ACL of a test object. Some repositories care
+# if this ID doesn't exist. Some repositories don't.
+TEST_PRINCIPAL_ID = 'anyone'
+#TEST_PRINCIPAL_ID = 'admin'
+# For repositories that may index test content asynchronously, the number of
+# times a query is retried before giving up.
+MAX_FULL_TEXT_TRIES = 10
+# The number of seconds the test should sleep between tries.
+FULL_TEXT_WAIT = 10
+# Specify the type ID of a versionable type. If all types are versionable,
+# specify cmis:document
+VERSIONABLE_TYPE_ID = 'cmis:document'
+#VERSIONABLE_TYPE_ID = 'cmisbook:pdf'
+#VERSIONABLE_TYPE_ID = 'VersionableType'

Copied: chemistry/cmislib/branches/py3_compat/src/tests/test_cmislib.py (from r1836980, chemistry/cmislib/branches/py3_compat/src/tests/cmislibtest.py)
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/src/tests/test_cmislib.py?p2=chemistry/cmislib/branches/py3_compat/src/tests/test_cmislib.py&p1=chemistry/cmislib/branches/py3_compat/src/tests/cmislibtest.py&r1=1836980&r2=1836981&rev=1836981&view=diff
==============================================================================
--- chemistry/cmislib/branches/py3_compat/src/tests/cmislibtest.py (original)
+++ chemistry/cmislib/branches/py3_compat/src/tests/test_cmislib.py Sun Jul 29 16:42:53 2018
@@ -56,7 +56,7 @@ class CmisTestBase(unittest.TestCase):
                                       binding=settings.BINDING,
                                       **settings.EXT_ARGS)
         self._repo = self._cmisClient.getDefaultRepository()
-        self._rootFolder = self._repo.getObjectByPath(settings.TEST_ROOT_PATH)
+        self._rootFolder = self._repo.getRootFolder()
         self._folderName = " ".join(['cmislib', self.__class__.__name__, str(time())])
         self._testFolder = self._rootFolder.createFolder(self._folderName)
 

Added: chemistry/cmislib/branches/py3_compat/tox.ini
URL: http://svn.apache.org/viewvc/chemistry/cmislib/branches/py3_compat/tox.ini?rev=1836981&view=auto
==============================================================================
--- chemistry/cmislib/branches/py3_compat/tox.ini (added)
+++ chemistry/cmislib/branches/py3_compat/tox.ini Sun Jul 29 16:42:53 2018
@@ -0,0 +1,20 @@
+# Tox (http://tox.testrun.org/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = 
+  py27
+
+[testenv]
+usedevelop = True
+# todo --flake8
+commands = py.test --cov-config=.coveragerc --cov-branch --cov=src/tests {posargs}
+deps =
+    pytest
+    pytest-cov
+    pytest-flake8
+
+[pytest]
+flake8-max-line-length = 120