⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jrfctest.java

📁 SAP这个系统的一个转换器
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   JRfcTest.java

package com.sap.mw.jco.support;

import com.sap.mw.jco.*;
import java.io.PrintStream;
import java.util.*;

// Referenced classes of package com.sap.mw.jco.support:
//            RfcTest

public class JRfcTest extends RfcTest
{

    public JRfcTest()
    {
    }

    public static void main(String args[])
    {
        String answer = null;
        int choose = -1;
        do
        {
            usage();
            do
            {
                answer = RfcTest.ask(space2 + "Your Choice.......", null);
                if(answer != null)
                    try
                    {
                        choose = Integer.parseInt(answer);
                    }
                    catch(NumberFormatException ex) { }
            } while((choose <= 0 || choose >= 20) && choose != 99);
            switch(choose)
            {
            case 1: // '\001'
                header(RFC_SYSTEM_INFO, "Get system info of a RFC Server");
                defineParameters(new String[] {
                    CONNECTION_PARAM, RFC_SPECIFIC_PARAM, SAP_LOGON_PARAM
                });
                runRfcSystemInfoTest();
                break;

            case 2: // '\002'
                header(CONNECTION_TEST, "Send message and wait for ECHO/INFO");
                defineParameters(new String[] {
                    CONNECTION_PARAM, RFC_SPECIFIC_PARAM, SAP_LOGON_PARAM
                });
                runConnectionTest();
                break;

            case 3: // '\003'
                header(PERFORMANCE_TEST, "Send/Receive internal tables");
                defineParameters(new String[] {
                    CONNECTION_PARAM, RFC_SPECIFIC_PARAM, SAP_LOGON_PARAM, PERFORMANCE_PARAM
                });
                runPerformanceTest();
                break;

            case 4: // '\004'
                header(STRUCTURE_TEST, "Send/Receive inhomogeneous structure/table");
                defineParameters(new String[] {
                    CONNECTION_PARAM, RFC_SPECIFIC_PARAM, SAP_LOGON_PARAM
                });
                runStructureTest();
                break;

            case 15: // '\017'
                header(TRANSACTIONAL_RFC, "Test for transactional RFC call");
                defineParameters(new String[] {
                    CONNECTION_PARAM, RFC_SPECIFIC_PARAM, SAP_LOGON_PARAM
                });
                runTranRfcTest();
                break;
            }
            if(choose != 99)
            {
                RfcTest.out.println("\n\n");
                choose = -1;
                do
                {
                    answer = RfcTest.ask(space2 + "Continue (y/n)..................", null);
                    if(answer == null)
                    {
                        answer = "temp";
                        continue;
                    }
                    if(!answer.equalsIgnoreCase("n"))
                        continue;
                    choose = 99;
                    break;
                } while(!answer.equalsIgnoreCase("y"));
            }
            storeProperties();
        } while(choose != 99);
    }

    private static void initProperties()
    {
        propValues.setProperty("jco.client.type", "3");
        propValues.setProperty("jco.client.load_balancing", "Y");
        propValues.setProperty("jco.client.iashost", "binmain");
        propValues.setProperty("jco.client.isysnr", "53");
        propValues.setProperty("jco.client.ir3name", "BIN");
        propValues.setProperty("jco.client.imhost", "binmain");
        propValues.setProperty("jco.client.igroup", "PUBLIC");
        propValues.setProperty("jco.client.isnc_mode", "N");
        propValues.setProperty("jco.client.snc_mode", "0");
        propValues.setProperty("jco.client.idest", "K50");
        propValues.setProperty("jco.client.igwhost", "IHSAP4");
        propValues.setProperty("jco.client.igwserv", "sapgw00");
        propValues.setProperty("jco.client.registprog", "Y");
        propValues.setProperty("jco.client.tpid", "jrfcserv");
        propValues.setProperty("jco.client.itpname", "/bas/BIN/gen/dbg/nintel/srfcserv");
        propValues.setProperty("jco.client.itphost", "binmain");
        propValues.setProperty("jco.client.iprofile_name", "profil_gen.txt");
        propValues.setProperty("jco.client.isnc_lib", "C:\\Program Files\\SECUDE\\SECUDE for R3\\secude.dll");
        propValues.setProperty("jco.client.isnc_partnername", "s:sample@hs0335");
        propValues.setProperty("jco.client.iabap_debug", "N");
        propValues.setProperty("jco.client.iuse_sapgui", "N");
        propValues.setProperty("jco.client.sapgui_invisible", "N");
        propValues.setProperty("jco.client.itrace", "N");
        propValues.setProperty("jco.client.jco_trace_level", "0");
        propValues.setProperty("jco.client.iclient", "000");
        propValues.setProperty("jco.client.iuser", "SAPCPIC");
        propValues.setProperty("jco.client.ipasswd", "XXXXXX");
        propValues.setProperty("jco.client.ilang", "E");
        propValues.setProperty("jco.gui.test_type", "F");
        propValues.setProperty("jco.gui.fm_name", "STFC_SAPGUI");
        propValues.setProperty("jco.gui.transaction_name", "SE38");
        propValues.setProperty("jco.perform.elength0332", "0");
        propValues.setProperty("jco.perform.elength1000", "0");
        propValues.setProperty("jco.perform.ilength0332", "0");
        propValues.setProperty("jco.perform.ilength1000", "0");
        propValues.setProperty("jco.perform.checktable", "N");
        propValues.setProperty("jco.perform.display_tab", "N");
        propValues.setProperty("jco.run.number_of_calls", "1");
        propValues.setProperty("jco.run.close_connect", "N");
        loadProperties();
    }

    private static void loadProperties()
    {
        Properties prop = RfcTest.loadProperties(properties_filename);
        String name;
        for(Enumeration names = prop.propertyNames(); names.hasMoreElements(); propValues.setProperty(name, prop.getProperty(name)))
            name = (String)names.nextElement();

    }

    private static void storeProperties()
    {
        propValues.remove("jco.client.r3name");
        propValues.remove("jco.client.mhost");
        propValues.remove("jco.client.group");
        propValues.remove("jco.client.ashost");
        propValues.remove("jco.client.sysnr");
        propValues.remove("jco.client.tpname");
        propValues.remove("jco.client.tphost");
        propValues.remove("jco.client.gwhost");
        propValues.remove("jco.client.gwserv");
        propValues.remove("jco.client.dest");
        propValues.remove("jco.client.profile_name");
        propValues.remove("jco.client.snc_mode");
        propValues.remove("jco.client.snc_lib");
        propValues.remove("jco.client.snc_partnername");
        propValues.remove("jco.client.abap_debug");
        propValues.remove("jco.client.use_sapgui");
        propValues.remove("jco.client.trace");
        propValues.remove("jco.client.client");
        propValues.remove("jco.client.user");
        propValues.remove("jco.client.passwd");
        propValues.remove("jco.client.lang");
        propReposValues.clear();
        RfcTest.storeProperties(propValues, properties_filename, "client properties of JRfcTest");
    }

    private static void defineParameters(String categories[])
    {
        for(int i = 0; i < categories.length; i++)
        {
            RfcTest.out.println("\n" + space2 + categories[i]);
            if(categories[i].equals(CONNECTION_PARAM))
                displayConnectionParam(0);
            else
            if(categories[i].equals(RFC_SPECIFIC_PARAM))
                displayRfcSpecificParam(0);
            else
            if(categories[i].equals(SAP_LOGON_PARAM))
                displaySapLogonParam(0);
            else
            if(categories[i].equals(PERFORMANCE_PARAM))
                displayPerformanceParam(0);
            else
            if(categories[i].equals(SAPGUI_PARAM))
                displaySapGuiParam(0);
        }

        displayNumberOfCalls(0);
        String answer;
        do
        {
            answer = RfcTest.ask(space2 + "Do You Want To Test With These Parameters (Y/N)..", null);
            if(answer == null)
                answer = "temp";
        } while(!answer.equalsIgnoreCase("Y") && !answer.equalsIgnoreCase("N"));
        if(answer.equalsIgnoreCase("N"))
            do
            {
                for(int i = 0; i < categories.length; i++)
                {
                    RfcTest.out.println("\n" + space2 + categories[i]);
                    if(categories[i].equals(CONNECTION_PARAM))
                        displayConnectionParam(1);
                    else
                    if(categories[i].equals(RFC_SPECIFIC_PARAM))
                        displayRfcSpecificParam(1);
                    else
                    if(categories[i].equals(SAP_LOGON_PARAM))
                        displaySapLogonParam(1);
                    else
                    if(categories[i].equals(PERFORMANCE_PARAM))
                        displayPerformanceParam(1);
                    else
                    if(categories[i].equals(SAPGUI_PARAM))
                        displaySapGuiParam(1);
                }

                displayNumberOfCalls(1);
                do
                {
                    answer = RfcTest.ask(space2 + "Do You Want To Test With These Parameters (Y/N)..", null);
                    if(answer == null)
                        answer = "temp";
                } while(!answer.equalsIgnoreCase("Y") && !answer.equalsIgnoreCase("N"));
            } while(!answer.equalsIgnoreCase("Y"));
    }

    private static void usage()
    {
        RfcTest.out.println("\n\n\n");
        RfcTest.out.println(space2 + "**********************************************");
        RfcTest.out.println(space2 + "*                                            *");
        RfcTest.out.println(space2 + "*            SAP JCo Client Test             *");
        RfcTest.out.println(space2 + "*                                            *");
        RfcTest.out.println(space2 + "*                                            *");
        RfcTest.out.println(space2 + "**********************************************");
        RfcTest.out.println();
        RfcTest.out.println(space1 + "Possible SAP JCo-Tests");
        RfcTest.out.println();
        RfcTest.out.println(space1 + " 1. RFC_SYSTEM_INFO");
        RfcTest.out.println(space1 + " 2. CONNECTION");
        RfcTest.out.println(space1 + " 3. PERFORMANCE");
        RfcTest.out.println(space1 + " 4. INHOMOGENEOUS STRUCTURE/TABLE");
        RfcTest.out.println(space1 + "15. TRANSACTIONAL RFC ");
        RfcTest.out.println(space1 + "99. Exit");
        RfcTest.out.println();
    }

    private static void header(String function, String description)
    {
        RfcTest.out.println("\n\n\n");
        RfcTest.out.println(space2 + "**********************************************");
        RfcTest.out.println();
        RfcTest.out.println(space2 + "       SAP JCo TEST - " + function);
        RfcTest.out.println(space2 + "       " + description);
        RfcTest.out.println();
        RfcTest.out.println(space2 + "**********************************************");
    }

    private static void displayConnectionParam(int mode)
    {
        display("jco.client.type", mode, SERVER_TYPE_ANSWER);
        if(propValues.getProperty("jco.client.type").equals("3"))
        {
            display("jco.client.load_balancing", mode, YN_ANSWER);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -