| -------------- |
| Maven SCM AccuRev provider - Test approach |
| -------------- |
| Grant Gardner |
| -------------- |
| January 2009 |
| -------------- |
| |
| ~~ 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. |
| |
| ~~ NOTE: For help with the syntax of this file, see: |
| ~~ http://maven.apache.org/doxia/references/apt-format.html |
| |
| Junit4 + Mockito |
| |
| This provider requires Java 1.5 and generally uses Junit4 annotations and <<<assertThat>>> syntax with {{{http://hamcrest.org}Hamcrest}} matchers. |
| |
| The commands are written against an AccuRev interface and tested using Mockito. |
| |
| AccuRevCommandLine then implements that interface and has its own tests to check the expected calls to accurev. |
| |
| The various StreamConsumers that parse AccuRev output also have their own tests. |
| |
| Watch out for issue between Eclipse and Sun compilers where generics can lead to unresolved symbols. |
| Mostly this is factored out to the ScmFileMatcher class. |
| |
| TCK Tests |
| |
| AccuRev creates some challenges for the existing TCK tests. |
| |
| * AccuRev requires the client machine to be time synchronised with the server. If this is not the case the tck tests |
| will almost certainly fail. |
| |
| * Logging in. Use *tckUrlPrefix* system property to specify "user/pass@host:port". To run tests using implicit (external) login |
| set *tckAllowImpliedLogin*=true instead. |
| |
| * In setup (initRepo) a new depot is created with the appropriate files. This depot is named using |
| <<<System.currentTimeMillis()>>> as part of the name to guarantee uniqueness. A depot is created for |
| each individual test that is run. |
| |
| * You can't create a workspace in a subdirectory of another workspace. If the project itself is in AccuRev then |
| this means the standard /target directory. Either configure maven to use a different build directory, or a set the |
| *tckBaseDir* system property. |
| |
| * getWorkingCopy() etc.. are overriden as necessary so the checkout directory is prefixed with the |
| depot name and tckBaseDir as above. |
| |
| * AccuRev has a 127 character limit on the workspace path so you need to make sure the tckBaseDir is not |
| too deep in your filesystem. |
| |
| * We attempt to remove the created workspaces in teardown, but there's no guarantee. Depots can only |
| be removed with a <<<maintain>>> command while the server is stopped so this is not attempted. Probably |
| easiest to use a separate Accurev instance and periodically blow it away completely. |
| |
| * TckTagTest uses a fixed tag name "tag-test" but AccuRev needs unique stream names across the whole |
| server. We use the "tagFormat" property to have stream names prefixed with the depot name |
| |
| Eclipse TCK tests |
| |
| * Lookup error for ScmManager |
| Plexus config needs to be available - either the maven-scm-managers-plexus must be on the class path and have generated resources |
| or the maven-scm-managers-plexus jar for the current reference version must be available in the repository |
| |
| * No such SCMProvider - accurev |
| Need to generate resources so the plexus config is on the classpath |