Skip to content

Commit

Permalink
Add unittests for ScmTranslators
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/maven/release/trunk@1334063 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
rfscholte committed May 4, 2012
1 parent ff7deca commit 929075f
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.apache.maven.shared.release.scm;

/*
* 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.
*/

import junit.framework.TestCase;

public class ClearCaseScmTranslatorTest
extends TestCase
{
private ClearCaseScmTranslator scmTranslator = new ClearCaseScmTranslator();

/**
* @see org.apache.maven.model.Scm#getTag()
*/
public void testResolveTag()
{
// with current implementation you can't call your tag 'HEAD' (which is the default)
assertEquals( null, scmTranslator.resolveTag( "HEAD" ) );
assertEquals( "project-1.0", scmTranslator.resolveTag( "project-1.0" ) );
}

public void testTranslateTagUrl()
{
assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", null ) );
assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", "tagBase" ) );
}

public void testTranslateBranchUrl()
{
assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", null ) );
assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", "tagBase" ) );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.apache.maven.shared.release.scm;

/*
* 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.
*/

import junit.framework.TestCase;

public class GitScmTranslatorTest
extends TestCase
{

private GitScmTranslator scmTranslator = new GitScmTranslator();

/**
* @see org.apache.maven.model.Scm#getTag()
*/
public void testResolveTag()
{
assertEquals( "HEAD", scmTranslator.resolveTag( "HEAD" ) );
assertEquals( "project-1.0", scmTranslator.resolveTag( "project-1.0" ) );
}

public void testTranslateTagUrl()
{
assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", null ) );
assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", "tagBase" ) );
}

public void testTranslateBranchUrl()
{
assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", null ) );
assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", "tagBase" ) );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.apache.maven.shared.release.scm;

/*
* 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.
*/

import junit.framework.TestCase;

public class HgScmTranslatorTest
extends TestCase
{
private HgScmTranslator scmTranslator = new HgScmTranslator();

/**
* @see org.apache.maven.model.Scm#getTag()
*/
public void testResolveTag()
{
assertEquals( "HEAD", scmTranslator.resolveTag( "HEAD" ) );
assertEquals( "project-1.0", scmTranslator.resolveTag( "project-1.0" ) );
}

public void testTranslateTagUrl()
{
assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", null ) );
assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", "tagBase" ) );
}

public void testTranslateBranchUrl()
{
assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", null ) );
assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", "tagBase" ) );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.apache.maven.shared.release.scm;

/*
* 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.
*/

import junit.framework.TestCase;

public class JazzScmTranslatorTest
extends TestCase
{

private JazzScmTranslator scmTranslator = new JazzScmTranslator();

/**
* @see org.apache.maven.model.Scm#getTag()
*/
public void testResolveTag()
{
assertNull( scmTranslator.resolveTag( "HEAD" ) );
assertNull( scmTranslator.resolveTag( "project-1.0" ) );
}

//@todo define expected results
// public void testTranslateTagUrl()
// {
// assertEquals( , scmTranslator.translateTagUrl( "url", "tag", null ) );
// assertEquals( , scmTranslator.translateTagUrl( "url", "tag", "tagBase" ) );
// }
//
// public void testTranslateBranchUrl()
// {
// assertEquals( , scmTranslator.translateBranchUrl( "url", "branchName", null ) );
// assertEquals( , scmTranslator.translateBranchUrl( "url", "branchName", "tagBase" ) );
// }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.apache.maven.shared.release.scm;

/*
* 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.
*/

import junit.framework.TestCase;

public class SubversionScmTranslatorTest
extends TestCase
{

private SubversionScmTranslator scmTranslator = new SubversionScmTranslator();

/**
* @see org.apache.maven.model.Scm#getTag()
*/
public void testResolveTag()
{
// "HEAD"is default
assertNull( scmTranslator.resolveTag( "HEAD" ) );
assertNull( scmTranslator.resolveTag( "project-1.0" ) );
}

public void testTranslateTagUrl()
{
assertEquals( "url/tags/tag", scmTranslator.translateTagUrl( "url", "tag", null ) );
assertEquals( "tagBase/tag", scmTranslator.translateTagUrl( "url", "tag", "tagBase" ) );
}

public void testTranslateBranchUrl()
{
assertEquals( "url/branches/branchName", scmTranslator.translateBranchUrl( "url", "branchName", null ) );
assertEquals( "tagBase/branchName", scmTranslator.translateBranchUrl( "url", "branchName", "tagBase" ) );
}
}

0 comments on commit 929075f

Please sign in to comment.