@Test public void shouldCreateIntegrations() { final SecurityContext security = mock(SecurityContext.class); final Principal principal = mock(Principal.class); when(security.getUserPrincipal()).thenReturn(principal); when(principal.getName()).thenReturn("user"); final Integration integration = new Integration.Builder().build(); final Integration created = new Integration.Builder().build(); final Integration encrypted = new Integration.Builder().addTag("encrypted").build(); when(encryptionSupport.encrypt(integration)).thenReturn(encrypted); final ArgumentCaptor<Integration> persisted = ArgumentCaptor.forClass(Integration.class); when(dataManager.create(persisted.capture())).thenReturn(created); assertThat(handler.create(security, integration)).isSameAs(created); assertThat(persisted.getValue()).isEqualToIgnoringGivenFields(encrypted, "createdAt"); verify(encryptionSupport).encrypt(same(integration)); }
@Override public Integration create(@Context final SecurityContext sec, final Integration integration) { final Integration encryptedIntegration = encryptionSupport.encrypt(integration); final Integration updatedIntegration = new Integration.Builder().createFrom(encryptedIntegration) .createdAt(System.currentTimeMillis()).build(); return getDataManager().create(updatedIntegration); }
IntegrationHandler extends BaseHandler implements Lister<IntegrationOverview>, Getter<IntegrationOverview>,
    Creator<Integration>, Deleter<Integration>, Updater<Integration>, Validating<Integration> { @Override public Integration create(@Context final SecurityContext sec, final Integration integration) { final Integration encryptedIntegration = encryptionSupport.encrypt(integration); final Integration updatedIntegration = new Integration.Builder().createFrom(encryptedIntegration) .createdAt(System.currentTimeMillis()).build(); return getDataManager().create(updatedIntegration); } }
IntegrationHandler extends BaseHandler implements Lister<IntegrationOverview>, Getter<IntegrationOverview>,
    Creator<Integration>, Deleter<Integration>, Updater<Integration>, Validating<Integration> { @Override public Integration create(@Context final SecurityContext sec, final Integration integration) { final Integration encryptedIntegration = encryptionSupport.encrypt(integration); final Integration updatedIntegration = new Integration.Builder().createFrom(encryptedIntegration) .createdAt(System.currentTimeMillis()).build(); return getDataManager().create(updatedIntegration); } IntegrationHandler(final DataManager dataMgr, final OpenShiftService openShiftService,
                              final Validator validator, final Inspectors inspectors,
                              final EncryptionComponent encryptionSupport, final APIGenerator apiGenerator,
                              final IntegrationOverviewHelper integrationOverviewHelper); }
IntegrationHandler extends BaseHandler implements Lister<IntegrationOverview>, Getter<IntegrationOverview>,
    Creator<Integration>, Deleter<Integration>, Updater<Integration>, Validating<Integration> { @Override public Integration create(@Context final SecurityContext sec, final Integration integration) { final Integration encryptedIntegration = encryptionSupport.encrypt(integration); final Integration updatedIntegration = new Integration.Builder().createFrom(encryptedIntegration) .createdAt(System.currentTimeMillis()).build(); return getDataManager().create(updatedIntegration); } IntegrationHandler(final DataManager dataMgr, final OpenShiftService openShiftService,
                              final Validator validator, final Inspectors inspectors,
                              final EncryptionComponent encryptionSupport, final APIGenerator apiGenerator,
                              final IntegrationOverviewHelper integrationOverviewHelper); @Override Integration create(@Context final SecurityContext sec, final Integration integration); @Override void delete(final String id); @Override IntegrationOverview get(final String id); @POST @Produces(MediaType.APPLICATION_JSON) @Path(value = "/filters/options") FilterOptions getFilterOptions(final DataShape dataShape); @GET @Produces(MediaType.APPLICATION_JSON) @Path(value = "/filters/options") FilterOptions getGlobalFilterOptions(); Integration getIntegration(final String id); @GET @Produces(MediaType.APPLICATION_JSON) @Path(value = "/{id}/overview") IntegrationOverview getOverview(@PathParam("id") final String id); @Override Validator getValidator(); @Override ListResult<IntegrationOverview> list(int page, int perPage); @Override Kind resourceKind(); @Override void update(final String id, final Integration integration); }
IntegrationHandler extends BaseHandler implements Lister<IntegrationOverview>, Getter<IntegrationOverview>,
    Creator<Integration>, Deleter<Integration>, Updater<Integration>, Validating<Integration> { @Override public Integration create(@Context final SecurityContext sec, final Integration integration) { final Integration encryptedIntegration = encryptionSupport.encrypt(integration); final Integration updatedIntegration = new Integration.Builder().createFrom(encryptedIntegration) .createdAt(System.currentTimeMillis()).build(); return getDataManager().create(updatedIntegration); } IntegrationHandler(final DataManager dataMgr, final OpenShiftService openShiftService,
                              final Validator validator, final Inspectors inspectors,
                              final EncryptionComponent encryptionSupport, final APIGenerator apiGenerator,
                              final IntegrationOverviewHelper integrationOverviewHelper); @Override Integration create(@Context final SecurityContext sec, final Integration integration); @Override void delete(final String id); @Override IntegrationOverview get(final String id); @POST @Produces(MediaType.APPLICATION_JSON) @Path(value = "/filters/options") FilterOptions getFilterOptions(final DataShape dataShape); @GET @Produces(MediaType.APPLICATION_JSON) @Path(value = "/filters/options") FilterOptions getGlobalFilterOptions(); Integration getIntegration(final String id); @GET @Produces(MediaType.APPLICATION_JSON) @Path(value = "/{id}/overview") IntegrationOverview getOverview(@PathParam("id") final String id); @Override Validator getValidator(); @Override ListResult<IntegrationOverview> list(int page, int perPage); @Override Kind resourceKind(); @Override void update(final String id, final Integration integration);  }