當前位置: 首頁>>代碼示例>>Java>>正文


Java TlvParser.parse方法代碼示例

本文整理匯總了Java中be.fedict.eid.applet.service.impl.tlv.TlvParser.parse方法的典型用法代碼示例。如果您正苦於以下問題:Java TlvParser.parse方法的具體用法?Java TlvParser.parse怎麽用?Java TlvParser.parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在be.fedict.eid.applet.service.impl.tlv.TlvParser的用法示例。


在下文中一共展示了TlvParser.parse方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testDuplicate02

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testDuplicate02() throws Exception {
	// setup
	InputStream inputStream = TlvParserTest.class.getResourceAsStream("/duplicate-02.tlv");
	byte[] identityData = IOUtils.toByteArray(inputStream);

	// operate
	Identity identity = TlvParser.parse(identityData, Identity.class);

	// verify
	LOG.debug("document type: " + identity.getDocumentType());
	assertEquals(DocumentType.FOREIGNER_A, identity.getDocumentType());
	LOG.debug("duplicate: " + identity.getDuplicate());
	assertEquals("02", identity.getDuplicate());
	LOG.debug("member of family: " + identity.isMemberOfFamily());
	assertTrue(identity.isMemberOfFamily());
	LOG.debug("special organisation: \"" + identity.getSpecialOrganisation() + "\"");
	assertEquals(SpecialOrganisation.RESEARCHER, identity.getSpecialOrganisation());
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:20,代碼來源:TlvParserTest.java

示例2: testExtendedMinority

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testExtendedMinority() throws Exception {
	// setup
	byte[] idFile = IOUtils.toByteArray(TlvParserTest.class.getResourceAsStream("/extended-minority.tlv"));

	// operate
	Identity identity = TlvParser.parse(idFile, Identity.class);

	// verify
	LOG.debug("special status: " + identity.specialStatus);
	assertEquals(SpecialStatus.EXTENDED_MINORITY, identity.specialStatus);
	assertFalse(identity.specialStatus.hasBadSight());
	assertTrue(identity.specialStatus.hasExtendedMinority());
	LOG.debug("special organisation: \"" + identity.getSpecialOrganisation() + "\"");
	assertNull(identity.getSpecialOrganisation());
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:17,代碼來源:TlvParserTest.java

示例3: testDateAndCountryOfProtection

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testDateAndCountryOfProtection() throws Exception {
	// setup
	byte[] idFile = IOUtils.toByteArray(TlvParserTest.class.getResourceAsStream("/dateandcountry.tlv"));

	// operate
	Identity identity = TlvParser.parse(idFile, Identity.class);

	// verify
	LOG.debug("document type: " + identity.documentType);
	LOG.debug("date and country of protection: " + identity.getDateAndCountryOfProtection());
	assertEquals("13.08.2014-IT", identity.getDateAndCountryOfProtection());
	LOG.debug("date of protection: " + identity.getDateOfProtection().getTime());
	assertEquals(2014, identity.getDateOfProtection().get(Calendar.YEAR));
	assertEquals(8 - 1, identity.getDateOfProtection().get(Calendar.MONTH));
	assertEquals(13, identity.getDateOfProtection().get(Calendar.DAY_OF_MONTH));
	assertEquals("IT", identity.getCountryOfProtection());
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:19,代碼來源:TlvParserTest.java

示例4: parseAddressFile

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void parseAddressFile() throws Exception {
	// setup
	InputStream addressInputStream = TlvParserTest.class.getResourceAsStream("/address-alice.tlv");
	byte[] addressFile = IOUtils.toByteArray(addressInputStream);

	// operate
	Address address = TlvParser.parse(addressFile, Address.class);

	// verify
	assertNotNull(address);
	LOG.debug("street and number: " + address.streetAndNumber);
	assertEquals("Meirplaats 1 bus 1", address.streetAndNumber);
	LOG.debug("zip: " + address.zip);
	assertEquals("2000", address.zip);
	LOG.debug("municipality: " + address.municipality);
	assertEquals("Antwerpen", address.municipality);
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:19,代碼來源:TlvParserTest.java

示例5: testReadAddress

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testReadAddress() throws Exception {
	PcscEid pcscEidSpi = new PcscEid(new TestView(), this.messages);
	if (false == pcscEidSpi.isEidPresent()) {
		LOG.debug("insert eID card");
		pcscEidSpi.waitForEidPresent();
	}

	pcscEidSpi.readFile(PcscEid.IDENTITY_FILE_ID);
	byte[] addressFile = pcscEidSpi.readFile(PcscEid.ADDRESS_FILE_ID);
	pcscEidSpi.selectBelpicJavaCardApplet();

	pcscEidSpi.close();

	Address address = TlvParser.parse(addressFile, Address.class);
	LOG.debug("street and number: " + address.getStreetAndNumber());
	LOG.debug("zip: " + address.getZip());
	LOG.debug("municipality: " + address.getMunicipality());
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:20,代碼來源:PcscTest.java

示例6: testGermanIdentityFileDoB

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testGermanIdentityFileDoB() throws Exception {
	// setup
	byte[] idFileCaseInTheField = new byte[] { 12, 12, '2', '3', '.', 'S', 'E', 'P', '.', ' ', '1', '9', '8', '2' };

	// operate
	Identity identity = TlvParser.parse(idFileCaseInTheField, Identity.class);

	// verify
	assertNotNull(identity.getDateOfBirth());
	LOG.debug("date of birth: " + identity.getDateOfBirth().getTime());

	byte[] idFile = new byte[] { 12, 11, '2', '3', '.', 'S', 'E', 'P', '.', '1', '9', '8', '2' };
	Identity identity2 = TlvParser.parse(idFile, Identity.class);
	assertEquals(identity.getDateOfBirth(), identity2.getDateOfBirth());
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:17,代碼來源:TlvParserTest.java

示例7: testParseNewIdentityFile

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testParseNewIdentityFile() throws Exception {
	// setup
	InputStream inputStream = TlvParserTest.class.getResourceAsStream("/new-eid.txt");
	byte[] base64IdentityData = IOUtils.toByteArray(inputStream);
	byte[] identityData = Base64.decodeBase64(base64IdentityData);

	// operate
	Identity identity = TlvParser.parse(identityData, Identity.class);

	// verify
	LOG.debug("name: " + identity.getName());
	LOG.debug("first name: " + identity.getFirstName());
	LOG.debug("card validity date begin: " + identity.getCardValidityDateBegin().getTime());
	LOG.debug("document type: " + identity.getDocumentType());
	assertEquals(DocumentType.BELGIAN_CITIZEN, identity.getDocumentType());
	assertNull(identity.getDuplicate());
	assertFalse(identity.isMemberOfFamily());
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:20,代碼來源:TlvParserTest.java

示例8: testHCard

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testHCard() throws Exception {
	// setup
	InputStream inputStream = TlvParserTest.class.getResourceAsStream("/h-card.tlv");
	byte[] identityData = IOUtils.toByteArray(inputStream);

	// operate
	Identity identity = TlvParser.parse(identityData, Identity.class);

	// verify
	LOG.debug("document type: " + identity.getDocumentType());
	assertEquals(DocumentType.EUROPEAN_BLUE_CARD_H, identity.getDocumentType());
	LOG.debug("duplicate: " + identity.getDuplicate());
	assertEquals("01", identity.getDuplicate());
	assertTrue(identity.isMemberOfFamily());
	LOG.debug("special organisation: \"" + identity.getSpecialOrganisation() + "\"");
	assertEquals(SpecialOrganisation.UNSPECIFIED, identity.getSpecialOrganisation());
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:19,代碼來源:TlvParserTest.java

示例9: parseIdentityFile2

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void parseIdentityFile2() throws Exception {
	// setup
	InputStream idInputStream = TlvParserTest.class.getResourceAsStream("/id-alice-2.tlv");
	byte[] idFile = IOUtils.toByteArray(idInputStream);

	// operate
	Identity identity = TlvParser.parse(idFile, Identity.class);

	// verify
	assertNotNull(identity);
	LOG.debug("name: " + identity.name);
	assertEquals("SPECIMEN", identity.name);
	LOG.debug("first name: " + identity.firstName);
	assertEquals("Alice Geldigekaart0126", identity.firstName);
	LOG.debug("card number: " + identity.cardNumber);
	assertEquals("000000012629", identity.cardNumber);
	LOG.debug("card validity date begin: " + identity.cardValidityDateBegin.getTime());
	assertEquals(new GregorianCalendar(2003, 9, 24), identity.cardValidityDateBegin);
	LOG.debug("card validity date end: " + identity.cardValidityDateEnd.getTime());
	assertEquals(new GregorianCalendar(2008, 9, 24), identity.cardValidityDateEnd);
	LOG.debug("Card Delivery Municipality: " + identity.cardDeliveryMunicipality);
	assertEquals("Certipost Specimen", identity.cardDeliveryMunicipality);
	LOG.debug("national number: " + identity.nationalNumber);
	assertEquals("71715100070", identity.nationalNumber);
	LOG.debug("middle name: " + identity.middleName);
	assertEquals("A", identity.middleName);
	LOG.debug("nationality: " + identity.nationality);
	assertEquals("Belg", identity.nationality);
	LOG.debug("place of birth: " + identity.placeOfBirth);
	assertEquals("Hamont-Achel", identity.placeOfBirth);
	LOG.debug("gender: " + identity.gender);
	assertEquals(Gender.FEMALE, identity.gender);
	assertNotNull(identity.dateOfBirth);
	LOG.debug("date of birth: " + identity.dateOfBirth.getTime());
	assertEquals(new GregorianCalendar(1971, 0, 1), identity.dateOfBirth);
	assertNull(identity.getSpecialOrganisation());
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:39,代碼來源:TlvParserTest.java

示例10: testYellowCane

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testYellowCane() throws Exception {
	// setup
	byte[] idFile = IOUtils.toByteArray(TlvParserTest.class.getResourceAsStream("/yellow-cane.tlv"));

	// operate
	Identity identity = TlvParser.parse(idFile, Identity.class);

	// verify
	LOG.debug("special status: " + identity.specialStatus);
	assertEquals(SpecialStatus.YELLOW_CANE, identity.specialStatus);
	assertTrue(identity.specialStatus.hasBadSight());
	assertTrue(identity.specialStatus.hasYellowCane());
	assertFalse(identity.specialStatus.hasWhiteCane());
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:16,代碼來源:TlvParserTest.java

示例11: testWhiteCane

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testWhiteCane() throws Exception {
	// setup
	byte[] idFile = IOUtils.toByteArray(TlvParserTest.class.getResourceAsStream("/white-cane.tlv"));

	// operate
	Identity identity = TlvParser.parse(idFile, Identity.class);

	// verify
	LOG.debug("special status: " + identity.specialStatus);
	assertEquals(SpecialStatus.WHITE_CANE, identity.specialStatus);
	assertTrue(identity.specialStatus.hasBadSight());
	assertTrue(identity.specialStatus.hasWhiteCane());
	assertFalse(identity.specialStatus.hasYellowCane());
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:16,代碼來源:TlvParserTest.java

示例12: testStringIndexOutOfBoundsExceptionOnDateAndCountryOfProtection

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testStringIndexOutOfBoundsExceptionOnDateAndCountryOfProtection() throws Exception {
	// setup
	byte[] idFile = new byte[] { 21, 1, '0' };

	// operate
	Identity identity = TlvParser.parse(idFile, Identity.class);
	assertNull(identity.dateOfProtection);
	assertNull(identity.countryOfProtection);
	assertNotNull(identity.dateAndCountryOfProtection);
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:12,代碼來源:TlvParserTest.java

示例13: testInvalidDateTruncatedYear

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testInvalidDateTruncatedYear() throws Exception {
	byte[] yearOnlyTLV = new byte[] { 12, 3, '9', '8', '4' };

	try {
		TlvParser.parse(yearOnlyTLV, Identity.class);
		fail("Parser failed to throw exception at invalid date");
	} catch (RuntimeException rte) {
		// expected
	}
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:12,代碼來源:TlvParserTest.java

示例14: testInvalidDateUnknownMonth

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testInvalidDateUnknownMonth() throws Exception {
	byte[] yearOnlyTLV = new byte[] { 12, 12, '2', '0', ' ', 'J', 'U', 'N', 'O', ' ', '1', '9', '6', '4' };

	try {
		TlvParser.parse(yearOnlyTLV, Identity.class);
		fail("Parser failed to throw exception at invalid month");
	} catch (RuntimeException rte) {
		// expected
	}
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:12,代碼來源:TlvParserTest.java

示例15: testInvalidDateMissingDayOfMonth

import be.fedict.eid.applet.service.impl.tlv.TlvParser; //導入方法依賴的package包/類
@Test
public void testInvalidDateMissingDayOfMonth() throws Exception {
	byte[] yearOnlyTLV = new byte[] { 12, 8, 'S', 'E', 'P', ' ', '1', '9', '6', '4' };

	try {
		TlvParser.parse(yearOnlyTLV, Identity.class);
		fail("Parser failed to throw exception at missing day of month");
	} catch (RuntimeException rte) {
		// expected
	}
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:12,代碼來源:TlvParserTest.java


注:本文中的be.fedict.eid.applet.service.impl.tlv.TlvParser.parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。