org.kles.MainTEST.java Source code

Java tutorial

Introduction

Here is the source code for org.kles.MainTEST.java

Source

package org.kles;

import com.github.javaparser.ASTHelper;
import com.github.javaparser.JavaParser;
import com.github.javaparser.ParseException;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.PackageDeclaration;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.body.ModifierSet;
import com.github.javaparser.ast.body.Parameter;
import com.github.javaparser.ast.body.VariableDeclarator;
import com.github.javaparser.ast.expr.FieldAccessExpr;
import com.github.javaparser.ast.expr.MethodCallExpr;
import com.github.javaparser.ast.expr.NameExpr;
import com.github.javaparser.ast.expr.StringLiteralExpr;
import com.github.javaparser.ast.stmt.BlockStmt;
import com.github.javaparser.ast.stmt.Statement;
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import mak.db.MetaDataDef;
import mak.out.OUTXmlBuilder;
import org.kles.m3.M3Component;
import org.kles.m3.M3Connector;
import org.kles.m3.comparator.DBComparator;
import org.kles.m3.comparator.Diff;
import org.kles.m3.comparator.OUTComparator;
import org.kles.model.Customer;
import org.kles.model.Environment;
import org.kles.model.process.M3AnalyzeModel;
import org.kles.model.process.M3AnalyzeModelWrapper;
import org.kles.parser.JParser;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Jeremy.CHAUT
 */
public class MainTEST {

    //Faiveley
    /*public String[] listSpe = {
    "X:/M3X1/env/DEV/Fix/CFT/HFix/bindbg/",
    "X:/M3X1/env/DEV/Fix/CFT/VFix/bindbg/",
    "X:/M3X1/CFT/1412/SP1412C52811/bindbg/",
    "X:/M3X1/CFT/1412/SP1412C52492/bindbg/",
    "X:/M3X1/CFT/1412/base/bindbg/",
    "X:/M3X1/env/DEV/Fix/XRT/TFix/bindbg/",
    "X:/M3X1/env/DEV/Fix/XRT/VFix/bindbg/",
    "X:/M3X1/XRT/1412/base/bindbg/",
    "X:/M3X1/env/DEV/Fix/MI3/TFix/bindbg/",
    "X:/M3X1/MI3/1412/base/bindbg/",
    "X:/M3X1/env/DEV/Fix/MVX/HFix/bindbg/",
    "X:/M3X1/env/DEV/Fix/MVX/TFix/bindbg/",
    "X:/M3X1/env/DEV/Fix/MVX/TFix/common/DeliveryDocs.jar",
    "X:/M3X1/env/DEV/Fix/MVX/TFix/common/ProcessFlowSupport.jar",
    "X:/M3X1/env/DEV/Fix/MVX/TFix/common/bpm-interfaces.jar",
    "X:/M3X1/env/DEV/Fix/MVX/TFix/common/bpm-lpsforlsf.jar",
    "X:/M3X1/env/DEV/Fix/MVX/VFix/bindbg/",
    "X:/M3X1/MVX/1412/base/bindbg/",
    "X:/M3X1/env/DEV/Fix/FND/TFix/Foundation",
    "X:/M3X1/FND/9044/Foundation.jar",
    "X:/M3X1/MVX/1412/base/common/axis.jar",
    "X:/M3X1/MVX/1412/base/common/bpm-sdk.jar",
    "X:/M3X1/MVX/1412/base/common/commonsDiscovery.jar",
    "X:/M3X1/MVX/1412/base/common/commonsLogging.jar",
    "X:/M3X1/MVX/1412/base/common/jaxrpc.jar",
    "X:/M3X1/MVX/1412/base/common/log4j.jar",
    "X:/M3X1/MVX/1412/base/common/saaj.jar",
    "X:/M3X1/MVX/1412/base/common/wsdl4j.jar"
    };*/

    //ALEHOS
    public String[] listSpe = { "Y:/M3BE/env/PREP/Fix/ALS/VFix/bindbg/", "Y:/M3BE/ALS/1310/SP1310C61469/bindbg/",
            "Y:/M3BE/ALS/1310/base/bindbg/", "Y:/M3BE/CERG/1310/base/bindbg/", "Y:/M3BE/env/PREP/Properties/",
            "Y:/M3BE/env/PREP/Fix/MVX/HFix/bindbg/", "Y:/M3BE/env/PREP/Fix/MVX/TFix/bindbg/",
            "Y:/M3BE/env/PREP/Fix/MVX/VFix/bindbg/", "Y:/M3BE/MVX/1310/SP1310S51031/bindbg/",
            "Y:/M3BE/MVX/1310/base/bindbg/", "Y:/M3BE/env/PREP/Fix/FND/TFix/Foundation/",
            "Y:/M3BE/FND/133/Foundation.jar", "Y:/M3BE/FND/133/common/activation.jar",
            "Y:/M3BE/FND/133/common/adonix.jar", "Y:/M3BE/FND/133/common/asm.jar",
            "Y:/M3BE/FND/133/common/axis-ant.jar", "Y:/M3BE/FND/133/common/axis.jar",
            "Y:/M3BE/FND/133/common/backport-util-concurrent-3.1-osgi.jar",
            "Y:/M3BE/FND/133/common/commons-codec-1.3.jar", "Y:/M3BE/FND/133/common/commons-discovery-0.2.jar",
            "Y:/M3BE/FND/133/common/commons-lang-2.1.jar", "Y:/M3BE/FND/133/common/commons-logging-1.0.4.jar",
            "Y:/M3BE/FND/133/common/commons-net-2.0.jar", "Y:/M3BE/FND/133/common/commons-net-ftp-2.0.jar",
            "Y:/M3BE/FND/133/common/commonsCollections.jar", "Y:/M3BE/FND/133/common/commonsLogging.jar",
            "Y:/M3BE/FND/133/common/commonsPool.jar", "Y:/M3BE/FND/133/common/cryptixJceProvider.jar",
            "Y:/M3BE/FND/133/common/derby.jar", "Y:/M3BE/FND/133/common/freemarker.jar",
            "Y:/M3BE/FND/133/common/FndAPI.jar", "Y:/M3BE/FND/133/common/javamail.jar",
            "Y:/M3BE/FND/133/common/jaxrpc.jar", "Y:/M3BE/FND/133/common/jcifs.jar",
            "Y:/M3BE/FND/133/common/json.jar", "Y:/M3BE/FND/133/common/jsr173_1.0_api.jar",
            "Y:/M3BE/FND/133/common/jt400.jar", "Y:/M3BE/FND/133/common/jtds.jar",
            "Y:/M3BE/FND/133/common/junit.jar", "Y:/M3BE/FND/133/common/log4j.jar",
            "Y:/M3BE/FND/133/common/mneMetadataUtil.jar", "Y:/M3BE/FND/133/common/mprolog.jar",
            "Y:/M3BE/FND/133/common/MvxMpdCommon.jar",
            "Y:/M3BE/FND/133/common/org.apache.commons.httpclient_3.1.0.v20080605-1935.jar",
            "Y:/M3BE/FND/133/common/org.jdom_1.0.0.v201005080400.jar", "Y:/M3BE/FND/133/common/PDFBox-0.7.3.jar",
            "Y:/M3BE/FND/133/common/saaj.jar", "Y:/M3BE/FND/133/common/servitrax.jar",
            "Y:/M3BE/FND/133/common/servlet.jar", "Y:/M3BE/FND/133/common/snmp.jar",
            "Y:/M3BE/FND/133/common/soap.jar", "Y:/M3BE/FND/133/common/sqljdbc4.jar",
            "Y:/M3BE/FND/133/common/stax-1.2.0.jar", "Y:/M3BE/FND/133/common/SysInfo.jar",
            "Y:/M3BE/FND/133/common/wsdl4j-1.5.1.jar", "Y:/M3BE/FND/133/common/xercesXercesImpl.jar",
            "Y:/M3BE/FND/133/common/xercesXmlApis.jar", "Y:/M3BE/FND/133/common/xmlenc.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/axis2-jaxws-api-1.2.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/Chronopost_2.0.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/InterfaceM3OptiTime.V2_R4.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/jaxb-api.jar", "Y:/M3BE/env/PREP/Drivers/jdbc/jaxb-impl-2.2.6.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/jaxb-xjc-2.2.jar", "Y:/M3BE/env/PREP/Drivers/jdbc/jms.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/neocaseClient.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/opt-ffa-api-external-jdk5-8.0.2.4.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/OAGI_JAXB.jar", "Y:/M3BE/env/PREP/Drivers/jdbc/tibcrypt.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/tibjms.jar", "Y:/M3BE/env/PREP/Drivers/jdbc/tibjmsadmin.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/tibjmsapps.jar", "Y:/M3BE/env/PREP/Drivers/jdbc/tibjmsufo.jar",
            "Y:/M3BE/env/PREP/Drivers/jdbc/tibrvjms.jar" };

    /*public String[] listSpe = {"Y:/M3BE/env/DVLP/Fix/ALS/HFix/bindbg/",
    "Y:/M3BE/env/DVLP/Fix/ALS/VFix/bindbg/",
    "Y:/M3BE/ALS/1310/SP1310C53229/bindbg/",
    "Y:/M3BE/ALS/1310/base/bindbg/",
    "Y:/M3BE/env/DVLP/Fix/CERG/HFix/bindbg/",
    "Y:/M3BE/env/DVLP/Fix/CERG/VFix/bindbg/",
    "Y:/M3BE/CERG/1310/base/bindbg/",
    "Y:/M3BE/env/DVLP/Properties/",
    "Y:/M3BE/env/DVLP/Fix/MVX/HFix/bindbg/",
    "Y:/M3BE/env/DVLP/Fix/MVX/TFix/bindbg/",
    "Y:/M3BE/env/DVLP/Fix/MVX/VFix/bindbg/",
    "Y:/M3BE/MVX/1310/SP1310S51031/bindbg/",
    "Y:/M3BE/MVX/1310/base/bindbg/",
    "Y:/M3BE/env/DVLP/Fix/FND/TFix/Foundation/",
    "Y:/M3BE/FND/133/Foundation.jar",
    "Y:/M3BE/FND/133/common/activation.jar",
    "Y:/M3BE/FND/133/common/adonix.jar",
    "Y:/M3BE/FND/133/common/asm.jar",
    "Y:/M3BE/FND/133/common/axis-ant.jar",
    "Y:/M3BE/FND/133/common/axis.jar",
    "Y:/M3BE/FND/133/common/backport-util-concurrent-3.1-osgi.jar",
    "Y:/M3BE/FND/133/common/commons-codec-1.3.jar",
    "Y:/M3BE/FND/133/common/commons-discovery-0.2.jar",
    "Y:/M3BE/FND/133/common/commons-lang-2.1.jar",
    "Y:/M3BE/FND/133/common/commons-logging-1.0.4.jar",
    "Y:/M3BE/FND/133/common/commons-net-2.0.jar",
    "Y:/M3BE/FND/133/common/commons-net-ftp-2.0.jar",
    "Y:/M3BE/FND/133/common/commonsCollections.jar",
    "Y:/M3BE/FND/133/common/commonsLogging.jar",
    "Y:/M3BE/FND/133/common/commonsPool.jar",
    "Y:/M3BE/FND/133/common/cryptixJceProvider.jar",
    "Y:/M3BE/FND/133/common/derby.jar",
    "Y:/M3BE/FND/133/common/freemarker.jar",
    "Y:/M3BE/FND/133/common/FndAPI.jar",
    "Y:/M3BE/FND/133/common/javamail.jar",
    "Y:/M3BE/FND/133/common/jaxrpc.jar",
    "Y:/M3BE/FND/133/common/jcifs.jar",
    "Y:/M3BE/FND/133/common/json.jar",
    "Y:/M3BE/FND/133/common/jsr173_1.0_api.jar",
    "Y:/M3BE/FND/133/common/jt400.jar",
    "Y:/M3BE/FND/133/common/jtds.jar",
    "Y:/M3BE/FND/133/common/junit.jar",
    "Y:/M3BE/FND/133/common/log4j.jar",
    "Y:/M3BE/FND/133/common/mneMetadataUtil.jar",
    "Y:/M3BE/FND/133/common/mprolog.jar",
    "Y:/M3BE/FND/133/common/MvxMpdCommon.jar",
    "Y:/M3BE/FND/133/common/org.apache.commons.httpclient_3.1.0.v20080605-1935.jar",
    "Y:/M3BE/FND/133/common/org.jdom_1.0.0.v201005080400.jar",
    "Y:/M3BE/FND/133/common/PDFBox-0.7.3.jar",
    "Y:/M3BE/FND/133/common/saaj.jar",
    "Y:/M3BE/FND/133/common/servitrax.jar",
    "Y:/M3BE/FND/133/common/servlet.jar",
    "Y:/M3BE/FND/133/common/snmp.jar",
    "Y:/M3BE/FND/133/common/soap.jar",
    "Y:/M3BE/FND/133/common/sqljdbc4.jar",
    "Y:/M3BE/FND/133/common/stax-1.2.0.jar",
    "Y:/M3BE/FND/133/common/SysInfo.jar",
    "Y:/M3BE/FND/133/common/wsdl4j-1.5.1.jar",
    "Y:/M3BE/FND/133/common/xercesXercesImpl.jar",
    "Y:/M3BE/FND/133/common/xercesXmlApis.jar",
    "Y:/M3BE/FND/133/common/xmlenc.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/axis2-jaxws-api-1.2.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/Chronopost_2.0.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/InterfaceM3OptiTime.V2_R4.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/jaxb-api.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/jaxb-impl-2.2.6.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/jaxb-xjc-2.2.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/jms.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/neocaseClient.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/opt-ffa-api-external-jdk5-8.0.2.4.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/OAGI_JAXB.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/tibcrypt.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/tibjms.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/tibjmsadmin.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/tibjmsapps.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/tibjmsufo.jar",
    "Y:/M3BE/env/DVLP/Drivers/jdbc/tibrvjms.jar"};
    */
    public String[] listStd = { "Y:/M3BE/env/DVLP/Properties", "Y:/M3BE/env/DVLP/Fix/MVX/HFix/bindbg",
            "Y:/M3BE/env/DVLP/Fix/MVX/TFix/bindbg", "Y:/M3BE/env/DVLP/Fix/MVX/VFix/bindbg",
            "Y:/M3BE/MVX/1310/SP1310S51031/bindbg", "Y:/M3BE/MVX/1310/base/bindbg",
            "Y:/M3BE/env/DVLP/Fix/FND/TFix/Foundation", "Y:/M3BE/FND/133/Foundation.jar",
            "Y:/M3BE/FND/133/common/activation.jar", "Y:/M3BE/FND/133/common/adonix.jar",
            "Y:/M3BE/FND/133/common/asm.jar", "Y:/M3BE/FND/133/common/axis-ant.jar",
            "Y:/M3BE/FND/133/common/axis.jar", "Y:/M3BE/FND/133/common/backport-util-concurrent-3.1-osgi.jar",
            "Y:/M3BE/FND/133/common/commons-codec-1.3.jar", "Y:/M3BE/FND/133/common/commons-discovery-0.2.jar",
            "Y:/M3BE/FND/133/common/commons-lang-2.1.jar", "Y:/M3BE/FND/133/common/commons-logging-1.0.4.jar",
            "Y:/M3BE/FND/133/common/commons-net-2.0.jar", "Y:/M3BE/FND/133/common/commons-net-ftp-2.0.jar",
            "Y:/M3BE/FND/133/common/commonsCollections.jar", "Y:/M3BE/FND/133/common/commonsLogging.jar",
            "Y:/M3BE/FND/133/common/commonsPool.jar", "Y:/M3BE/FND/133/common/cryptixJceProvider.jar",
            "Y:/M3BE/FND/133/common/derby.jar", "Y:/M3BE/FND/133/common/freemarker.jar",
            "Y:/M3BE/FND/133/common/FndAPI.jar", "Y:/M3BE/FND/133/common/javamail.jar",
            "Y:/M3BE/FND/133/common/jaxrpc.jar", "Y:/M3BE/FND/133/common/jcifs.jar",
            "Y:/M3BE/FND/133/common/json.jar", "Y:/M3BE/FND/133/common/jsr173_1.0_api.jar",
            "Y:/M3BE/FND/133/common/jt400.jar", "Y:/M3BE/FND/133/common/jtds.jar",
            "Y:/M3BE/FND/133/common/junit.jar", "Y:/M3BE/FND/133/common/log4j.jar",
            "Y:/M3BE/FND/133/common/mneMetadataUtil.jar", "Y:/M3BE/FND/133/common/mprolog.jar",
            "Y:/M3BE/FND/133/common/MvxMpdCommon.jar",
            "Y:/M3BE/FND/133/common/org.apache.commons.httpclient_3.1.0.v20080605-1935.jar",
            "Y:/M3BE/FND/133/common/org.jdom_1.0.0.v201005080400.jar", "Y:/M3BE/FND/133/common/PDFBox-0.7.3.jar",
            "Y:/M3BE/FND/133/common/saaj.jar", "Y:/M3BE/FND/133/common/servitrax.jar",
            "Y:/M3BE/FND/133/common/servlet.jar", "Y:/M3BE/FND/133/common/snmp.jar",
            "Y:/M3BE/FND/133/common/soap.jar", "Y:/M3BE/FND/133/common/sqljdbc4.jar",
            "Y:/M3BE/FND/133/common/stax-1.2.0.jar", "Y:/M3BE/FND/133/common/SysInfo.jar",
            "Y:/M3BE/FND/133/common/wsdl4j-1.5.1.jar", "Y:/M3BE/FND/133/common/xercesXercesImpl.jar",
            "Y:/M3BE/FND/133/common/xercesXmlApis.jar", "Y:/M3BE/FND/133/common/xmlenc.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/axis2-jaxws-api-1.2.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/Chronopost_2.0.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/InterfaceM3OptiTime.V2_R4.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/jaxb-api.jar", "Y:/M3BE/env/DVLP/Drivers/jdbc/jaxb-impl-2.2.6.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/jaxb-xjc-2.2.jar", "Y:/M3BE/env/DVLP/Drivers/jdbc/jms.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/neocaseClient.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/opt-ffa-api-external-jdk5-8.0.2.4.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/OAGI_JAXB.jar", "Y:/M3BE/env/DVLP/Drivers/jdbc/tibcrypt.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/tibjms.jar", "Y:/M3BE/env/DVLP/Drivers/jdbc/tibjmsadmin.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/tibjmsapps.jar", "Y:/M3BE/env/DVLP/Drivers/jdbc/tibjmsufo.jar",
            "Y:/M3BE/env/DVLP/Drivers/jdbc/tibrvjms.jar" };

    public static void main(String[] args) throws Exception {
        MainTEST m = new MainTEST();
        //        m.OUTTest();
        //       m.PGMTest();
        m.DBTest();

        //m.testJaxbModel();
        //        Excel xl = new Excel();
        //        Sheet s = xl.getWorkbook().createSheet("Test");
        //        String[][] data = new String[1][5];
        //        data[0][0] = "Data1";
        //        data[0][1] = "Data2";
        //        data[0][2] = "Data3";
        //        data[0][3] = "Data4";
        //        data[0][4] = "Data5";
        //
        //        xl.writeXlsTable(s, "Environnement", new String[]{"1", "2", "3", "4", "5"}, data, 2, 5);
        //        xl.save("TestXLS.xls");
        //m.PGMTest();
        //JParser.createCUTest();
    }

    private void testJaxbModel() {

        Customer cust = new Customer("TEST");
        Environment env = new Environment("DVLP");
        M3Connector connector = new M3Connector(env);
        LinkedHashMap<String, M3Component> listSpeComp = new LinkedHashMap();
        M3Component comp = new M3Component("ALSCOMP");
        listSpeComp.put("ALS", comp);
        M3AnalyzeModel m = new M3AnalyzeModel(cust, connector);
        m.getListObjectType().addAll(new String[] {});
        m.setListSpecificComponent(listSpeComp);
        //m.setMvxSrc();

        try {
            JAXBContext context = JAXBContext.newInstance(M3AnalyzeModelWrapper.class);
            Marshaller marsh = context.createMarshaller();
            marsh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
            M3AnalyzeModelWrapper wrapper = new M3AnalyzeModelWrapper();
            List<M3AnalyzeModel> listModel = new ArrayList<>();
            listModel.add(m);
            wrapper.setModel(listModel);
            File fileData = new File("M3Analyzes.xml");
            marsh.marshal(wrapper, fileData);
        } catch (JAXBException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void DBTest() throws MalformedURLException {
        ClassLoader loaderSpe = new URLClassLoader(createURLList(listSpe));
        ClassLoader loaderStd = new URLClassLoader(createURLList(listStd));
        MetaDataDef defSrc = getMetaDataDef(loaderSpe, "OCUSMA");
        MetaDataDef defStd = getMetaDataDef(loaderStd, "OCUSMA");
        //    LinkedHashMap<String, LinkedHashMap<String, List<Diff>>> listDiff = DBComparator.compare(defSrc, defStd);
    }

    public URL[] createURLList(String[] list) {
        ArrayList<URL> ar = new ArrayList<>();
        for (String s : list) {
            try {
                ar.add(new URL("file:/" + s));
            } catch (MalformedURLException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        return ar.toArray(new URL[ar.size()]);
    }

    protected MetaDataDef getMetaDataDef(ClassLoader loader, String name) {
        try {
            return new MetaDataDef(loader, name);
        } catch (InstantiationException | IOException | IllegalAccessException | ClassNotFoundException ex) {
            System.err.println(ex);
        }
        return null;
    }

    private void OUTTest() throws FileNotFoundException {
        //OutModelManager modelSrc = new OutModelManager(new File("Y:\\M3BE\\MVX\\1310\\SP1310S51031\\src\\mvx\\out\\obj\\MWS435OUT.java"));
        OUTXmlBuilder xmlTarg = OUTComparator
                .OUTJavaToXML(new File("Y:\\M3BE\\MVX\\1310\\SP1310S51031\\src\\mvx\\out\\obj\\MWS435OUT.java"));
        xmlTarg.buildXml();
        OUTXmlBuilder xmlSrc = OUTComparator
                .OUTJavaToXML(new File("Y:\\M3BE\\env\\DVLP\\Fix\\ALS\\VFix\\src\\mvx\\out\\obj\\MWS435OUT.java"));
        xmlSrc.buildXml();
        LinkedHashMap<String, LinkedHashMap<String, List<Diff>>> listDiff = OUTComparator.compare(xmlSrc, xmlTarg);
        OUTComparator.buildNewOUT(xmlTarg, listDiff);
    }

    private void PGMTest() throws FileNotFoundException, ParseException, IOException, Exception {
        FileInputStream in = new FileInputStream(
                "Y:\\M3BE\\env\\DVLP\\Fix\\ALS\\HFix\\src\\mvx\\app\\pgm\\customer\\ALJ999.java");
        //FileInputStream in = new FileInputStream("X:\\M3X1\\env\\DEV\\Fix\\CFT\\HFix\\src\\mvx\\app\\pgm\\customer\\COS100.java");
        //JParser parser=new JParser("X:\\M3X1\\env\\DEV\\Fix\\CFT\\HFix\\src\\mvx\\app\\pgm\\customer\\COS100.java");
        CompilationUnit cu;
        try {
            // parse the file
            cu = JavaParser.parse(in);
            String importsFormat = "";
            importsFormat = cu.getImports().toString();
            importsFormat = importsFormat.replace("[", "");
            importsFormat = importsFormat.replace(",", "");
            importsFormat = importsFormat.replace("\r\n", "");
            importsFormat = importsFormat.replace("]", "");

            /*List<TypeDeclaration> lstDec = cu.getTypes();
             for (TypeDeclaration d : lstDec) {
             //System.out.println("Dec="+d.getName()+" ");
             List<BodyDeclaration> lstBody = d.getMembers();
             for (BodyDeclaration bdec : lstBody) {
             bdec.getData();
             }
                
             }*/
            new FieldDeclarationVisitor().visit(cu, null);
            new VariableVisitor().visit(cu, null);

            // visit and print the methods names
            new MethodVisitor().visit(cu, null);

            // visit and change the methods names and parameters
            //new MethodChangerVisitor().visit(cu, null);
        } finally {
            in.close();
        }
    }

    private static class ClassOrInterfaceDeclarationVisitor extends VoidVisitorAdapter {

        String result = "";

        @Override
        public void visit(ClassOrInterfaceDeclaration m, Object arg) {
            System.out.println("ClassOrInterface=" + m.getExtends().get(0));

        }
    }

    private static class VariableVisitor extends VoidVisitorAdapter {

        @Override
        public void visit(VariableDeclarator n, Object arg) {
            System.out.println("Variable " + n.getId() + "=" + n.getInit());
        }
    }

    private static class FieldDeclarationVisitor extends VoidVisitorAdapter {

        @Override
        public void visit(FieldDeclaration n, Object arg) {
            System.out.println("Field " + n.toStringWithoutComments());
        }
    }

    private static class MethodVisitor extends VoidVisitorAdapter {

        @Override
        public void visit(MethodDeclaration n, Object arg) {
            // here you can access the attributes of the method.
            // this method will be called for all methods in this 
            // CompilationUnit, including inner class methods
            System.out.println(n.getName());
            System.out.println("################");
            BlockStmt block = n.getBody();
            for (Statement st : block.getStmts()) {
                System.out.println(st.toString());
                System.out.println("Line=" + st.getBeginLine() + " Column=" + st.getBeginColumn());
                System.out.println("Line=" + st.getEndLine() + " Column=" + st.getEndColumn());
            }
            System.out.println("###################");
            System.out.println(n.getBody());
            System.out.println("###################");
        }
    }

    private static class MethodChangerVisitor extends VoidVisitorAdapter {

        @Override
        public void visit(MethodDeclaration n, Object arg) {
            // change the name of the method to upper case
            n.setName(n.getName().toUpperCase());

            // create the new parameter
            Parameter newArg = ASTHelper.createParameter(ASTHelper.INT_TYPE, "value");

            // add the parameter to the method
            ASTHelper.addParameter(n, newArg);
        }
    }

    private static CompilationUnit createCU() {
        CompilationUnit cu = new CompilationUnit();
        // set the package
        cu.setPackage(new PackageDeclaration(ASTHelper.createNameExpr("java.parser.test")));

        // create the type declaration 
        ClassOrInterfaceDeclaration type = new ClassOrInterfaceDeclaration(ModifierSet.PUBLIC, false,
                "GeneratedClass");
        ASTHelper.addTypeDeclaration(cu, type);

        // create a method
        MethodDeclaration method = new MethodDeclaration(ModifierSet.PUBLIC, ASTHelper.VOID_TYPE, "main");
        method.setModifiers(ModifierSet.addModifier(method.getModifiers(), ModifierSet.STATIC));
        ASTHelper.addMember(type, method);

        // add a parameter to the method
        Parameter param = ASTHelper.createParameter(ASTHelper.createReferenceType("String", 0), "args");
        param.setVarArgs(true);
        ASTHelper.addParameter(method, param);

        // add a body to the method
        BlockStmt block = new BlockStmt();
        method.setBody(block);

        // add a statement do the method body
        NameExpr clazz = new NameExpr("System");
        FieldAccessExpr field = new FieldAccessExpr(clazz, "out");
        MethodCallExpr call = new MethodCallExpr(field, "println");
        ASTHelper.addArgument(call, new StringLiteralExpr("Hello World!"));
        ASTHelper.addStmt(block, call);

        return cu;
    }
}