@Test public void shouldProvideInfoAboutAppliedConnectorSettings() { final CustomConnectorHandler handler = new CustomConnectorHandler(dataManager, applicationContext, iconDao); final ConnectorGenerator connectorGenerator = mock(ConnectorGenerator.class); final ConnectorTemplate template = new ConnectorTemplate.Builder().build(); final ConnectorSettings connectorSettings = new ConnectorSettings.Builder().connectorTemplateId("connector-template").build(); final APISummary preparedSummary = new APISummary.Builder().build(); when(dataManager.fetch(ConnectorTemplate.class, "connector-template")).thenReturn(template); when(applicationContext.getBean("connector-template")).thenReturn(connectorGenerator); when(connectorGenerator.info(same(template), same(connectorSettings))).thenReturn(preparedSummary); final APISummary info = handler.info(connectorSettings); assertThat(info).isSameAs(preparedSummary); }
@POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") public APISummary info(final ConnectorSettings connectorSettings) { return withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(), (generator, template) -> generator.info(template, connectorSettings)); }
CustomConnectorHandler extends BaseConnectorGeneratorHandler { @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") public APISummary info(final ConnectorSettings connectorSettings) { return withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(), (generator, template) -> generator.info(template, connectorSettings)); } }
CustomConnectorHandler extends BaseConnectorGeneratorHandler { @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") public APISummary info(final ConnectorSettings connectorSettings) { return withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(), (generator, template) -> generator.info(template, connectorSettings)); } CustomConnectorHandler(final DataManager dataManager, final ApplicationContext applicationContext, final IconDao iconDao); }
CustomConnectorHandler extends BaseConnectorGeneratorHandler { @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") public APISummary info(final ConnectorSettings connectorSettings) { return withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(), (generator, template) -> generator.info(template, connectorSettings)); } CustomConnectorHandler(final DataManager dataManager, final ApplicationContext applicationContext, final IconDao iconDao); @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings`") @ApiResponse(responseCode = "200", description = "Newly created Connector") Connector create(final ConnectorSettings connectorSettings); @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings` multipart part, plus optional `icon` file") @ApiResponse(responseCode = "200", description = "Newly created Connector") Connector create(@MultipartForm CustomConnectorFormData customConnectorFormData); @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") APISummary info(final ConnectorSettings connectorSettings); @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") APISummary info(@MultipartForm final CustomConnectorFormData connectorFormData); }
CustomConnectorHandler extends BaseConnectorGeneratorHandler { @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") public APISummary info(final ConnectorSettings connectorSettings) { return withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(), (generator, template) -> generator.info(template, connectorSettings)); } CustomConnectorHandler(final DataManager dataManager, final ApplicationContext applicationContext, final IconDao iconDao); @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings`") @ApiResponse(responseCode = "200", description = "Newly created Connector") Connector create(final ConnectorSettings connectorSettings); @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @Operation(description = "Creates a new Connector based on the ConnectorTemplate identified by the provided `id` and the data given in `connectorSettings` multipart part, plus optional `icon` file") @ApiResponse(responseCode = "200", description = "Newly created Connector") Connector create(@MultipartForm CustomConnectorFormData customConnectorFormData); @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") APISummary info(final ConnectorSettings connectorSettings); @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`") APISummary info(@MultipartForm final CustomConnectorFormData connectorFormData); static final String SPECIFICATION; }