/*
 * 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 java.io.*;

String[] expectedFiles = {
    "org/apache/maven/its/dependency/fake-remote-unpack/1.0/fake-remote-unpack-1.0.jar"
};

for ( String expectedFile : expectedFiles )
{
    File file = new File( localRepositoryPath, expectedFile );
    System.out.println( "Checking for existence of " + file );
    if ( !file.isFile() )
    {
        throw new Exception( "Missing file " + file );
    }
}

File unpacked = new File( basedir, "target/dependency/META-INF/MANIFEST.MF" );
if ( !unpacked.exists() )
{
    throw new Exception( "Missing file " + file );
}

return true;
