use of iso.std.iso_iec._24727.tech.schema.CardInfo in project open-ecard by ecsec.
the class CardInfoWrapperTest method test.
/**
* Simple test for CardInfoWrapper-class. After getting the CardInfoWrapper for the npa we
* check if the get-methods return the expected values.
*
* @throws Exception when something in this test went unexpectedly wrong
*/
@Test
public void test() throws Exception {
new Expectations() {
{
cifp.getCardInfo(anyString);
result = null;
}
};
Environment env = new ClientEnv();
env.setCIFProvider(cifp);
CardRecognitionImpl recognition = new CardRecognitionImpl(env);
CardInfoType cardInfo = recognition.getCardInfo("http://bsi.bund.de/cif/npa.xml");
CardInfoWrapper cardInfoWrapper = new CardInfoWrapper(cardInfo, null);
assertEquals(cardInfoWrapper.getCardType(), "http://bsi.bund.de/cif/npa.xml");
assertEquals(cardInfoWrapper.getImplicitlySelectedApplication(), rootApplication);
assertEquals(cardInfoWrapper.getCardApplications().size(), 3);
assertEquals(cardInfoWrapper.getDataSetNameList(rootApplication).getDataSetName().size(), 5);
assertEquals(cardInfoWrapper.getCardApplicationNameList().size(), 3);
// CardApplicationWrapper cardApplicationWrapper = cardInfoWrapper.getCardApplication(rootApplication);
}
use of iso.std.iso_iec._24727.tech.schema.CardInfo in project open-ecard by ecsec.
the class SALStateCallback method signalEvent.
@Override
public void signalEvent(EventType eventType, EventObject eventData) {
if (eventData instanceof IfdEventObject) {
IfdEventObject ifdEvtData = (IfdEventObject) eventData;
ConnectionHandleType handle = ifdEvtData.getHandle();
switch(eventType) {
// only add cards with a cardinfo file
case CARD_RECOGNIZED:
LOG.info("Add ConnectionHandle to SAL:\n{}", HandlePrinter.printHandle(handle));
String cardType = handle.getRecognitionInfo().getCardType();
CardInfoType cif = env.getCIFProvider().getCardInfo(handle, cardType);
if (cif != null) {
manager.addCredential(handle, ifdEvtData.getIfaceProtocol(), cif);
} else {
LOG.info("Not adding card to SAL, because it has no CardInfo file.");
}
break;
case CARD_REMOVED:
LOG.info("Remove ConnectionHandle from SAL.\n{}", HandlePrinter.printHandle(handle));
manager.removeCredential(handle);
break;
default:
// not a relevant event
break;
}
}
}
Aggregations