本文整理了Java中eu.europa.esig.dss.utils.Utils.collectionSize()
方法的一些代码示例,展示了Utils.collectionSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.collectionSize()
方法的具体详情如下:
包路径:eu.europa.esig.dss.utils.Utils
类名称:Utils
方法名:collectionSize
暂无
代码示例来源:origin: esig/dss
@Override
protected boolean process() {
return Utils.collectionSize(trustServicesAtTime) == 1;
}
代码示例来源:origin: esig/dss
private boolean isQualifierInAdditionServiceInfos(List<String> qualifiers, List<String> asis) {
if (Utils.collectionSize(asis) >= 1) {
// Cannot have more than 1 usage (>1 is covered in
// TrustedServiceUsageConsistency)
if (Utils.collectionSize(qualifiers) == 1) {
String currentUsage = qualifiers.get(0);
String expectedASI = CORRESPONDANCE_MAP_QUALIFIER_ASI.get(currentUsage);
return asis.contains(expectedASI);
}
}
return true;
}
代码示例来源:origin: esig/dss
private boolean sameContent(List<String> coveredFiles, List<String> contentFiles) {
if (Utils.collectionSize(coveredFiles) == Utils.collectionSize(contentFiles)) {
boolean findAll = true;
for (String content : contentFiles) {
findAll &= coveredFiles.contains(content);
}
if (findAll) {
for (String covered : coveredFiles) {
findAll &= contentFiles.contains(covered);
}
}
return findAll;
}
return false;
}
代码示例来源:origin: esig/dss
public static boolean isForeSealsOnly(List<String> additionalServiceInfos) {
return Utils.collectionSize(additionalServiceInfos) == 1 && isForeSeals(additionalServiceInfos);
}
代码示例来源:origin: esig/dss
public static boolean isForWebAuthOnly(List<String> additionalServiceInfos) {
return Utils.collectionSize(additionalServiceInfos) == 1 && isForWebAuth(additionalServiceInfos);
}
代码示例来源:origin: esig/dss
/**
* Returns the id of the token. The signature is identified by its index: 0 for the first one.
*
* @param index
* (position/order) of the signature within the report
* @return {@code String} identifying the token
*/
public String getBasicBuildingBlocksSignatureId(final int index) {
List<XmlBasicBuildingBlocks> bbbs = jaxbDetailedReport.getBasicBuildingBlocks();
if (Utils.collectionSize(bbbs) >= index) {
XmlBasicBuildingBlocks bbb = jaxbDetailedReport.getBasicBuildingBlocks().get(index);
if (bbb != null) {
return bbb.getId();
}
}
return null;
}
代码示例来源:origin: esig/dss
@Test
public void collectionSize() {
assertEquals(0, Utils.collectionSize(null));
assertEquals(0, Utils.collectionSize(new ArrayList<String>()));
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c");
assertEquals(3, Utils.collectionSize(list));
}
代码示例来源:origin: esig/dss
TrustedServiceWrapper selectedTrustedService = null;
if (Utils.collectionSize(trustServices) == 1) {
selectedTrustedService = trustServices.get(0);
} else if (Utils.isCollectionNotEmpty(trustServices)) {
代码示例来源:origin: esig/dss
@Override
protected boolean process() {
if (Utils.collectionSize(timestamps) <= 1) {
return true;
代码示例来源:origin: esig/dss
@Override
protected boolean process() {
/* ASiC-S -> nb files = 1 */
if ("ASiC-S".equals(containerInfo.getContainerType())) {
return 1 == Utils.collectionSize(containerInfo.getContentFiles());
} else if ("ASiC-E".equals(containerInfo.getContainerType())) {
String signatureFilename = signature.getSignatureFilename();
List<String> coveredFiles = getCoveredFilesBySignatureFilename(signatureFilename);
List<String> contentFiles = containerInfo.getContentFiles();
// check manifest <> content
if (!sameContent(coveredFiles, contentFiles)) {
return false;
}
// XAdES -> check signature scope
if (signature.getFormat().startsWith("XAdES")) {
List<String> coveredFilesFromScope = getCoveredFilesFromScope();
return sameContent(coveredFilesFromScope, contentFiles);
}
// CAdES -> manifest file is signed
return true;
}
return false;
}
代码示例来源:origin: esig/dss
@Test
public void getCAAccessLocations() {
CertificateToken certificate = DSSUtils.loadCertificate(new File("src/test/resources/ec.europa.eu.crt"));
List<String> caLocations = DSSASN1Utils.getCAAccessLocations(certificate);
assertEquals(1, Utils.collectionSize(caLocations));
assertEquals("http://ca.luxtrust.lu/LTQCA.crt", caLocations.get(0));
}
代码示例来源:origin: esig/dss
@Test
public void getAccessLocation() {
CertificateToken certificate = DSSUtils.loadCertificate(new File("src/test/resources/ec.europa.eu.crt"));
List<String> ocspAccessLocations = DSSASN1Utils.getOCSPAccessLocations(certificate);
assertEquals(1, Utils.collectionSize(ocspAccessLocations));
assertEquals("http://ocsp.luxtrust.lu", ocspAccessLocations.get(0));
}
代码示例来源:origin: esig/dss
@Test
public void getCrlUrls() {
CertificateToken certificate = DSSUtils.loadCertificate(new File("src/test/resources/ec.europa.eu.crt"));
List<String> crlUrls = DSSASN1Utils.getCrlUrls(certificate);
assertEquals(1, Utils.collectionSize(crlUrls));
assertEquals("http://crl.luxtrust.lu/LTQCA.crl", crlUrls.get(0));
}
代码示例来源:origin: esig/dss
@Test
public void testCreateNewKeystore() throws IOException {
KeyStoreCertificateSource kscs = new KeyStoreCertificateSource(KEYSTORE_TYPE, KEYSTORE_PASSWORD);
CertificateToken token = DSSUtils.loadCertificate(new File("src/test/resources/citizen_ca.cer"));
kscs.addCertificateToKeyStore(token);
kscs.store(new FileOutputStream("target/new_keystore.jks"));
KeyStoreCertificateSource kscs2 = new KeyStoreCertificateSource("target/new_keystore.jks", KEYSTORE_TYPE, KEYSTORE_PASSWORD);
assertEquals(1, Utils.collectionSize(kscs2.getCertificates()));
}
代码示例来源:origin: esig/dss
@Test
public void testLoadAddAndDelete() throws IOException {
KeyStoreCertificateSource kscs = new KeyStoreCertificateSource(new File(KEYSTORE_FILEPATH), KEYSTORE_TYPE, KEYSTORE_PASSWORD);
assertNotNull(kscs);
int startSize = Utils.collectionSize(kscs.getCertificates());
assertTrue(startSize > 0);
CertificateToken token = DSSUtils.loadCertificate(new File("src/test/resources/citizen_ca.cer"));
kscs.addCertificateToKeyStore(token);
int sizeAfterAdd = Utils.collectionSize(kscs.getCertificates());
assertEquals(sizeAfterAdd,startSize + 1);
String tokenId = token.getDSSIdAsString();
CertificateToken certificate = kscs.getCertificate(tokenId);
assertNotNull(certificate);
kscs.deleteCertificateFromKeyStore(tokenId);
int sizeAfterDelete = Utils.collectionSize(kscs.getCertificates());
assertEquals(sizeAfterDelete,startSize);
}
代码示例来源:origin: esig/dss
if (Utils.collectionSize(caqcServicesAtTime) > 1) {
内容来源于网络,如有侵权,请联系作者删除!