|
14 | 14 | import static org.assertj.core.api.Assertions.*;
|
15 | 15 |
|
16 | 16 | import com.google.gson.JsonObject;
|
| 17 | +import org.calypsonet.terminal.calypso.WriteAccessLevel; |
17 | 18 | import org.calypsonet.terminal.calypso.card.CalypsoCardSelection;
|
18 | 19 | import org.calypsonet.terminal.reader.selection.CardSelectionManager;
|
19 | 20 | import org.calypsonet.terminal.reader.selection.spi.CardSelection;
|
@@ -54,15 +55,65 @@ public class CardSelectionManagerTest {
|
54 | 55 | + " \"readMode\":\"ONE_RECORD\","
|
55 | 56 | + " \"commandRef\":\"READ_RECORDS\","
|
56 | 57 | + " \"le\":\"00\","
|
57 |
| - + " \"name\":\"Read Records - SFI: 1h, REC: 2, READMODE: ONE_RECORD, EXPECTEDLENGTH: 0\"," |
58 | 58 | + " \"apduRequest\":{"
|
59 | 59 | + " \"apdu\":\"00B2020C00\","
|
60 | 60 | + " \"successfulStatusWords\":["
|
61 | 61 | + " \"9000\""
|
62 | 62 | + " ],"
|
63 | 63 | + " \"info\":\"Read Records - SFI: 1h, REC: 2, READMODE: ONE_RECORD, EXPECTEDLENGTH: 0\""
|
64 |
| - + " }," |
65 |
| - + " \"isCryptoServiceSynchronized\":false" |
| 64 | + + " }" |
| 65 | + + " }" |
| 66 | + + " }," |
| 67 | + + " {" |
| 68 | + + " \"type\":\"org.eclipse.keyple.card.calypso.CmdCardReadBinary\"," |
| 69 | + + " \"data\":{" |
| 70 | + + " \"sfi\":\"01\"," |
| 71 | + + " \"offset\":\"00\"," |
| 72 | + + " \"commandRef\":\"READ_BINARY\"," |
| 73 | + + " \"le\":\"0A\"," |
| 74 | + + " \"apduRequest\":{" |
| 75 | + + " \"apdu\":\"00B081000A\"," |
| 76 | + + " \"successfulStatusWords\":[" |
| 77 | + + " \"9000\"" |
| 78 | + + " ]," |
| 79 | + + " \"info\":\"Read Binary - SFI:01h, OFFSET:0, LENGTH:10\"" |
| 80 | + + " }" |
| 81 | + + " }" |
| 82 | + + " }," |
| 83 | + + " {" |
| 84 | + + " \"type\":\"org.eclipse.keyple.card.calypso.CmdCardReadRecords\"," |
| 85 | + + " \"data\":{" |
| 86 | + + " \"sfi\":\"01\"," |
| 87 | + + " \"firstRecordNumber\":\"01\"," |
| 88 | + + " \"recordSize\":\"00\"," |
| 89 | + + " \"readMode\":\"ONE_RECORD\"," |
| 90 | + + " \"commandRef\":\"READ_RECORDS\"," |
| 91 | + + " \"le\":\"03\"," |
| 92 | + + " \"apduRequest\":{" |
| 93 | + + " \"apdu\":\"00B2010C03\"," |
| 94 | + + " \"successfulStatusWords\":[" |
| 95 | + + " \"9000\"" |
| 96 | + + " ]," |
| 97 | + + " \"info\":\"Read Records - SFI: 1h, REC: 1, READMODE: ONE_RECORD, EXPECTEDLENGTH: 3\"" |
| 98 | + + " }" |
| 99 | + + " }" |
| 100 | + + " }," |
| 101 | + + " {" |
| 102 | + + " \"type\":\"org.eclipse.keyple.card.calypso.CmdCardOpenSecureSession\"," |
| 103 | + + " \"data\":{" |
| 104 | + + " \"writeAccessLevel\":\"DEBIT\"," |
| 105 | + + " \"isExtendedModeAllowed\":true," |
| 106 | + + " \"sfi\":\"00\"," |
| 107 | + + " \"recordNumber\":\"00\"," |
| 108 | + + " \"commandRef\":\"OPEN_SECURE_SESSION\"," |
| 109 | + + " \"le\":\"00\"," |
| 110 | + + " \"apduRequest\":{" |
| 111 | + + " \"apdu\":\"008A0302010000\"," |
| 112 | + + " \"successfulStatusWords\":[" |
| 113 | + + " \"9000\"" |
| 114 | + + " ]," |
| 115 | + + " \"info\":\"Open Secure Session - KEYINDEX:3, SFI:00h, REC:0 - PREOPEN\"" |
| 116 | + + " }" |
66 | 117 | + " }"
|
67 | 118 | + " }"
|
68 | 119 | + " ],"
|
@@ -113,6 +164,27 @@ public class CardSelectionManagerTest {
|
113 | 164 | + " \"9000\""
|
114 | 165 | + " ],"
|
115 | 166 | + " \"info\":\"Read Records - SFI: 1h, REC: 2, READMODE: ONE_RECORD, EXPECTEDLENGTH: 0\""
|
| 167 | + + " }," |
| 168 | + + " {" |
| 169 | + + " \"apdu\":\"00B081000A\"," |
| 170 | + + " \"successfulStatusWords\":[" |
| 171 | + + " \"9000\"" |
| 172 | + + " ]," |
| 173 | + + " \"info\":\"Read Binary - SFI:01h, OFFSET:0, LENGTH:10\"" |
| 174 | + + " }," |
| 175 | + + " {" |
| 176 | + + " \"apdu\":\"00B2010C03\"," |
| 177 | + + " \"successfulStatusWords\":[" |
| 178 | + + " \"9000\"" |
| 179 | + + " ]," |
| 180 | + + " \"info\":\"Read Records - SFI: 1h, REC: 1, READMODE: ONE_RECORD, EXPECTEDLENGTH: 3\"" |
| 181 | + + " }," |
| 182 | + + " {" |
| 183 | + + " \"apdu\":\"008A0302010000\"," |
| 184 | + + " \"successfulStatusWords\":[" |
| 185 | + + " \"9000\"" |
| 186 | + + " ]," |
| 187 | + + " \"info\":\"Open Secure Session - KEYINDEX:3, SFI:00h, REC:0 - PREOPEN\"" |
116 | 188 | + " }"
|
117 | 189 | + " ],"
|
118 | 190 | + " \"stopOnUnsuccessfulStatusWord\":false"
|
@@ -155,7 +227,10 @@ public void setUp() {
|
155 | 227 | .filterByDfName(AID)
|
156 | 228 | .setFileControlInformation(CalypsoCardSelection.FileControlInformation.FCI)
|
157 | 229 | .setFileOccurrence(CalypsoCardSelection.FileOccurrence.FIRST)
|
158 |
| - .prepareReadRecord(SFI, RECORD); |
| 230 | + .prepareReadRecord(SFI, RECORD) |
| 231 | + .prepareReadBinary(SFI, 0, 10) |
| 232 | + .prepareReadCounter(SFI, 1) |
| 233 | + .preparePreOpenSecureSession(WriteAccessLevel.DEBIT); |
159 | 234 | CardSelection genericCardSelection =
|
160 | 235 | GenericExtensionService.getInstance()
|
161 | 236 | .createCardSelection()
|
|
0 commit comments