/*-
 * Copyright (c) 2013 Red Hat, Inc.
 *
 * 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 org.fedoraproject.maven.resolver;

import java.io.IOException;
import org.codehaus.plexus.PlexusTestCase;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.fedoraproject.maven.config.Configuration;
import org.fedoraproject.maven.config.Configurator;
import org.fedoraproject.maven.config.Repository;
import org.fedoraproject.maven.utils.AtomicFileCounter;

/**
 * @author Michael Simacek
 */
public class BisectResolverTest
    extends PlexusTestCase
{
    @Override
    public void setUp()
        throws IOException
    {
        System.setProperty( "xmvn.bisect.counter", "bisect-counter" );
        AtomicFileCounter counter = new AtomicFileCounter( "bisect-counter", 1000 );
    }

    @Override
    public void tearDown()
    {
        System.clearProperty( "xmvn.bisect.counter" );
    }

    /**
     * Test bisection resolution of artifact with no corresponding file
     * 
     * @throws Exception
     */
    public void testBisectResolverNoFile()
        throws Exception
    {
        Configurator configurator = lookup( Configurator.class );
        Configuration configuration = configurator.getConfiguration();

        Repository repository = new Repository();
        repository.setId( "bisect" );
        repository.setType( "flat" );
        configuration.addRepository( repository );

        Artifact artifact = new DefaultArtifact( "foo:bar:1.2" );

        Resolver resolver = lookup( Resolver.class );
        ResolutionRequest request = new ResolutionRequest( artifact );
        ResolutionResult result = resolver.resolve( request );

        assertNotNull( result );
        assertNull( result.getArtifactFile() );
    }
}

@@ -662,24 +662,108 @@
 OException;%0A
+import java.nio.file.Files;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0A%0A
 import org.c
@@ -1261,32 +1261,167 @@
 Exception%0A    %7B%0A
+        Path counterPath = Paths.get( %22target/test-work/bisect-counter%22 );%0A        Files.createDirectories( counterPath.getParent() );%0A
         System.s
@@ -1455,32 +1455,38 @@
 unter%22, 
-%22bisect-counter%22
+counterPath.toString()
  );%0A    
@@ -1544,24 +1544,30 @@
 er( 
-%22bisect-counter%22
+counterPath.toString()
 , 10

Move test temp files to target/