/*
 * The contents of this file are subject to the terms 
 * of the Common Development and Distribution License 
 * (the License).  You may not use this file except in
 * compliance with the License.
 * 
 * You can obtain a copy of the license at 
 * https://glassfish.dev.java.net/public/CDDLv1.0.html or
 * glassfish/bootstrap/legal/CDDLv1.0.txt.
 * See the License for the specific language governing 
 * permissions and limitations under the License.
 * 
 * When distributing Covered Code, include this CDDL 
 * Header Notice in each file and include the License file 
 * at glassfish/bootstrap/legal/CDDLv1.0.txt.  
 * If applicable, add the following below the CDDL Header, 
 * with the fields enclosed by brackets [] replaced by
 * you own identifying information: 
 * "Portions Copyrighted [year] [name of copyright owner]"
 * 
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 */
package com.sun.enterprise.repository;

import java.util.*;
import javax.naming.*;
// IASRI 4660742 START
import java.util.logging.*;
import com.sun.logging.*;
// IASRI 4660742 END

import com.sun.enterprise.repository.Repository;

public class RepositoryTest {
// IASRI 4660742 START
    private static Logger _logger=null;
    static{
       _logger=LogDomains.getLogger(LogDomains.ROOT_LOGGER);
        }
// IASRI 4660742 END
/*
    public static void main(String[] args) {
        boolean runReadOnlyTest = true;
        boolean runReadWriteTest = true;
        switch (args.length) {
            case 1: 
                if (args[0] == "r") {
                    runReadOnlyTest = true;
                    runReadWriteTest = false;
                } else if (args[0] == "rw") {
                    runReadOnlyTest = false;
                    runReadWriteTest = true;
                } else  if (args[0] == "b") {
                    runReadOnlyTest = true;
                    runReadWriteTest = true;
                } 
            default:
                runReadOnlyTest = true;
                runReadWriteTest = true;
                break;
        }
        Repository.createInstance("repository.txt", true);
        if (runReadOnlyTest) {
            boolean passed = readOnlyTest(Repository.getInstance());
        }
        if (runReadWriteTest) {
            boolean passed = readWriteTest(Repository.getInstance());
        }
        Repository.destroyInstance();
    }
    
    static boolean readOnlyTest(Repository rep) {
        boolean passed = rep.find("app1") == null ? false : true;
// IASRI 4660742        System.out.println("Read only test " + (passed ? "passed." : "failed!"));
// START OF IASRI 4660742
	if(_logger.isLoggable(Level.FINE))
		_logger.log(Level.FINE,"Read only test " + (passed ? "passed." : "failed!"));
// END OF IASRI 4660742
        return passed;
    }
    
    static boolean readWriteTest(Repository rep) {
        boolean passed = true;
        passed = passed && rep.add("app1", "file:///ejbd/jars/app1.jar");
        passed = passed && rep.add("app2", "file:///ejbd/jars/app2.jar");
// IASRI 4660742        System.out.println("Read write test " + (passed ? "passed":"failed")); 
// START OF IASRI 4660742
	if(_logger.isLoggable(Level.FINE))
		_logger.log(Level.FINE,"Read write test " + (passed ? "passed":"failed"));
// END OF IASRI 4660742
        return passed;
    }
*/
}
