// Path: msbuild-maven-plugin-it/src/test/java/uk/org/raje/maven/plugin/msbuild/it/MSBuildMojoITHelper.java
// static void addPropertiesToVerifier( Verifier verifier ) throws IOException
// {
//     Properties props = new Properties();
//     props.load( MSBuildMojoITHelper.class.getResourceAsStream( VERIFIER_PROPERTIES_FILE ) );
//     Properties systemProps = verifier.getSystemProperties();
//     systemProps.putAll( props );
//     verifier.setSystemProperties( systemProps );
// }
// 
// Path: msbuild-maven-plugin-it/src/test/java/uk/org/raje/maven/plugin/msbuild/it/MSBuildMojoITHelper.java
// static void assertDirectoryContents( File directory, int expectedCount, List<String> expectedFiles )
// {
//     assertTrue ( "Expected output directory missing: " + directory.getAbsolutePath(), directory.exists() );
//     List<String> dirContents = Arrays.asList( directory.list() );
//     if ( expectedCount != -1 )
//     {
//         assertEquals( expectedCount, dirContents.size() );
//     }
//     for ( String fileName: expectedFiles )
//     {
//         assertTrue( "Expected file missing: " + fileName, dirContents.contains( fileName ) );
//     }
// }
// 
// Path: msbuild-maven-plugin-it/src/test/java/uk/org/raje/maven/plugin/msbuild/it/MSBuildMojoITHelper.java
// static File calculateAndDeleteOutputDirectory( File parent, String name ) throws IOException
// {
//     File result = new File( parent, name );
//     if ( result.exists() )
//     {
//         for ( File content : result.listFiles() )
//         {
//             // NOTE: No attempt to recurse, shouldn't ever be needed!
//             if ( !content.delete() )
//             {
//                 throw new IOException( "Failed to delete " +  content.getAbsolutePath() );
//             }
//         }
//         if ( !result.delete() )
//         {
//             throw new IOException( "Failed to delete " +  result.getAbsolutePath() );
//         }
//     }
// 
//     return result;
// }


import static org.junit.Assert.assertEquals;
import java.io.File;
import java.util.Arrays;
import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
import org.junit.Test;
import static uk.org.raje.maven.plugin.msbuild.it.MSBuildMojoITHelper.addPropertiesToVerifier;
import static uk.org.raje.maven.plugin.msbuild.it.MSBuildMojoITHelper.assertDirectoryContents;
import static uk.org.raje.maven.plugin.msbuild.it.MSBuildMojoITHelper.calculateAndDeleteOutputDirectory;
/*
 * Copyright 2013 Andrew Everitt, Andrew Heckford, Daniele Masato
 *
 * 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.
 */
package uk.org.raje.maven.plugin.msbuild.it;





/**
 * Integration test that runs the multi-platform-test
 *
 */
public class MavenITOutputDirectoryTest
{

    @Test
    public void testSolutionBuild() throws Exception
    {
        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
                "/output-directory-test" );
        File win32ReleaseDir = calculateAndDeleteOutputDirectory( testDir, "Runtime\\Release" );
        File win32DebugDir = calculateAndDeleteOutputDirectory( testDir, "Runtime\\Debug" );

        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
// Path: msbuild-maven-plugin-it/src/test/java/uk/org/raje/maven/plugin/msbuild/it/MSBuildMojoITHelper.java
// static void addPropertiesToVerifier( Verifier verifier ) throws IOException
// {
//     Properties props = new Properties();
//     props.load( MSBuildMojoITHelper.class.getResourceAsStream( VERIFIER_PROPERTIES_FILE ) );
//     Properties systemProps = verifier.getSystemProperties();
//     systemProps.putAll( props );
//     verifier.setSystemProperties( systemProps );
// }
// 
// Path: msbuild-maven-plugin-it/src/test/java/uk/org/raje/maven/plugin/msbuild/it/MSBuildMojoITHelper.java
// static void assertDirectoryContents( File directory, int expectedCount, List<String> expectedFiles )
// {
//     assertTrue ( "Expected output directory missing: " + directory.getAbsolutePath(), directory.exists() );
//     List<String> dirContents = Arrays.asList( directory.list() );
//     if ( expectedCount != -1 )
//     {
//         assertEquals( expectedCount, dirContents.size() );
//     }
//     for ( String fileName: expectedFiles )
//     {
//         assertTrue( "Expected file missing: " + fileName, dirContents.contains( fileName ) );
//     }
// }
// 
// Path: msbuild-maven-plugin-it/src/test/java/uk/org/raje/maven/plugin/msbuild/it/MSBuildMojoITHelper.java
// static File calculateAndDeleteOutputDirectory( File parent, String name ) throws IOException
// {
//     File result = new File( parent, name );
//     if ( result.exists() )
//     {
//         for ( File content : result.listFiles() )
//         {
//             // NOTE: No attempt to recurse, shouldn't ever be needed!
//             if ( !content.delete() )
//             {
//                 throw new IOException( "Failed to delete " +  content.getAbsolutePath() );
//             }
//         }
//         if ( !result.delete() )
//         {
//             throw new IOException( "Failed to delete " +  result.getAbsolutePath() );
//         }
//     }
// 
//     return result;
// }


// Path: msbuild-maven-plugin-it/src/test/java/uk/org/raje/maven/plugin/msbuild/it/MavenITOutputDirectoryTest.java
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.util.Arrays;
import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
import org.junit.Test;
import static uk.org.raje.maven.plugin.msbuild.it.MSBuildMojoITHelper.addPropertiesToVerifier;
import static uk.org.raje.maven.plugin.msbuild.it.MSBuildMojoITHelper.assertDirectoryContents;
import static uk.org.raje.maven.plugin.msbuild.it.MSBuildMojoITHelper.calculateAndDeleteOutputDirectory;

/*
 * Copyright 2013 Andrew Everitt, Andrew Heckford, Daniele Masato
 *
 * 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.
 */
package uk.org.raje.maven.plugin.msbuild.it;





/**
 * Integration test that runs the multi-platform-test
 *
 */
public class MavenITOutputDirectoryTest
{

    @Test
    public void testSolutionBuild() throws Exception
    {
        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
                "/output-directory-test" );
        File win32ReleaseDir = calculateAndDeleteOutputDirectory( testDir, "Runtime\\Release" );
        File win32DebugDir = calculateAndDeleteOutputDirectory( testDir, "Runtime\\Debug" );

        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
        addPropertiesToVerifier( verifier );