Posts Tagged test

Cache implementation tests

I have just committed the test suite I’ve been using in order to test the cache implementation. You can find it at:

I have created a basic plain text format to simulate repositories and perform queries to the cache. This is an example:

A	/trunk
A	/branches
A	/tags
A	/trunk/project
A	/trunk/project/foo.txt
M	/trunk/project/foo.txt
A	/trunk/project/bar.txt
M	/trunk/project/foo.txt
M	/trunk/project/bar.txt
D	/trunk/project/foo.txt
test	/trunk/project/foo.txt	3
3	A
4	M
6	M
7	D

The first line clears the cache. The second line says that the cache is going to be loaded with data. The following lines contain the log messages that will be saved into the cache. The lines with a number start a revision. That number is the revision number. The other lines contain the changed paths information. For example A /trunk indicates that the /trunk folder is created (A). The author, date and log messages are not indicated. The action (A) and the path (/trunk) are separated with a tab. Every argument in each line is separated with a tab. To finish loading data into the cache the update command is used. Some change paths require more information. For example:

A	/branches/1.0	/trunk	2

That changed path indicates that the folder “/branches/1.0” is copied from “/trunk” at revision “2”.

To test the queries a against the database the test command is used. The test keyword is followed by a path and a revision number that identify the file. Then the cache creates a graph of the specified file in memory. To test verify the graph is ok all branch paths are listed followed by their nodes. This is:

3	A
4	M
6	M
7	D

Those lines tell that the branch /trunk/project/foo.txt should have the following nodes: A at revision 3, M at revision 4 and 6 and D at revision 7.

The test files are stored in a folder called “testfiles” and to run them you just need to run test.CacheTest using JUnit.

Note: the code depends on the following projects:

  • org.tigris.subversion.clientadapter
  • org.tigris.subversion.subclipse.core
  • org.tigris.subversion.subclipse.graph

Leave a Comment