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());
}
Aggregations