use of com.reprezen.kaizen.oasparser.model3.Path in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method corridorHeightParameterDefinition.
/**
* <pre>
* Abstract Test 120: Validate that the corridor-height query parameter is constructed correctly.
* </pre>
*
* @param testPoint the testPoint under test, never <code>null</code>
* @param model api definition, never <code>null</code>
*/
public void corridorHeightParameterDefinition(TestPoint testPoint, OpenApi3 model) {
Parameter corridorHeight = null;
String paramName = "corridor-height";
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)) {
corridorHeight = param;
}
}
}
}
}
}
if (corridorHeight != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(corridorHeight.getName(), paramName, String.format(msg, "name", paramName, corridorHeight.getName()));
assertEquals(corridorHeight.getIn(), "query", String.format(msg, "in", "query", corridorHeight.getIn()));
assertTrue(isRequired(corridorHeight), String.format(msg, "required", "true", corridorHeight.getRequired()));
assertEquals(corridorHeight.getStyle(), "form", String.format(msg, "style", "form", corridorHeight.getStyle()));
assertFalse(isExplode(corridorHeight), String.format(msg, "explode", "false", corridorHeight.getExplode()));
}
}
use of com.reprezen.kaizen.oasparser.model3.Path in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method resolutionzParameterDefinition.
/**
* <pre>
* Requirement A.30: /req/edr/resolution-z-definition Parameter resolution-z 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 resolutionzParameterDefinition(TestPoint testPoint, OpenApi3 model) {
Parameter resolutionz = null;
String paramName = "resolution-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)) {
resolutionz = param;
}
}
}
}
}
}
if (resolutionz != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(resolutionz.getName(), paramName, String.format(msg, "name", paramName, resolutionz.getName()));
assertEquals(resolutionz.getIn(), "query", String.format(msg, "in", "query", resolutionz.getIn()));
assertFalse(isRequired(resolutionz), String.format(msg, "required", "false", resolutionz.getRequired()));
assertEquals(resolutionz.getStyle(), "form", String.format(msg, "style", "form", resolutionz.getStyle()));
assertFalse(isExplode(resolutionz), String.format(msg, "explode", "false", resolutionz.getExplode()));
}
}
use of com.reprezen.kaizen.oasparser.model3.Path in project jmulticard by ctt-gob-es.
the class CardOS method preloadCertificates.
private void preloadCertificates() throws FileNotFoundException, Iso7816FourCardException, IOException, Asn1Exception, TlvException {
// Entramos en el directorio PKCS#15
selectFileByName(PKCS15_NAME);
// Seleccionamos el ODF, no nos devuelve FCI ni nada
selectFileById(new byte[] { (byte) 0x50, (byte) 0x31 });
// Leemos el ODF, que tiene esta estructura en cada uno de sus registros:
// PKCS15Objects ::= CHOICE {
// privateKeys [0] PrivateKeys,
// publicKeys [1] PublicKeys,
// trustedPublicKeys [2] PublicKeys,
// secretKeys [3] SecretKeys,
// certificates [4] Certificates,
// trustedCertificates [5] Certificates,
// usefulCertificates [6] Certificates,
// dataObjects [7] DataObjects,
// authObjects [8] AuthObjects,
// ... -- For future extensions
// }
// A2
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();
// Seleccionamos el CDF
selectFileById(cdfPath.getPathBytes());
// Leemos el CDF mediante registros
final List<byte[]> cdfRecords = readAllRecords();
CertificateObject co;
for (final byte[] b : cdfRecords) {
try {
co = new CertificateObject();
co.setDerValue(HexUtils.subArray(b, 2, b.length - 2));
} catch (final Exception e) {
// $NON-NLS-1$
LOGGER.warning("Omitido registro de certificado por no ser un CertificateObject de PKCS#15: " + e);
continue;
}
final byte[] certPath = co.getPathBytes();
if (certPath == null || certPath.length != 4) {
// $NON-NLS-1$
LOGGER.warning("Se omite una posicion de certificado porque su ruta no es de cuatro octetos: " + co.getAlias());
continue;
}
final byte[] masterFile = { (byte) 0x50, (byte) 0x15 };
sendArbitraryApdu(new CommandApdu(// CLA
getCla(), // INS
(byte) 0xA4, // P1
(byte) 0x08, // P2
(byte) 0x0C, new byte[] { masterFile[0], masterFile[1], certPath[0], certPath[1], certPath[2], certPath[3] }, null));
final byte[] certBytes = readBinaryComplete(9999);
final X509Certificate cert;
try {
cert = CertificateUtils.generateCertificate(certBytes);
} catch (final CertificateException e) {
LOGGER.severe(// $NON-NLS-1$ //$NON-NLS-2$
"No ha sido posible generar el certificado para el alias " + co.getAlias() + ": " + e);
continue;
}
CERTIFICATES_BY_ALIAS.put(co.getAlias(), cert);
}
}
use of com.reprezen.kaizen.oasparser.model3.Path in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method coordsParameterDefinition.
/**
* <pre>
* Abstract Test 38: Validate that the coords query parameters are constructed correctly. (position)
* Abstract Test 54: Validate that the coords query parameters are constructed correctly. (area)
* Abstract Test 70: Validate that the coords query parameters are constructed correctly. (cube)
* Abstract Test 92: Validate that the coords query parameters are constructed correctly. (trajectory)
* Abstract Test 116: Validate that the coords query parameters are constructed correctly. (corridor)
* </pre>
*
* @param testPoint the testPoint under test, never <code>null</code>
* @param model api definition, never <code>null</code>
*/
public void coordsParameterDefinition(TestPoint testPoint, OpenApi3 model) {
Parameter coords = null;
String paramName = "coords";
boolean hasCoordsParameter = false;
for (Path path : model.getPaths().values()) {
if (path.getPathString().endsWith(testPoint.getPath())) {
for (Operation op : path.getOperations().values()) {
for (Parameter param : op.getParameters()) {
if (hasName(param)) {
if (param.getName().equals(paramName)) {
coords = param;
}
}
}
}
}
}
if (!testPoint.getPath().endsWith("/locations")) {
assertNotNull(coords, "Required " + paramName + " parameter for collections with path '" + testPoint.getPath() + "' in OpenAPI document is missing");
if (coords != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(coords.getName(), paramName, String.format(msg, "name", paramName, coords.getName()));
assertEquals(coords.getIn(), "query", String.format(msg, "in", "query", coords.getIn()));
assertTrue(isRequired(coords), String.format(msg, "required", "true", coords.getRequired()));
// assertEquals( coords.getStyle(), "form", String.format( msg, "style","form",
// coords.getStyle() ) ); //TODO SHOULD BE Enabled
assertFalse(isExplode(coords), String.format(msg, "explode", "false", coords.getExplode()));
Schema schema = coords.getSchema();
assertEquals(schema.getType(), "string", String.format(msg, "schema -> type", "string", schema.getType()));
}
}
}
use of com.reprezen.kaizen.oasparser.model3.Path in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method withinUnitsParameterDefinition.
/**
* <pre>
* Requirement A.23: /req/edr/within-units-definition Parameter withinUnits
* 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 withinUnitsParameterDefinition(TestPoint testPoint, OpenApi3 model) {
Parameter withinUnits = null;
String paramName = "within-units";
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)) {
withinUnits = param;
}
}
}
}
}
}
if (withinUnits != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(withinUnits.getName(), paramName, String.format(msg, "name", paramName, withinUnits.getName()));
assertEquals(withinUnits.getIn(), "query", String.format(msg, "in", "query", withinUnits.getIn()));
assertFalse(isRequired(withinUnits), String.format(msg, "required", "false", withinUnits.getRequired()));
assertEquals(withinUnits.getStyle(), "form", String.format(msg, "style", "form", withinUnits.getStyle()));
assertFalse(isExplode(withinUnits), String.format(msg, "explode", "false", withinUnits.getExplode()));
}
}
Aggregations