use of iso.std.iso_iec._24727.tech.schema.CardApplicationPathType in project open-ecard by ecsec.
the class PINCompareProtocolTest method testDIDGet.
@Test(enabled = TESTS_ENABLED)
public void testDIDGet() {
CardApplicationPath cardApplicationPath = new CardApplicationPath();
CardApplicationPathType cardApplicationPathType = new CardApplicationPathType();
cardApplicationPathType.setCardApplication(this.appIdentifier_ROOT);
cardApplicationPath.setCardAppPathRequest(cardApplicationPathType);
CardApplicationPathResponse cardApplicationPathResponse = instance.cardApplicationPath(cardApplicationPath);
CardApplicationConnect cardApplicationConnect = new CardApplicationConnect();
cardApplicationPathType = cardApplicationPathResponse.getCardAppPathResultSet().getCardApplicationPathResult().get(0);
cardApplicationConnect.setCardApplicationPath(cardApplicationPathType);
CardApplicationConnectResponse result1 = instance.cardApplicationConnect(cardApplicationConnect);
DIDGet didGet = new DIDGet();
didGet.setDIDName("PIN.home");
didGet.setConnectionHandle(result1.getConnectionHandle());
DIDGetResponse result = instance.didGet(didGet);
assertEquals(result.getResult().getResultMajor(), "http://www.bsi.bund.de/ecard/api/1.1/resultmajor#ok");
assertEquals(result.getDIDStructure().getDIDName(), "PIN.home");
assertEquals(result.getDIDStructure().getDIDMarker().getClass(), PinCompareMarkerType.class);
PINCompareMarkerType pinCompareMarkerType = new PINCompareMarkerType((PinCompareMarkerType) result.getDIDStructure().getDIDMarker());
assertEquals(ByteUtils.toHexString(pinCompareMarkerType.getPINRef().getKeyRef()), "02");
// test with given correct scope
didGet = new DIDGet();
didGet.setDIDName("PIN.home");
didGet.setDIDScope(DIDScopeType.GLOBAL);
didGet.setConnectionHandle(result1.getConnectionHandle());
result = instance.didGet(didGet);
assertEquals(result.getResult().getResultMajor(), ECardConstants.Major.OK);
assertEquals(result.getDIDStructure().getDIDName(), "PIN.home");
assertEquals(result.getDIDStructure().getDIDMarker().getClass(), PinCompareMarkerType.class);
pinCompareMarkerType = new PINCompareMarkerType((PinCompareMarkerType) result.getDIDStructure().getDIDMarker());
assertEquals(ByteUtils.toHexString(pinCompareMarkerType.getPINRef().getKeyRef()), "02");
cardApplicationPath = new CardApplicationPath();
cardApplicationPathType = new CardApplicationPathType();
cardApplicationPathType.setCardApplication(this.appIdentifier_ESIGN);
cardApplicationPath.setCardAppPathRequest(cardApplicationPathType);
cardApplicationPathResponse = instance.cardApplicationPath(cardApplicationPath);
cardApplicationConnect = new CardApplicationConnect();
cardApplicationPathType = cardApplicationPathResponse.getCardAppPathResultSet().getCardApplicationPathResult().get(0);
cardApplicationConnect.setCardApplicationPath(cardApplicationPathType);
result1 = instance.cardApplicationConnect(cardApplicationConnect);
assertEquals(result1.getResult().getResultMajor(), ECardConstants.Major.OK);
didGet = new DIDGet();
didGet.setDIDName("PIN.home");
didGet.setDIDScope(DIDScopeType.LOCAL);
didGet.setConnectionHandle(result1.getConnectionHandle());
result = instance.didGet(didGet);
assertEquals(result.getResult().getResultMajor(), ECardConstants.Major.ERROR);
assertEquals(result.getResult().getResultMinor(), ECardConstants.Minor.SAL.NAMED_ENTITY_NOT_FOUND);
}
Aggregations