Commit 787c8357 authored by Sebastian Hans's avatar Sebastian Hans
Browse files

Merge branch 'REL-16' into 'master'

Rel 16

See merge request scp/ts-102-268-uicc-api-testspec!1
parents 56d0d75e c84f475c
Loading
Loading
Loading
Loading
+101 −0
Original line number Diff line number Diff line
//-----------------------------------------------------------------------------
//    Package Definition
//-----------------------------------------------------------------------------
package uicc.test.example.uicc_example;

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

public class Test_uicc_example extends UiccTestModel {

    static final String CAP_FILE_PATH = "uicc/test/example/example/uicc_example";
    static final String CLASS_AID_1 = "A0000000 090002FF FFFFFF89 40010001";
    static final String APPLET_AID_1 = "A0000000 090002FF FFFFFF89 40010101";
    static final String CLASS_AID_2 = "A0000000 090002FF FFFFFF89 40020001";
    static final String APPLET_AID_2 = "A0000000 090002FF FFFFFF89 40020101";
    private UiccAPITestCardService test;
    APDUResponse response;

    public Test_uicc_example() {
        test = UiccAPITestCardService.getTheUiccTestCardService();
    }

    public boolean run() {

        boolean result = false;

        // start test
        test.reset();
        test.terminalProfileSession(UiccCardManagementService.DEFAULT_TERMINAL_PROFILE);

        // install package and applet
        test.loadPackage(CAP_FILE_PATH);
        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 

        // test script
        test.reset();
        test.terminalProfileSession("03010000 0102");

        // test case 1: trigger applet1
        test.envelopeEventDownloadBrowserTermination();

        // check results
        response = test.selectApplication(APPLET_AID_1);
        result = response.checkData("10" + APPLET_AID_1" +
                                    "01CC");

        // delete applet
        test.reset();
        test.terminalProfileSession(UiccCardManagementService.DEFAULT_TERMINAL_PROFILE);
        test.deleteApplet(APPLET_AID_1);

        // test case 2: Applet 2 installation
        test.installApplet(CAP_FILE_PATH, CLASS_AID_2, APPLET_AID_2, 
                            "800A" + // 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
                                "01" + // V Maximum number of menu entries
                                "01" + // V Id of menu entry 1       
                                "01" + // V Position of menu entry 1 
                                "00" + // V Maximum number of channels 
                                "00" + // LV Minimum Security Level field
                                "00" + // LV TAR Value(s) 
                                "00"); // V Maximum number of services 

        // Fetch setUpMenu proactive command
        response = test.fetch("12");                                              
        result &= response.checkData("D0108103 01210082 0281028D 05045465"
                                   + "7874");                             

        // Terminal response
        response = test.terminalResponse("81030121 00820282 81030100");   
        result &= response.checkSw("9000");                                       

        // check results
        response = test.selectApplication(APPLET_AID_2);
        result = response.checkData("10" + APPLET_AID_2" +
                                    "01CC");

        // delete applet and package
        test.reset();
        test.terminalProfileSession(UiccCardManagementService.DEFAULT_TERMINAL_PROFILE);
        test.deleteApplet(APPLET_AID_2);
        test.deletePackage(CAP_FILE_PATH);

        return result;
    }
}
+29 −0
Original line number Diff line number Diff line
/**
 * @author SCP WG3, ETSI
 * @version 0.01
 * UiccAPITestCardService defines method to get an object implementing interfaces
 * This class has to be adapted to proprietary environment...
 */
 
package org.etsi.scp.wg3.uicc.jcapi.userclass;



public class UiccAPITestCardService {

    public static UiccAPITestCardService TestReference = null;

    /**
     * static method to get a reference to UiccAPITestCardService 
     * @returns reference to the UiccAPITestCardService implementation class
     */
    public static UiccAPITestCardService getTheUiccTestCardService() {
        if (TestReference == null) {
            return new UiccAPITestCardService();
        }
        else {
            return TestReference;
        }
    }

}
+12 −0
Original line number Diff line number Diff line
/**
 * @author SCP WG3, ETSI
 * @version 0.10
 * UiccTestModel defines mandatory common methods for all tests 
 */
package org.etsi.scp.wg3.uicc.jcapi.userclass;


public abstract class UiccTestModel {

    public abstract boolean run();
}
+37 −0
Original line number Diff line number Diff line
/**
 * @author SCP WG3, ETSI
 * @version 0.10
 * ResponseAPDU Class creates Object handling with APDU responses
 */
package org.etsi.scp.wg3.uicc.jcapi.userinterface;


public interface APDUResponse {

    /**
     * Gives the Status Word returned by the card
     * @return Status Word, as String
     */
    public String getStatusWord();

    /**
     * Gives Data returned by the card
     * @return Data, as String
     */
    public String getData();

    /**
     * Check the received Status Word with expected Status Word
     * @param expectedSw expected StatusWord, as String
     * @return true or false, as boolean
     */
    public boolean checkSw(String expectedSw);

    /**
     * compare APDUResponse Object data with expected data
     * @param expectedData, as String
     * @return true or false, as boolean
     */
    public boolean checkData(String expectedData);

}
+42 −0
Original line number Diff line number Diff line
/**
 * @author SCP WG3, ETSI
 * @version 0.10
 * UiccAdministrativeCommandsService defines administrative methods from ETSI TS 102 222 specification 
 */
package org.etsi.scp.wg3.uicc.jcapi.userinterface;


public interface UiccAdministrativeCommandsService {

    /**
     * create a new file under the current DF or ADF, as described in TS 102 222.
     * @param Value field of the File control parameters TLV, as String
     * @param Logical Channel number, as String
     * @return ResponseAPDU Object
     */
    public APDUResponse createFile(String fcpValue);
    public APDUResponse createFile(String logicalChannel, String fcpValue);
    
    
    /**
     * initiate the deletion of an EF immediately under the current DF,
     * or a DF with its complete subtree, as described in TS 102 222.
     * @param File Id, as String
     * @param Logical Channel number, as String
     * @return ResponseAPDU Object
     */
    public APDUResponse deleteFile(String fileId);
    public APDUResponse deleteFile(String logicalChannel, String fileId);
    
    /**
     * resize a file under the current DF or ADF, as described in TS 102 222.
     * If used with BER TLV file, mode 0 shall be used.
     * @param File Id, as String
     * @param New size, as String
     * @param Logical Channel number, as String
     * @return ResponseAPDU Object
     */
    public APDUResponse resizeFile(String fileId, String size);
    public APDUResponse resizeFile(String logicalChannel, String fileId, String size);
    
}
Loading