@Test public void test_should_update_service_group() { when(serviceGroupQueryBuilder.updateServiceGroupQuery()).thenReturn("Query"); ServiceGroupRequest serviceGroupRequest = prepareServiceGroupRequest(); when(jdbcTemplate.update(any(String.class), anyListOf(Object.class))).thenReturn(1); assertTrue(serviceGroupRequest.equals(serviceGroupRepository.persistUpdateServiceGroup(serviceGroupRequest))); }
public ServiceGroupRequest persistUpdateServiceGroup(final ServiceGroupRequest serviceGroupRequest) { LOGGER.info("ServiceGroupRequest::" + serviceGroupRequest); if (serviceGroupRequest != null && serviceGroupRequest.getServiceGroup() != null && serviceGroupRequest.getServiceGroup().getActive() != null && !serviceGroupRequest.getServiceGroup().getActive()) disableServiceTypes(serviceGroupRequest.getServiceGroup().getKeyword(), serviceGroupRequest.getServiceGroup().getId(), serviceGroupRequest.getServiceGroup().getTenantId()); final String serviceGroupUpdate = serviceGroupQueryBuilder.updateServiceGroupQuery(); final ServiceGroup serviceGroup = serviceGroupRequest.getServiceGroup(); final Object[] obj = new Object[]{serviceGroup.getName(), serviceGroup.getDescription(), serviceGroup.getActive(), Long.valueOf(serviceGroupRequest.getRequestInfo().getUserInfo().getId()), Long.valueOf(serviceGroupRequest.getRequestInfo().getUserInfo().getId()), new Date(new java.util.Date().getTime()), new Date(new java.util.Date().getTime()), serviceGroup.getTenantId(), serviceGroup.getKeyword(), serviceGroup.getLocalName(), serviceGroup.getCode()}; jdbcTemplate.update(serviceGroupUpdate, obj); return serviceGroupRequest; }
ServiceGroupRepository { public ServiceGroupRequest persistUpdateServiceGroup(final ServiceGroupRequest serviceGroupRequest) { LOGGER.info("ServiceGroupRequest::" + serviceGroupRequest); if (serviceGroupRequest != null && serviceGroupRequest.getServiceGroup() != null && serviceGroupRequest.getServiceGroup().getActive() != null && !serviceGroupRequest.getServiceGroup().getActive()) disableServiceTypes(serviceGroupRequest.getServiceGroup().getKeyword(), serviceGroupRequest.getServiceGroup().getId(), serviceGroupRequest.getServiceGroup().getTenantId()); final String serviceGroupUpdate = serviceGroupQueryBuilder.updateServiceGroupQuery(); final ServiceGroup serviceGroup = serviceGroupRequest.getServiceGroup(); final Object[] obj = new Object[]{serviceGroup.getName(), serviceGroup.getDescription(), serviceGroup.getActive(), Long.valueOf(serviceGroupRequest.getRequestInfo().getUserInfo().getId()), Long.valueOf(serviceGroupRequest.getRequestInfo().getUserInfo().getId()), new Date(new java.util.Date().getTime()), new Date(new java.util.Date().getTime()), serviceGroup.getTenantId(), serviceGroup.getKeyword(), serviceGroup.getLocalName(), serviceGroup.getCode()}; jdbcTemplate.update(serviceGroupUpdate, obj); return serviceGroupRequest; } }
ServiceGroupRepository { public ServiceGroupRequest persistUpdateServiceGroup(final ServiceGroupRequest serviceGroupRequest) { LOGGER.info("ServiceGroupRequest::" + serviceGroupRequest); if (serviceGroupRequest != null && serviceGroupRequest.getServiceGroup() != null && serviceGroupRequest.getServiceGroup().getActive() != null && !serviceGroupRequest.getServiceGroup().getActive()) disableServiceTypes(serviceGroupRequest.getServiceGroup().getKeyword(), serviceGroupRequest.getServiceGroup().getId(), serviceGroupRequest.getServiceGroup().getTenantId()); final String serviceGroupUpdate = serviceGroupQueryBuilder.updateServiceGroupQuery(); final ServiceGroup serviceGroup = serviceGroupRequest.getServiceGroup(); final Object[] obj = new Object[]{serviceGroup.getName(), serviceGroup.getDescription(), serviceGroup.getActive(), Long.valueOf(serviceGroupRequest.getRequestInfo().getUserInfo().getId()), Long.valueOf(serviceGroupRequest.getRequestInfo().getUserInfo().getId()), new Date(new java.util.Date().getTime()), new Date(new java.util.Date().getTime()), serviceGroup.getTenantId(), serviceGroup.getKeyword(), serviceGroup.getLocalName(), serviceGroup.getCode()}; jdbcTemplate.update(serviceGroupUpdate, obj); return serviceGroupRequest; }  }
ServiceGroupRepository { public ServiceGroupRequest persistUpdateServiceGroup(final ServiceGroupRequest serviceGroupRequest) { LOGGER.info("ServiceGroupRequest::" + serviceGroupRequest); if (serviceGroupRequest != null && serviceGroupRequest.getServiceGroup() != null && serviceGroupRequest.getServiceGroup().getActive() != null && !serviceGroupRequest.getServiceGroup().getActive()) disableServiceTypes(serviceGroupRequest.getServiceGroup().getKeyword(), serviceGroupRequest.getServiceGroup().getId(), serviceGroupRequest.getServiceGroup().getTenantId()); final String serviceGroupUpdate = serviceGroupQueryBuilder.updateServiceGroupQuery(); final ServiceGroup serviceGroup = serviceGroupRequest.getServiceGroup(); final Object[] obj = new Object[]{serviceGroup.getName(), serviceGroup.getDescription(), serviceGroup.getActive(), Long.valueOf(serviceGroupRequest.getRequestInfo().getUserInfo().getId()), Long.valueOf(serviceGroupRequest.getRequestInfo().getUserInfo().getId()), new Date(new java.util.Date().getTime()), new Date(new java.util.Date().getTime()), serviceGroup.getTenantId(), serviceGroup.getKeyword(), serviceGroup.getLocalName(), serviceGroup.getCode()}; jdbcTemplate.update(serviceGroupUpdate, obj); return serviceGroupRequest; }  ServiceGroupRequest persistCreateServiceGroup(final ServiceGroupRequest serviceGroupRequest); ServiceGroupRequest persistUpdateServiceGroup(final ServiceGroupRequest serviceGroupRequest); List<ServiceGroup> getAllServiceGroup(ServiceGroupGetRequest serviceGroupGetRequest); boolean verifyRequestUniqueness(ServiceGroupRequest serviceGroupRequest, String action); boolean verifyIfNameAlreadyExists(ServiceGroupRequest serviceGroupRequest, String action); boolean verifyIfCodeAlreadyExists(ServiceGroupRequest serviceGroupRequest, String action); }
ServiceGroupRepository { public ServiceGroupRequest persistUpdateServiceGroup(final ServiceGroupRequest serviceGroupRequest) { LOGGER.info("ServiceGroupRequest::" + serviceGroupRequest); if (serviceGroupRequest != null && serviceGroupRequest.getServiceGroup() != null && serviceGroupRequest.getServiceGroup().getActive() != null && !serviceGroupRequest.getServiceGroup().getActive()) disableServiceTypes(serviceGroupRequest.getServiceGroup().getKeyword(), serviceGroupRequest.getServiceGroup().getId(), serviceGroupRequest.getServiceGroup().getTenantId()); final String serviceGroupUpdate = serviceGroupQueryBuilder.updateServiceGroupQuery(); final ServiceGroup serviceGroup = serviceGroupRequest.getServiceGroup(); final Object[] obj = new Object[]{serviceGroup.getName(), serviceGroup.getDescription(), serviceGroup.getActive(), Long.valueOf(serviceGroupRequest.getRequestInfo().getUserInfo().getId()), Long.valueOf(serviceGroupRequest.getRequestInfo().getUserInfo().getId()), new Date(new java.util.Date().getTime()), new Date(new java.util.Date().getTime()), serviceGroup.getTenantId(), serviceGroup.getKeyword(), serviceGroup.getLocalName(), serviceGroup.getCode()}; jdbcTemplate.update(serviceGroupUpdate, obj); return serviceGroupRequest; }  ServiceGroupRequest persistCreateServiceGroup(final ServiceGroupRequest serviceGroupRequest); ServiceGroupRequest persistUpdateServiceGroup(final ServiceGroupRequest serviceGroupRequest); List<ServiceGroup> getAllServiceGroup(ServiceGroupGetRequest serviceGroupGetRequest); boolean verifyRequestUniqueness(ServiceGroupRequest serviceGroupRequest, String action); boolean verifyIfNameAlreadyExists(ServiceGroupRequest serviceGroupRequest, String action); boolean verifyIfCodeAlreadyExists(ServiceGroupRequest serviceGroupRequest, String action); static final Logger LOGGER; }