Search in sources :

Example 1 with CryptoHelper

use of org.talend.daikon.security.CryptoHelper in project data-prep by Talend.

the class UpgradeAPITest method checkDynamicUpgradeServer.

@Test
public void checkDynamicUpgradeServer() throws Exception {
    // When
    // Server deliver response based on sent content
    upgradeAPI.setUpgradeVersionLocation("http://localhost:" + port + "/upgrade/server/dynamic");
    // Then
    String response = RestAssured.when().get("/api/upgrade/check").asString();
    final List<UpgradeServerVersion> versions = mapper.readerFor(new TypeReference<List<UpgradeServerVersion>>() {
    }).readValue(response);
    assertEquals(1, versions.size());
    final UpgradeServerVersion actual = versions.get(0);
    final String expectedVersion = versionService.version().getVersionId();
    final String expectedToken = TokenGenerator.generateMachineToken(new CryptoHelper("DataPrepIsSoCool"));
    assertEquals(expectedToken, actual.getTitle());
    assertEquals(expectedVersion, actual.getDownloadUrl());
}
Also used : UpgradeServerVersion(org.talend.dataprep.api.service.upgrade.UpgradeServerVersion) CryptoHelper(org.talend.daikon.security.CryptoHelper) TypeReference(com.fasterxml.jackson.core.type.TypeReference) Test(org.junit.Test)

Aggregations

TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 Test (org.junit.Test)1 CryptoHelper (org.talend.daikon.security.CryptoHelper)1 UpgradeServerVersion (org.talend.dataprep.api.service.upgrade.UpgradeServerVersion)1