use of io.syndesis.common.model.icon.Icon in project syndesis by syndesisio.
the class CustomConnectorITCase method shouldCreateNewCustomConnectorsFromMultipartWithSpecificationAndIcon.
@Test
public void shouldCreateNewCustomConnectorsFromMultipartWithSpecificationAndIcon() throws IOException {
final ResponseEntity<Connector> response = post("/api/v1/connectors/custom", multipartBody(new ConnectorSettings.Builder().connectorTemplateId(TEMPLATE_ID).build(), getClass().getResourceAsStream("/io/syndesis/server/runtime/test-image.png"), new ByteArrayInputStream("here-be-specification".getBytes(StandardCharsets.US_ASCII))), Connector.class, tokenRule.validToken(), HttpStatus.OK, multipartHeaders());
final Connector created = response.getBody();
assertThat(created).isNotNull();
assertThat(created.getDescription()).isEqualTo("test-description");
assertThat(dataManager.fetch(Connector.class, response.getBody().getId().get())).isNotNull();
assertThat(created.getIcon()).startsWith("db:");
final Icon icon = dataManager.fetch(Icon.class, created.getIcon().substring(3));
assertThat(icon.getMediaType()).isEqualTo(MediaType.IMAGE_PNG_VALUE);
try (InputStream storedIcon = iconDao.read(icon.getId().get());
InputStream expectedIcon = CustomConnectorITCase.class.getResourceAsStream("/io/syndesis/server/runtime/test-image.png")) {
assertThat(storedIcon).hasSameContentAs(expectedIcon);
}
}
Aggregations