本文整理汇总了Java中io.restassured.mapper.ObjectMapperType类的典型用法代码示例。如果您正苦于以下问题:Java ObjectMapperType类的具体用法?Java ObjectMapperType怎么用?Java ObjectMapperType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObjectMapperType类属于io.restassured.mapper包,在下文中一共展示了ObjectMapperType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDataToSignOneDocument
import io.restassured.mapper.ObjectMapperType; //导入依赖的package包/类
@Test
public void getDataToSignOneDocument() throws Exception {
DSSPrivateKeyEntry dssPrivateKeyEntry = token.getKeys().get(0);
DataToSignOneDocumentDTO dataToSign = new DataToSignOneDocumentDTO();
RemoteSignatureParameters parameters = new RemoteSignatureParameters();
parameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
parameters.setSignaturePackaging(SignaturePackaging.ENVELOPING);
parameters.setDigestAlgorithm(DigestAlgorithm.SHA256);
parameters.setSigningCertificate(new RemoteCertificate(dssPrivateKeyEntry.getCertificate().getEncoded()));
BLevelParameters bLevelParams = new BLevelParameters();
bLevelParams.setSigningDate(new Date());
parameters.setBLevelParams(bLevelParams);
dataToSign.setParameters(parameters);
RemoteDocument toSignDocument = new RemoteDocument();
toSignDocument.setBytes("Hello".getBytes("UTF-8"));
dataToSign.setToSignDocument(toSignDocument);
RestAssured.given(this.spec).accept(ContentType.JSON).contentType(ContentType.JSON).body(dataToSign, ObjectMapperType.JACKSON_2)
.post("/services/rest/signature/one-document/getDataToSign").then().assertThat().statusCode(equalTo(200));
}
示例2: validateDoc
import io.restassured.mapper.ObjectMapperType; //导入依赖的package包/类
@Test
public void validateDoc() throws IOException {
DataToValidateDTO dataToValidateDTO = new DataToValidateDTO();
File signature = new File("src/test/resources/xades-detached.xml");
RemoteDocument signedDoc = new RemoteDocument();
signedDoc.setBytes(toByteArray(signature));
signedDoc.setMimeType(MimeType.XML);
signedDoc.setName(signature.getName());
dataToValidateDTO.setSignedDocument(signedDoc);
File detached = new File("src/test/resources/sample.xml");
RemoteDocument originalDoc = new RemoteDocument();
originalDoc.setBytes(toByteArray(detached));
originalDoc.setMimeType(MimeType.XML);
originalDoc.setName(detached.getName());
dataToValidateDTO.setOriginalDocument(originalDoc);
RestAssured.given(this.spec).accept(ContentType.JSON).contentType(ContentType.JSON).body(dataToValidateDTO, ObjectMapperType.JACKSON_2)
.post("/services/rest/validation/validateSignature").then().assertThat().statusCode(equalTo(200));
}
示例3: testPOST
import io.restassured.mapper.ObjectMapperType; //导入依赖的package包/类
@Test
public void testPOST() throws Exception {
given().formParam("aaa", "111")
.formParam("bbb", "222")
.post("/")
.then()
.statusCode(200);
Map<String, Object> body = new HashMap<>();
body.put("aaa", "111");
body.put("bbb", "222");
given().body(body, ObjectMapperType.JACKSON_2)
.post("/foo")
.then()
.statusCode(200)
.body(containsString("{\"aaa\":\"111\",\"bbb\":\"222\"}"));
}
示例4: signDocumentOneDocument
import io.restassured.mapper.ObjectMapperType; //导入依赖的package包/类
@Test
public void signDocumentOneDocument() throws Exception {
DSSPrivateKeyEntry dssPrivateKeyEntry = token.getKeys().get(0);
SignOneDocumentDTO signOneDoc = new SignOneDocumentDTO();
RemoteSignatureParameters parameters = new RemoteSignatureParameters();
parameters.setSignatureLevel(SignatureLevel.CAdES_BASELINE_B);
parameters.setSignaturePackaging(SignaturePackaging.ENVELOPING);
parameters.setDigestAlgorithm(DigestAlgorithm.SHA256);
parameters.setSigningCertificate(new RemoteCertificate(dssPrivateKeyEntry.getCertificate().getEncoded()));
BLevelParameters bLevelParams = new BLevelParameters();
bLevelParams.setSigningDate(new Date());
parameters.setBLevelParams(bLevelParams);
signOneDoc.setParameters(parameters);
RemoteDocument toSignDocument = new RemoteDocument();
toSignDocument.setBytes("Hello".getBytes("UTF-8"));
signOneDoc.setToSignDocument(toSignDocument);
signOneDoc.setSignatureValue(new SignatureValue(SignatureAlgorithm.RSA_SHA256, new byte[] { 1, 2, 3, 4 }));
RestAssured.given(this.spec).accept(ContentType.JSON).contentType(ContentType.JSON).body(signOneDoc, ObjectMapperType.JACKSON_2)
.post("/services/rest/signature/one-document/signDocument").then().assertThat().statusCode(equalTo(200));
}
示例5: extendOneDocument
import io.restassured.mapper.ObjectMapperType; //导入依赖的package包/类
@Test
public void extendOneDocument() throws Exception {
ExtendDocumentDTO extendOneDoc = new ExtendDocumentDTO();
RemoteSignatureParameters parameters = new RemoteSignatureParameters();
parameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_T);
List<RemoteDocument> detachedContents = new ArrayList<RemoteDocument>();
File detached = new File("src/test/resources/sample.xml");
RemoteDocument detachedDoc = new RemoteDocument();
detachedDoc.setBytes(toByteArray(detached));
detachedDoc.setMimeType(MimeType.XML);
detachedDoc.setName(detached.getName());
detachedContents.add(detachedDoc);
parameters.setDetachedContents(detachedContents);
extendOneDoc.setParameters(parameters);
File signature = new File("src/test/resources/xades-detached.xml");
RemoteDocument toExtendDocument = new RemoteDocument();
toExtendDocument.setBytes(toByteArray(signature));
toExtendDocument.setMimeType(MimeType.XML);
toExtendDocument.setName(signature.getName());
extendOneDoc.setToExtendDocument(toExtendDocument);
RestAssured.given(this.spec).accept(ContentType.JSON).contentType(ContentType.JSON).body(extendOneDoc, ObjectMapperType.JACKSON_2)
.post("/services/rest/signature/one-document/extendDocument").then().assertThat().statusCode(equalTo(200));
}
示例6: getDataToSignMultiDocuments
import io.restassured.mapper.ObjectMapperType; //导入依赖的package包/类
@Test
public void getDataToSignMultiDocuments() throws Exception {
DSSPrivateKeyEntry dssPrivateKeyEntry = token.getKeys().get(0);
DataToSignMultipleDocumentsDTO dataToSignMultiDocs = new DataToSignMultipleDocumentsDTO();
RemoteSignatureParameters parameters = new RemoteSignatureParameters();
parameters.setAsicContainerType(ASiCContainerType.ASiC_E);
parameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
parameters.setSignaturePackaging(SignaturePackaging.DETACHED);
parameters.setDigestAlgorithm(DigestAlgorithm.SHA256);
parameters.setSigningCertificate(new RemoteCertificate(dssPrivateKeyEntry.getCertificate().getEncoded()));
BLevelParameters bLevelParams = new BLevelParameters();
bLevelParams.setSigningDate(new Date());
parameters.setBLevelParams(bLevelParams);
dataToSignMultiDocs.setParameters(parameters);
List<RemoteDocument> toSignDocuments = new ArrayList<RemoteDocument>();
RemoteDocument doc1 = new RemoteDocument();
doc1.setBytes("Hello".getBytes("UTF-8"));
doc1.setName("test1.bin");
toSignDocuments.add(doc1);
RemoteDocument doc2 = new RemoteDocument();
doc2.setBytes("World".getBytes("UTF-8"));
doc2.setName("test2.bin");
toSignDocuments.add(doc2);
dataToSignMultiDocs.setToSignDocuments(toSignDocuments);
RestAssured.given(this.spec).accept(ContentType.JSON).contentType(ContentType.JSON).body(dataToSignMultiDocs, ObjectMapperType.JACKSON_2)
.post("/services/rest/signature/multiple-documents/getDataToSignMultiple").then().assertThat().statusCode(equalTo(200));
}
示例7: signDocumentMultiDocuments
import io.restassured.mapper.ObjectMapperType; //导入依赖的package包/类
@Test
public void signDocumentMultiDocuments() throws Exception {
DSSPrivateKeyEntry dssPrivateKeyEntry = token.getKeys().get(0);
SignMultipleDocumentDTO signMultiDocsDto = new SignMultipleDocumentDTO();
RemoteSignatureParameters parameters = new RemoteSignatureParameters();
parameters.setAsicContainerType(ASiCContainerType.ASiC_E);
parameters.setSignatureLevel(SignatureLevel.XAdES_BASELINE_B);
parameters.setSignaturePackaging(SignaturePackaging.DETACHED);
parameters.setDigestAlgorithm(DigestAlgorithm.SHA256);
parameters.setSigningCertificate(new RemoteCertificate(dssPrivateKeyEntry.getCertificate().getEncoded()));
BLevelParameters bLevelParams = new BLevelParameters();
bLevelParams.setSigningDate(new Date());
parameters.setBLevelParams(bLevelParams);
signMultiDocsDto.setParameters(parameters);
List<RemoteDocument> toSignDocuments = new ArrayList<RemoteDocument>();
RemoteDocument doc1 = new RemoteDocument();
doc1.setBytes("Hello".getBytes("UTF-8"));
doc1.setName("test1.bin");
toSignDocuments.add(doc1);
RemoteDocument doc2 = new RemoteDocument();
doc2.setBytes("World".getBytes("UTF-8"));
doc2.setName("test2.bin");
toSignDocuments.add(doc2);
signMultiDocsDto.setToSignDocuments(toSignDocuments);
signMultiDocsDto.setSignatureValue(new SignatureValue(SignatureAlgorithm.RSA_SHA256, new byte[] { 1, 2, 3, 4 }));
RestAssured.given(this.spec).accept(ContentType.JSON).contentType(ContentType.JSON).body(signMultiDocsDto, ObjectMapperType.JACKSON_2)
.post("/services/rest/signature/multiple-documents/signDocument").then().assertThat().statusCode(equalTo(200));
}
示例8: setUp
import io.restassured.mapper.ObjectMapperType; //导入依赖的package包/类
@Before
public void setUp() {
books.forEach(book -> {
given()
.contentType(ContentType.JSON)
.body(book, ObjectMapperType.JACKSON_2)
.when()
.post(ENDPOINT)
.then()
.statusCode(HttpStatus.CREATED.value());
});
}