| 1 |
-------------- |
| 2 |
Maven SCM AccuRev provider - Test approach |
| 3 |
-------------- |
| 4 |
Grant Gardner |
| 5 |
-------------- |
| 6 |
January 2009 |
| 7 |
-------------- |
| 8 |
|
| 9 |
~~ Licensed to the Apache Software Foundation (ASF) under one |
| 10 |
~~ or more contributor license agreements. See the NOTICE file |
| 11 |
~~ distributed with this work for additional information |
| 12 |
~~ regarding copyright ownership. The ASF licenses this file |
| 13 |
~~ to you under the Apache License, Version 2.0 (the |
| 14 |
~~ "License"); you may not use this file except in compliance |
| 15 |
~~ with the License. You may obtain a copy of the License at |
| 16 |
~~ |
| 17 |
~~ http://www.apache.org/licenses/LICENSE-2.0 |
| 18 |
~~ |
| 19 |
~~ Unless required by applicable law or agreed to in writing, |
| 20 |
~~ software distributed under the License is distributed on an |
| 21 |
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 22 |
~~ KIND, either express or implied. See the License for the |
| 23 |
~~ specific language governing permissions and limitations |
| 24 |
~~ under the License. |
| 25 |
|
| 26 |
~~ NOTE: For help with the syntax of this file, see: |
| 27 |
~~ http://maven.apache.org/doxia/references/apt-format.html |
| 28 |
|
| 29 |
Junit4 + Mockito |
| 30 |
|
| 31 |
This provider requires Java 1.5 and generally uses Junit4 annotations and <<<assertThat>>> syntax with {{{http://hamcrest.org}Hamcrest}} matchers. |
| 32 |
|
| 33 |
The commands are written against an AccuRev interface and tested using Mockito. |
| 34 |
|
| 35 |
AccuRevCommandLine then implements that interface and has its own tests to check the expected calls to accurev. |
| 36 |
|
| 37 |
The various StreamConsumers that parse AccuRev output also have their own tests. |
| 38 |
|
| 39 |
Watch out for issue between Eclipse and Sun compilers where generics can lead to unresolved symbols. |
| 40 |
Mostly this is factored out to the ScmFileMatcher class. |
| 41 |
|
| 42 |
TCK Tests |
| 43 |
|
| 44 |
AccuRev creates some challenges for the existing TCK tests. |
| 45 |
|
| 46 |
* AccuRev requires the client machine to be time synchronised with the server. If this is not the case the tck tests |
| 47 |
will almost certainly fail. |
| 48 |
|
| 49 |
* Logging in. Use *tckUrlPrefix* system property to specify "user/pass@host:port". To run tests using implicit (external) login |
| 50 |
set *tckAllowImpliedLogin*=true instead. |
| 51 |
|
| 52 |
* In setup (initRepo) a new depot is created with the appropriate files. This depot is named using |
| 53 |
<<<System.currentTimeMillis()>>> as part of the name to guarantee uniqueness. A depot is created for |
| 54 |
each individual test that is run. |
| 55 |
|
| 56 |
* You can't create a workspace in a subdirectory of another workspace. If the project itself is in AccuRev then |
| 57 |
this means the standard /target directory. Either configure maven to use a different build directory, or a set the |
| 58 |
*tckBaseDir* system property. |
| 59 |
|
| 60 |
* getWorkingCopy() etc.. are overriden as necessary so the checkout directory is prefixed with the |
| 61 |
depot name and tckBaseDir as above. |
| 62 |
|
| 63 |
* AccuRev has a 127 character limit on the workspace path so you need to make sure the tckBaseDir is not |
| 64 |
too deep in your filesystem. |
| 65 |
|
| 66 |
* We attempt to remove the created workspaces in teardown, but there's no guarantee. Depots can only |
| 67 |
be removed with a <<<maintain>>> command while the server is stopped so this is not attempted. Probably |
| 68 |
easiest to use a separate Accurev instance and periodically blow it away completely. |
| 69 |
|
| 70 |
* TckTagTest uses a fixed tag name "tag-test" but AccuRev needs unique stream names across the whole |
| 71 |
server. We use the "tagFormat" property to have stream names prefixed with the depot name |
| 72 |
|
| 73 |
Eclipse TCK tests |
| 74 |
|
| 75 |
* Lookup error for ScmManager |
| 76 |
Plexus config needs to be available - either the maven-scm-managers-plexus must be on the class path and have generated resources |
| 77 |
or the maven-scm-managers-plexus jar for the current reference version must be available in the repository |
| 78 |
|
| 79 |
* No such SCMProvider - accurev |
| 80 |
Need to generate resources so the plexus config is on the classpath |