use of org.dishevelled.bio.assembly.gfa2.Path in project dishevelled by heuermh.
the class AssemblyModel method setPaths.
/**
* Set the paths for this assembly model to the specified GFA 1.0 paths.
*
* @param paths zero or more GFA 1.0 paths, must not be null
* @param traversalsByPathName traversals keyed by path name, must not be null
*/
void setPaths(final Iterable<Path> paths, final ListMultimap<String, Traversal> traversalsByPathName) {
checkNotNull(paths);
checkNotNull(traversalsByPathName);
// reset if necessary
if (!this.paths.isEmpty()) {
setPath(null);
this.paths.clear();
traversals.clear();
traversalsByPath.clear();
}
// create traversals from paths if necessary
for (Path path : paths) {
List<Traversal> traversals = traversalsByPathName.get(path.getName());
traversalsByPath.putAll(path, traversals.isEmpty() ? traversalsFor(path) : traversals);
}
if (!traversalsByPath.isEmpty()) {
Set<Path> keys = traversalsByPath.keySet();
paths().addAll(keys);
setPath(keys.iterator().next());
}
}
use of org.dishevelled.bio.assembly.gfa2.Path in project jmulticard by ctt-gob-es.
the class SmartCafePkcs15Applet method preloadCertificates.
private void preloadCertificates() throws FileNotFoundException, Iso7816FourCardException, IOException, Asn1Exception, TlvException {
selectMasterFile();
// Seleccionamos el ODF, no nos devuelve FCI ni nada
selectFileById(ODF_PATH);
// Leemos el ODF
final byte[] odfBytes = readBinaryComplete(162);
final Odf odf = new Odf();
odf.setDerValue(odfBytes);
// Sacamos del ODF la ruta del CDF
final Path cdfPath = odf.getCdfPath();
// Leemos el CDF
final Cdf cdf = new Cdf();
try {
selectMasterFile();
final byte[] cdfBytes = selectFileByIdAndRead(cdfPath.getPathBytes());
cdf.setDerValue(cdfBytes);
} catch (final Exception e) {
throw new ApduConnectionException(// $NON-NLS-1$
"No se ha podido cargar el CDF de la tarjeta", // $NON-NLS-1$
e);
}
if (cdf.getCertificateCount() < 1) {
// $NON-NLS-1$
LOGGER.warning("La tarjeta no contiene ningun certificado");
}
for (int i = 0; i < cdf.getCertificateCount(); i++) {
try {
int fileLength = -1;
Location certLocation = new Location(cdf.getCertificatePath(i));
while (certLocation != null) {
final byte[] id = certLocation.getFile();
try {
fileLength = selectFileById(id);
} catch (final FileNotFoundException e) {
LOGGER.warning(// $NON-NLS-1$//$NON-NLS-2$
"El CDF indicaba un certificado en la ruta '" + certLocation + "', pero un elemento de esta no existe, se ignorara: " + e);
}
certLocation = certLocation.getChild();
}
final byte[] certBytes;
if (fileLength <= 0) {
// A veces hay punteros que apuntan a localizaciones vacias
LOGGER.warning(// $NON-NLS-1$ //$NON-NLS-2$
"El certificado " + i + " del dispositivo esta vacio");
continue;
}
certBytes = readBinaryComplete(fileLength);
CERTS_BY_ALIAS.put(cdf.getCertificateAlias(i), CertificateUtils.generateCertificate(certBytes));
} catch (final Exception e) {
// Puede darse el caso de que el puntero apunte a algo que no es un certificado
LOGGER.severe(// $NON-NLS-1$ //$NON-NLS-2$
"Error en la lectura del certificado " + i + " del dispositivo: " + e);
continue;
}
}
}
use of org.dishevelled.bio.assembly.gfa2.Path in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method zParameterDefinition.
/**
* Abstract Test 40 (/conf/edr/rc-z-definition): Validate that the vertical level query parameters are constructed correctly. (position)
* Abstract Test 56 (/conf/edr/rc-z-definition): Validate that the vertical level query parameters are constructed correctly. (area)
*
* @param testPoint the testPoint under test, never <code>null</code>
* @param model api definition, never <code>null</code>
*/
public void zParameterDefinition(TestPoint testPoint, OpenApi3 model) {
Parameter z = null;
String paramName = "z";
for (Path path : model.getPaths().values()) {
if (testPoint.getPath().equals(path.getPathString())) {
for (Operation op : path.getOperations().values()) {
for (Parameter param : op.getParameters()) {
if (hasName(param)) {
if (param.getName().equals(paramName)) {
z = param;
}
}
}
}
}
}
if (z != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(z.getName(), paramName, String.format(msg, "name", paramName, z.getName()));
assertEquals(z.getIn(), "query", String.format(msg, "in", "query", z.getIn()));
assertTrue(isRequired(z), String.format(msg, "required", "true", z.getRequired()));
assertEquals(z.getStyle(), "form", String.format(msg, "style", "form", z.getStyle()));
assertFalse(isExplode(z), String.format(msg, "explode", "false", z.getExplode()));
}
}
use of org.dishevelled.bio.assembly.gfa2.Path in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method resolutionxParameterDefinition.
/**
* <pre>
* Requirement A.25: /req/edr/resolution-x-definition Parameter resolution-x
* definition
* </pre>
* NOTE: Not referenced by ATS
*
* @param testPoint the testPoint under test, never <code>null</code>
* @param model api definition, never <code>null</code>
*/
public void resolutionxParameterDefinition(TestPoint testPoint, OpenApi3 model) {
Parameter resolutionx = null;
String paramName = "resolution-x";
for (Path path : model.getPaths().values()) {
if (testPoint.getPath().equals(path.getPathString())) {
for (Operation op : path.getOperations().values()) {
for (Parameter param : op.getParameters()) {
if (hasName(param)) {
if (param.getName().equals(paramName)) {
resolutionx = param;
}
}
}
}
}
}
if (resolutionx != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(resolutionx.getName(), paramName, String.format(msg, "name", paramName, resolutionx.getName()));
assertEquals(resolutionx.getIn(), "query", String.format(msg, "in", "query", resolutionx.getIn()));
assertFalse(isRequired(resolutionx), String.format(msg, "required", "false", resolutionx.getRequired()));
assertEquals(resolutionx.getStyle(), "form", String.format(msg, "style", "form", resolutionx.getStyle()));
assertFalse(isExplode(resolutionx), String.format(msg, "explode", "false", resolutionx.getExplode()));
}
}
use of org.dishevelled.bio.assembly.gfa2.Path in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method withinParameterDefinition.
/**
* <pre>
* Requirement A.21: /req/edr/within-definition Parameter within definition
* </pre>
* NOTE: Not referenced by ATS
*
* @param testPoint the testPoint under test, never <code>null</code>
* @param model api definition, never <code>null</code>
*/
public void withinParameterDefinition(TestPoint testPoint, OpenApi3 model) {
// Based on
// https://github.com/RepreZen/KaiZen-OpenApi-Parser/blob/master/GettingStarted.md
Parameter within = null;
String paramName = "within";
for (Path path : model.getPaths().values()) {
if (testPoint.getPath().equals(path.getPathString())) {
for (Operation op : path.getOperations().values()) {
for (Parameter param : op.getParameters()) {
if (hasName(param)) {
if (param.getName().equals(paramName)) {
within = param;
}
}
}
}
}
}
if (within != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(within.getName(), paramName, String.format(msg, "name", paramName, within.getName()));
assertEquals(within.getIn(), "query", String.format(msg, "in", "query", within.getIn()));
assertFalse(isRequired(within), String.format(msg, "required", "false", within.getRequired()));
assertEquals(within.getStyle(), "form", String.format(msg, "style", "form", within.getStyle()));
assertFalse(isExplode(within), String.format(msg, "explode", "false", within.getExplode()));
}
}
Aggregations