use of iso.std.iso_iec._24727.tech.schema.DataSetCreate in project open-ecard by ecsec.
the class TinySALTest method testDataSetCreate.
/**
* Test of dataSetCreate method, of class TinySAL.
*/
@Test(enabled = TESTS_ENABLED)
public void testDataSetCreate() {
System.out.println("dataSetCreate");
DataSetCreate parameters = new DataSetCreate();
// get path to esign
CardApplicationPath cardApplicationPath = new CardApplicationPath();
CardApplicationPathType cardApplicationPathType = new CardApplicationPathType();
cardApplicationPathType.setCardApplication(appIdentifier_ESIGN);
cardApplicationPath.setCardAppPathRequest(cardApplicationPathType);
CardApplicationPathResponse cardApplicationPathResponse = instance.cardApplicationPath(cardApplicationPath);
// connect to esign
CardApplicationConnect cardApplicationConnect = new CardApplicationConnect();
cardApplicationConnect.setCardApplicationPath(cardApplicationPathResponse.getCardAppPathResultSet().getCardApplicationPathResult().get(0));
CardApplicationConnectResponse result = instance.cardApplicationConnect(cardApplicationConnect);
assertEquals(ECardConstants.Major.OK, result.getResult().getResultMajor());
AccessControlListType accessControlList = new AccessControlListType();
parameters.setConnectionHandle(result.getConnectionHandle());
String dataSetName = "DataSetTest";
parameters.setDataSetName(dataSetName);
parameters.setDataSetACL(accessControlList);
DataSetCreateResponse resultDataSetCreate = instance.dataSetCreate(parameters);
assertEquals(ECardConstants.Major.OK, resultDataSetCreate.getResult().getResultMajor());
// list datasets of esign
DataSetList dataSetList = new DataSetList();
dataSetList.setConnectionHandle(result.getConnectionHandle());
DataSetListResponse dataSetListResponse = instance.dataSetList(dataSetList);
Iterator<String> it = dataSetListResponse.getDataSetNameList().getDataSetName().iterator();
boolean appFound = false;
while (it.hasNext()) {
String val = it.next();
if (val.equals(dataSetName)) {
appFound = true;
}
}
assertTrue(appFound);
assertEquals(ECardConstants.Major.OK, dataSetListResponse.getResult().getResultMajor());
}
Aggregations