Commit 82c58e9b authored by Sebastian Hans's avatar Sebastian Hans
Browse files

CR-032 SCP(16)000172

-adding the source code for the test
parent 824bd69c
Loading
Loading
Loading
Loading
+72 −0
Original line number Diff line number Diff line
//-----------------------------------------------------------------------------
//    Api_2_Trs_IsPrAv_1.java
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//    Package Definition
//-----------------------------------------------------------------------------
package uicc.test.toolkit.api_2_trs_isprav;

//-----------------------------------------------------------------------------
//  Imports
//-----------------------------------------------------------------------------
import uicc.test.util.* ;
import uicc.toolkit.*;



public class Api_2_Trs_IsPrAv_1 extends TestToolkitApplet
{

	private static byte bNbInstance = (byte)0 ;			 // instance number
	private byte		bMyInstanceId ;

    /**
     * Constructor of the applet
     */
    public Api_2_Trs_IsPrAv_1() 
    {
    }

    /**
     * Method called by the JCRE at the installation of the applet
     */
    public static void install(byte bArray[], short bOffset, byte bLength) 
    {
        // Create a new applet instance
        Api_2_Trs_IsPrAv_1 thisApplet = new Api_2_Trs_IsPrAv_1();
 
        // Register the new applet instance to the JCRE
        thisApplet.register(bArray, (short)(bOffset+1), bArray[bOffset]);

		// Initialise the data of the test applet
        thisApplet.init();

		// register instance with the EVENT_PROACTIVE_HANDLER_AVAILABLE  event
		thisApplet.obReg.setEvent(EVENT_PROACTIVE_HANDLER_AVAILABLE);
    }


    /**
     * Method called by the UICC CRE
     */
    public void processToolkit(short event) 
    {
		if (event == EVENT_PROACTIVE_HANDLER_AVAILABLE) {
			try {  
				if ( ToolkitRegistrySystem.isPrioritizedProactiveHandlerAvailableEventSet() == true ) {
					reportTestOutcome((byte)1, true) ;
				}
				else {
					reportTestOutcome((byte)1, false) ;
				}				
			} 
			catch (Exception e) {
				reportTestOutcome((byte)1, false) ;
			}
		}
	}
}


+87 −0
Original line number Diff line number Diff line
//-----------------------------------------------------------------------------
//    Api_2_Trs_IsPrAv_2.java
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//    Package Definition
//-----------------------------------------------------------------------------
package uicc.test.toolkit.api_2_trs_isprav;

//-----------------------------------------------------------------------------
//  Imports
//-----------------------------------------------------------------------------
import uicc.test.util.* ;
import uicc.toolkit.*;



public class Api_2_Trs_IsPrAv_2 extends TestToolkitApplet
{

	private static byte bNbInstance = (byte)0 ;			 // instance number
	private byte		bMyInstanceId ;

    /**
     * Constructor of the applet
     */
    public Api_2_Trs_IsPrAv_2() 
    {
		Api_2_Trs_IsPrAv_2.bNbInstance ++;
		this.bMyInstanceId = bNbInstance;
    }

    /**
     * Method called by the JCRE at the installation of the applet
     */
    public static void install(byte bArray[], short bOffset, byte bLength) 
    {
        // Create a new applet instance
        Api_2_Trs_IsPrAv_2 thisApplet = new Api_2_Trs_IsPrAv_2();
 
        // Register the new applet instance to the JCRE
        thisApplet.register(bArray, (short)(bOffset+1), bArray[bOffset]);

		// Initialise the data of the test applet
        thisApplet.init();

		// register instance with the EVENT_PROACTIVE_HANDLER_AVAILABLE  event
		thisApplet.obReg.setEvent(EVENT_PROACTIVE_HANDLER_AVAILABLE);
    }


    /**
     * Method called by the UICC CRE
     */
    public void processToolkit(short event) 
    {
	    if (event == EVENT_PROACTIVE_HANDLER_AVAILABLE) 
		{
			try{
				switch(bMyInstanceId){
					case (byte)1:
                        if ( ToolkitRegistrySystem.isPrioritizedProactiveHandlerAvailableEventSet() == false) {
						    reportTestOutcome((byte)1, true);
					    }
					    else {
						    reportTestOutcome((byte)1, false);
					    }					
					    break;
					case (byte)2: 
					    if ( ToolkitRegistrySystem.isPrioritizedProactiveHandlerAvailableEventSet() == true ) {
						    reportTestOutcome((byte)1, true) ;
					    }
					    else {
						    reportTestOutcome((byte)1, false) ;
					    }
					    break;
					default: reportTestOutcome ((byte)1, false);
				}
			}
			catch(Exception e){
			}
		}			
	}
}


+177 −0
Original line number Diff line number Diff line
//-----------------------------------------------------------------------------
//    Package Definition
//-----------------------------------------------------------------------------
package uicc.test.toolkit.api_2_trs_isprav;

//-----------------------------------------------------------------------------
//  Imports
//-----------------------------------------------------------------------------
import org.etsi.scp.wg3.uicc.jcapi.userinterface.*;
import org.etsi.scp.wg3.uicc.jcapi.userclass.*;

public class Test_Api_2_Trs_IsPrAv extends UiccTestModel {

    static final String CAP_FILE_PATH = "uicc/test/toolkit/api_2_trs_isprav";
    static final String CLASS_AID_1 = "A0000000 090005FF FFFFFF89 50010001";
    static final String APPLET_AID_1 = "A0000000 090005FF FFFFFF89 50010102";
    static final String APPLET_AID_2 = "A0000000 090005FF FFFFFF89 50010202";
	static final String APPLET_AID_3 = "A0000000 090005FF FFFFFF89 50010302";
	static final String APPLET_AID_4 = "A0000000 090005FF FFFFFF89 50010402";
   
    private UiccAPITestCardService test;
    APDUResponse response;
      
          
    public Test_Api_2_Trs_IsPrAv() {
        test = UiccAPITestCardService.getTheUiccTestCardService();
    }
    
    public boolean run() {
        APDUResponse data = null;
        initialiseResults();
        
        // test script
        test.reset();
        test.terminalProfileSession(UiccCardManagementService.DEFAULT_TERMINAL_PROFILE);

        // Install package
        test.loadPackage(CAP_FILE_PATH);
        
        /*********************************************************************/
        /** Testcase 1                                                       */
        /*********************************************************************/

        // Install Applet1
        test.installApplet(CAP_FILE_PATH, CLASS_AID_1, APPLET_AID_1, 
                           "8008" + // TLV UICC Toolkit application specific parameters
                               "01" +   // V Priority Level
                               "00" +   // V Max. number of timers
                               "0A" +   // V Maximum text length for a menu entry
                               "00" +   // V Maximum number of menu entries
                               "00" +   // V Maximum number of channels 
                               "00" +   // LV Minimum Security Level field
                               "00" +   // LV TAR Value(s) 
                               "00");   // V Maximum number of services
        
		addResult(response.checkSw("9000"));
		
        // Install Applet2
        test.installApplet(CAP_FILE_PATH, CLASS_AID_1, APPLET_AID_2, 
                           "8008" + // TLV UICC Toolkit application specific parameters
                               "02" +   // V Priority Level
                               "00" +   // V Max. number of timers
                               "0A" +   // V Maximum text length for a menu entry
                               "00" +   // V Maximum number of menu entries
                               "00" +   // V Maximum number of channels 
                               "00" +   // LV Minimum Security Level field
                               "00" +   // LV TAR Value(s) 
                               "00");   // V Maximum number of services
							   
	    addResult(response.checkSw("9000"));
        
        // Card Initialisation
        test.reset();
        test.terminalProfileSession("09030020 21");
        
        // Trigger the applets
        response = test.envelopeEventProactiveHandlerAvailable();
        addResult(response.checkSw("9000"));
        

        /*********************************************************************/
        /*********************************************************************/
        /** Check Applets                                                    */
        /*********************************************************************/
        /*********************************************************************/

        response = test.selectApplication(APPLET_AID_1);
        addResult(response.checkData("10" + APPLET_AID_1 + "01" + "CC"));
        response = test.selectApplication(APPLET_AID_2);
        addResult(response.checkData("10" + APPLET_AID_2 + "01" + "CC"));


        /*********************************************************************/
        /*********************************************************************/
        /** Restore  card                                                    */
        /*********************************************************************/
        /*********************************************************************/

        test.reset();
        test.terminalProfileSession(UiccCardManagementService.DEFAULT_TERMINAL_PROFILE);
        // delete applets and package
        test.deleteApplet(APPLET_AID_1);
        test.deleteApplet(APPLET_AID_2);
        test.deletePackage(CAP_FILE_PATH);
	    addResult(response.checkSw("9000"));
        
        /*********************************************************************/
        /** Testcase 2                                                       */
        /*********************************************************************/

        // Install Applet1
        test.installApplet(CAP_FILE_PATH, CLASS_AID_1, APPLET_AID_3, 
                           "8008" + // TLV UICC Toolkit application specific parameters
                               "01" +   // V Priority Level
                               "00" +   // V Max. number of timers
                               "0A" +   // V Maximum text length for a menu entry
                               "00" +   // V Maximum number of menu entries
                               "00" +   // V Maximum number of channels 
                               "00" +   // LV Minimum Security Level field
                               "00" +   // LV TAR Value(s) 
                               "00");   // V Maximum number of services
							   
 	    addResult(response.checkSw("9000"));    
		
        // Install Applet2
        test.installApplet(CAP_FILE_PATH, CLASS_AID_1, APPLET_AID_4, 
                           "8008" + // TLV UICC Toolkit application specific parameters
                               "01" +   // V Priority Level
                               "00" +   // V Max. number of timers
                               "0A" +   // V Maximum text length for a menu entry
                               "00" +   // V Maximum number of menu entries
                               "00" +   // V Maximum number of channels 
                               "00" +   // LV Minimum Security Level field
                               "00" +   // LV TAR Value(s) 
                               "00");   // V Maximum number of services
 
	    addResult(response.checkSw("9000"));
		
        // Card Initialisation
        test.reset();
        test.terminalProfileSession("09030020 21");
        
        // Trigger the applets
        response = test.envelopeEventProactiveHandlerAvailable();
        addResult(response.checkSw("9000"));
        

        /*********************************************************************/
        /*********************************************************************/
        /** Check Applets                                                    */
        /*********************************************************************/
        /*********************************************************************/

        response = test.selectApplication(APPLET_AID_3);
        addResult(response.checkData("10" + APPLET_AID_1 + "01" + "CC"));
        response = test.selectApplication(APPLET_AID_4);
        addResult(response.checkData("10" + APPLET_AID_2 + "01" + "CC"));


        /*********************************************************************/
        /*********************************************************************/
        /** Restore  card                                                    */
        /*********************************************************************/
        /*********************************************************************/

        test.reset();
        test.terminalProfileSession(UiccCardManagementService.DEFAULT_TERMINAL_PROFILE);
        // delete applets and package
        test.deleteApplet(APPLET_AID_3);
        test.deleteApplet(APPLET_AID_4);
        test.deletePackage(CAP_FILE_PATH);        
 	    addResult(response.checkSw("9000"));
        
		
        return getOverallResult();
    }
}