Author: maartenc Date: Wed Mar 26 15:44:06 2008 New Revision: 641617 URL: http://svn.apache.org/viewvc?rev=641617&view=rev Log: Added junit tests for IVY-771.
Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java Modified: ant/ivy/core/trunk/ivy.xml Modified: ant/ivy/core/trunk/ivy.xml URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/ivy.xml?rev=641617&r1=641616&r2=641617&view=diff ============================================================================== --- ant/ivy/core/trunk/ivy.xml (original) +++ ant/ivy/core/trunk/ivy.xml Wed Mar 26 15:44:06 2008 @@ -50,6 +50,8 @@ <!-- Test dependencies --> <dependency org="junit" name="junit" rev="3.8.2" conf="test->default" /> <dependency org="commons-lang" name="commons-lang" rev="[1.0,3.0[" conf="test->default" /> + <dependency org="org.apache.ant" name="ant-testutil" rev="1.7.0" conf="test->default" transitive="false" /> + <dependency org="ant" name="ant-launcher" rev="1.6" conf="test->default" transitive="false"/> <!-- This dependency is necessary for having validation in junit tests when running with JDK1.4 --> <dependency org="xerces" name="xercesImpl" rev="2.6.2" conf="test->default" /> Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml?rev=641617&view=auto ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml (added) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml Wed Mar 26 15:44:06 2008 @@ -0,0 +1,37 @@ +<!-- + 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. +--> +<project xmlns:ivy="antlib:org.apache.ivy.ant" basedir="../../../../../.."> + <target name="setUp"> + <property name="ivy.cache.repository" value="build/cache" /> + </target> + + <target name="tearDown"> + <delete dir="build/cache" /> + </target> + + <target name="testOverrideNotSpecified"> + <ivy:settings id="test1" file="test/repositories/ivysettings.xml" /> + <ivy:resolve settingsRef="test1" file="test/java/org/apache/ivy/ant/ivy-simple.xml" /> + </target> + + <target name="testOverrideSetToFalse"> + <ivy:settings id="test2" file="test/repositories/ivysettings.xml" override="false" /> + <ivy:resolve settingsRef="test2" file="test/java/org/apache/ivy/ant/ivy-simple.xml" /> + </target> +</project> \ No newline at end of file Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java?rev=641617&view=auto ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java (added) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java Wed Mar 26 15:44:06 2008 @@ -0,0 +1,45 @@ +/* + * 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. + * + */ +package org.apache.ivy.ant; + +import org.apache.ivy.core.report.ResolveReport; +import org.apache.tools.ant.BuildFileTest; + +public class IvyAntSettingsBuildFileTest extends BuildFileTest { + + protected void setUp() throws Exception { + configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml"); + } + + public void testOverrideNotSpecified() { + executeTarget("testOverrideNotSpecified"); + ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report"); + assertNotNull(report); + assertFalse(report.hasError()); + assertEquals(1, report.getDependencies().size()); + } + + public void testOverrideSetToFalse() { + executeTarget("testOverrideSetToFalse"); + ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report"); + assertNotNull(report); + assertFalse(report.hasError()); + assertEquals(1, report.getDependencies().size()); + } + +}