PR: MPCHANGES-7
fix version handling git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115032 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -28,7 +28,7 @@ import org.dom4j.io.*;
|
||||
/**
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
*
|
||||
* @version $Id: ReleaseVersion.java,v 1.2 2004/03/02 15:37:56 evenisse Exp $
|
||||
* @version $Id: ReleaseVersion.java,v 1.3 2004/04/22 07:34:56 brett Exp $
|
||||
*/
|
||||
public class ReleaseVersion
|
||||
{
|
||||
@@ -39,7 +39,7 @@ public class ReleaseVersion
|
||||
releaseVersion( changesFile, currentVersion, version, dateFormat.format( new Date() ) );
|
||||
}
|
||||
|
||||
public static final void releaseVersion( File changesFile, String currentVersion, String version, String date )
|
||||
static final Document transformVersion( File changesFile, String currentVersion, String version, String date )
|
||||
throws DocumentException, FileNotFoundException, UnsupportedEncodingException, IOException
|
||||
{
|
||||
SAXReader r = new SAXReader();
|
||||
@@ -52,18 +52,38 @@ public class ReleaseVersion
|
||||
|
||||
for ( Iterator i = releases.elementIterator( "release" ); i.hasNext(); )
|
||||
{
|
||||
Element e = (Element) i.next();
|
||||
Element e = ( Element ) i.next();
|
||||
|
||||
Attribute v = e.attribute( "version" );
|
||||
|
||||
if ( v != null )
|
||||
{
|
||||
String text = v.getText();
|
||||
Attribute d = e.attribute( "date" );
|
||||
boolean updateRelease = false;
|
||||
if ( text.equals( currentVersion ) || text.equals( version ) )
|
||||
{
|
||||
updateRelease = true;
|
||||
}
|
||||
if ( updateRelease && d != null )
|
||||
{
|
||||
DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
|
||||
try
|
||||
{
|
||||
dateFormat.parse( d.getText() );
|
||||
// date is set correctly
|
||||
updateRelease = false;
|
||||
}
|
||||
catch ( ParseException ex )
|
||||
{
|
||||
// intentional
|
||||
}
|
||||
}
|
||||
|
||||
if ( updateRelease )
|
||||
{
|
||||
v.setText( version );
|
||||
|
||||
Attribute d = e.attribute( "date" );
|
||||
if ( d == null )
|
||||
{
|
||||
e.addAttribute( "date", date );
|
||||
@@ -72,10 +92,25 @@ public class ReleaseVersion
|
||||
{
|
||||
d.setText( date );
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// indicates no transform necessary
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final void releaseVersion( File changesFile, String currentVersion, String version, String date )
|
||||
throws DocumentException, FileNotFoundException, UnsupportedEncodingException, IOException
|
||||
{
|
||||
Document doc = transformVersion( changesFile, currentVersion, version, date );
|
||||
if ( doc == null )
|
||||
{
|
||||
// no transform necessary
|
||||
return;
|
||||
}
|
||||
|
||||
// Backup the original first.
|
||||
FileUtils.copyFile( changesFile, new File( changesFile + ".backup" ) );
|
||||
|
||||
@@ -91,3 +126,4 @@ public class ReleaseVersion
|
||||
writer.write( doc );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes plugin changes</title>
|
||||
<author email="brett@apache.org">Brett Porter</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.2-SNAPSHOT" date="in CVS">
|
||||
<action dev="brett" type="fix" issue="MPCHANGES-7">Don't overwrite currentVersion if it already has a release date. Add unit tests.</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes plugin changes</title>
|
||||
<author email="brett@apache.org">Brett Porter</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.2" date="in CVS">
|
||||
<action dev="brett" type="fix">Fix something else</action>
|
||||
</release>
|
||||
<release version="1.1" date="2003-03-23">
|
||||
<action dev="brett" type="fix">Fix something</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes plugin changes</title>
|
||||
<author email="brett@apache.org">Brett Porter</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.2" date="2003-03-23">
|
||||
<action dev="brett" type="fix">Fix something else</action>
|
||||
</release>
|
||||
<release version="1.1" date="2002-02-22">
|
||||
<action dev="brett" type="fix">Fix something</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes plugin changes</title>
|
||||
<author email="brett@apache.org">Brett Porter</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.2" date="2003-03-23">
|
||||
<action dev="brett" type="fix">Fix something</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes plugin changes</title>
|
||||
<author email="brett@apache.org">Brett Porter</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.2" date="in CVS">
|
||||
<action dev="brett" type="fix">Fix something</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes plugin changes</title>
|
||||
<author email="brett@apache.org">Brett Porter</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.2" date="2003-03-23">
|
||||
<action dev="brett" type="fix">Fix something</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
28
changes/src/test-data/test-no-versions.xml
Normal file
28
changes/src/test-data/test-no-versions.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes plugin changes</title>
|
||||
<author email="brett@apache.org">Brett Porter</author>
|
||||
</properties>
|
||||
<body>
|
||||
</body>
|
||||
</document>
|
||||
31
changes/src/test-data/test-one-unrelated-release.xml
Normal file
31
changes/src/test-data/test-one-unrelated-release.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes plugin changes</title>
|
||||
<author email="brett@apache.org">Brett Porter</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.1" date="2003-03-23">
|
||||
<action dev="brett" type="fix" issue="MPCHANGES-7">Don't overwrite currentVersion if it already has a release date. Add unit tests.</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
@@ -0,0 +1,241 @@
|
||||
package org.apache.maven.changes;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.io.SAXReader;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ReleaseVersionTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param name Name of the test.
|
||||
*/
|
||||
public ReleaseVersionTest( String name )
|
||||
{
|
||||
super( name );
|
||||
}
|
||||
|
||||
public void testExistingReleaseTargetVersionReleased()
|
||||
throws Exception
|
||||
{
|
||||
File changesFile = new File( System.getProperty( "basedir" ), "/src/test-data/test-existing-release-target-version-released.xml" );
|
||||
Document doc = ReleaseVersion.transformVersion( changesFile, "1.1", "1.2", "2004-04-21" );
|
||||
|
||||
assertNull( "check transform required", doc );
|
||||
|
||||
SAXReader r = new SAXReader();
|
||||
|
||||
doc = r.read( changesFile );
|
||||
|
||||
List nodes = doc.selectNodes( "/document/body/release" );
|
||||
|
||||
assertEquals( "check exactly 1 release", 1, nodes.size() );
|
||||
|
||||
Element release = ( Element ) nodes.get( 0 );
|
||||
|
||||
assertEquals( "Check version is 1.2", "1.2", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2003-03-23", "2003-03-23", release.attribute( "date" ).getText() );
|
||||
}
|
||||
|
||||
public void testExistingReleaseTargetVersionInCvs()
|
||||
throws Exception
|
||||
{
|
||||
File changesFile = new File( System.getProperty( "basedir" ), "/src/test-data/test-existing-release-target-version-in-cvs.xml" );
|
||||
Document doc = ReleaseVersion.transformVersion( changesFile, "1.1", "1.2", "2004-04-21" );
|
||||
|
||||
assertNotNull( "check transform required", doc );
|
||||
|
||||
List nodes = doc.selectNodes( "/document/body/release" );
|
||||
|
||||
assertEquals( "check exactly 1 release", 1, nodes.size() );
|
||||
|
||||
Element release = ( Element ) nodes.get( 0 );
|
||||
|
||||
assertEquals( "Check version is 1.2", "1.2", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2004-04-21", "2004-04-21", release.attribute( "date" ).getText() );
|
||||
}
|
||||
|
||||
public void testExistingReleaseCurrentVersionReleasedAndTargetVersionInCvs()
|
||||
throws Exception
|
||||
{
|
||||
File changesFile = new File( System.getProperty( "basedir" ), "/src/test-data/test-existing-release-current-version-released-and-target-version-in-cvs.xml" );
|
||||
Document doc = ReleaseVersion.transformVersion( changesFile, "1.1", "1.2", "2004-04-21" );
|
||||
|
||||
assertNotNull( "check transform required", doc );
|
||||
|
||||
List nodes = doc.selectNodes( "/document/body/release" );
|
||||
|
||||
assertEquals( "check exactly 2 releases", 2, nodes.size() );
|
||||
|
||||
Element release = ( Element ) nodes.get( 0 );
|
||||
|
||||
assertEquals( "Check version is 1.2", "1.2", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2004-04-21", "2004-04-21", release.attribute( "date" ).getText() );
|
||||
|
||||
release = ( Element ) nodes.get( 1 );
|
||||
|
||||
assertEquals( "Check version is 1.1", "1.1", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2003-03-23", "2003-03-23", release.attribute( "date" ).getText() );
|
||||
}
|
||||
|
||||
public void testExistingReleaseCurrentVersionReleasedAndTargetVersionReleased()
|
||||
throws Exception
|
||||
{
|
||||
File changesFile = new File( System.getProperty( "basedir" ), "/src/test-data/test-existing-release-current-version-released-and-target-version-released.xml" );
|
||||
Document doc = ReleaseVersion.transformVersion( changesFile, "1.1", "1.2", "2004-04-21" );
|
||||
|
||||
assertNull( "check transform required", doc );
|
||||
|
||||
SAXReader r = new SAXReader();
|
||||
|
||||
doc = r.read( changesFile );
|
||||
|
||||
List nodes = doc.selectNodes( "/document/body/release" );
|
||||
|
||||
assertEquals( "check exactly 2 releases", 2, nodes.size() );
|
||||
|
||||
Element release = ( Element ) nodes.get( 0 );
|
||||
|
||||
assertEquals( "Check version is 1.2", "1.2", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2003-03-23", "2003-03-23", release.attribute( "date" ).getText() );
|
||||
|
||||
release = ( Element ) nodes.get( 1 );
|
||||
|
||||
assertEquals( "Check version is 1.1", "1.1", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2002-02-22", "2002-02-22", release.attribute( "date" ).getText() );
|
||||
}
|
||||
|
||||
public void testExistingReleaseCurrentVersionReleased()
|
||||
throws Exception
|
||||
{
|
||||
File changesFile = new File( System.getProperty( "basedir" ), "/src/test-data/test-existing-release-current-version-released.xml" );
|
||||
Document doc = ReleaseVersion.transformVersion( changesFile, "1.2", "1.2", "2004-04-21" );
|
||||
|
||||
assertNull( "check transform required", doc );
|
||||
|
||||
SAXReader r = new SAXReader();
|
||||
|
||||
doc = r.read( changesFile );
|
||||
|
||||
List nodes = doc.selectNodes( "/document/body/release" );
|
||||
|
||||
assertEquals( "check exactly 1 release", 1, nodes.size() );
|
||||
|
||||
Element release = ( Element ) nodes.get( 0 );
|
||||
|
||||
assertEquals( "Check version is 1.2", "1.2", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2004-04-21", "2003-03-23", release.attribute( "date" ).getText() );
|
||||
}
|
||||
|
||||
public void testExistingReleaseCurrentVersionInCvs()
|
||||
throws Exception
|
||||
{
|
||||
Document doc = ReleaseVersion.transformVersion(
|
||||
new File( System.getProperty( "basedir" ), "/src/test-data/test-existing-release-current-version-in-cvs.xml" ),
|
||||
"1.2-SNAPSHOT", "1.2", "2004-04-21" );
|
||||
|
||||
assertNotNull( "check transform required", doc );
|
||||
|
||||
List nodes = doc.selectNodes( "/document/body/release" );
|
||||
|
||||
assertEquals( "check exactly 1 release", 1, nodes.size() );
|
||||
|
||||
Element release = ( Element ) nodes.get( 0 );
|
||||
|
||||
assertEquals( "Check version is 1.2", "1.2", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2004-04-21", "2004-04-21", release.attribute( "date" ).getText() );
|
||||
}
|
||||
|
||||
public void testOneUnrelatedRelease()
|
||||
throws Exception
|
||||
{
|
||||
File changesFile = new File( System.getProperty( "basedir" ), "/src/test-data/test-one-unrelated-release.xml" );
|
||||
Document doc = ReleaseVersion.transformVersion( changesFile, "1.2-SNAPSHOT", "1.2", "2004-04-21" );
|
||||
|
||||
assertNull( "check transform required", doc );
|
||||
|
||||
SAXReader r = new SAXReader();
|
||||
doc = r.read( changesFile );
|
||||
|
||||
List nodes = doc.selectNodes( "/document/body/release" );
|
||||
|
||||
assertEquals( "check exactly 1 releases", 1, nodes.size() );
|
||||
|
||||
Element release = ( Element ) nodes.get( 0 );
|
||||
|
||||
assertEquals( "Check version is 1.1", "1.1", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2003-03-23", "2003-03-23", release.attribute( "date" ).getText() );
|
||||
|
||||
/* assumes addition of elements
|
||||
assertNotNull( "check transform required", doc );
|
||||
|
||||
List nodes = doc.selectNodes( "/document/body/release" );
|
||||
|
||||
assertEquals( "check exactly 2 releases", 2, nodes.size() );
|
||||
|
||||
Element release = ( Element ) nodes.get( 0 );
|
||||
|
||||
assertEquals( "Check version is 1.2", "1.2", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2004-04-21", "2004-04-21", release.attribute( "date" ).getText() );
|
||||
|
||||
release = ( Element ) nodes.get( 1 );
|
||||
assertEquals( "Check version is 1.1", "1.1", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2003-03-23", "2003-03-23", release.attribute( "date" ).getText() );
|
||||
*/
|
||||
}
|
||||
|
||||
public void testNoReleases()
|
||||
throws Exception
|
||||
{
|
||||
File changesFile = new File( System.getProperty( "basedir" ), "/src/test-data/test-no-versions.xml" );
|
||||
Document doc = ReleaseVersion.transformVersion( changesFile, "1.0-SNAPSHOT", "1.0", "2004-04-21" );
|
||||
|
||||
assertNull( "check transform required", doc );
|
||||
SAXReader r = new SAXReader();
|
||||
doc = r.read( changesFile );
|
||||
|
||||
List nodes = doc.selectNodes( "/document/body/release" );
|
||||
|
||||
assertEquals( "check no release", 0, nodes.size() );
|
||||
|
||||
/* assumes addition of elements
|
||||
assertNotNull( "check transform required", doc );
|
||||
|
||||
List nodes = doc.selectNodes( "/document/body/release" );
|
||||
|
||||
assertEquals( "check only 1 release", 1, nodes.size() );
|
||||
|
||||
Element release = ( Element ) nodes.get( 0 );
|
||||
|
||||
assertEquals( "Check version is 1.0", "1.0", release.attribute( "version" ).getText() );
|
||||
assertEquals( "Check date is 2004-04-21", "2004-04-21", release.attribute( "date" ).getText() );
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
<author email="vmassol@apache.org">Vincent Massol</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.4" date="in CVS">
|
||||
<release version="1.4-SNAPSHOT" date="in CVS">
|
||||
<action dev="brett" type="fix" issue="MPCHANGES-7">Don't overwrite currentVersion if it already has a release date. Add unit tests.</action>
|
||||
<action dev="vmassol" type="add" issue="MPCHANGES-5">
|
||||
Added documentation for the format of <code>changes.xml</code> file.
|
||||
</action>
|
||||
|
||||
Reference in New Issue
Block a user