@Test public void test2CreateXGroupWithOutLogin() { VXGroup vxGroup = createvXGroup(); Mockito.when(daoManager.getXXGroup()).thenReturn(xXGroupDao); XXGroup resource = createXXGroup(); Mockito.when(xXGroupDao.findByGroupName(vxGroup.getName())).thenReturn(resource); Mockito.when(daoManager.getXXPortalUser()).thenReturn(xXPortalUserDao); Mockito.when(xXPortalUserDao.getById(1l)).thenReturn(tUser); Mockito.when(entityDao.update(resource)).thenReturn(resource); XGroupService.createXGroupWithOutLogin(vxGroup); }
public VXGroup createXGroupWithOutLogin(VXGroup vxGroup) { XXGroup xxGroup = daoManager.getXXGroup().findByGroupName( vxGroup.getName()); boolean groupExists = true; if (xxGroup == null) { xxGroup = new XXGroup(); groupExists = false; } xxGroup = mapViewToEntityBean(vxGroup, xxGroup, 0); XXPortalUser xXPortalUser = daoManager.getXXPortalUser().getById(createdByUserId); if (xXPortalUser != null) { xxGroup.setAddedByUserId(createdByUserId); xxGroup.setUpdatedByUserId(createdByUserId); } if (groupExists) { xxGroup = getDao().update(xxGroup); } else { xxGroup = getDao().create(xxGroup); } vxGroup = postCreate(xxGroup); return vxGroup; }
XGroupService extends XGroupServiceBase<XXGroup, VXGroup> { public VXGroup createXGroupWithOutLogin(VXGroup vxGroup) { XXGroup xxGroup = daoManager.getXXGroup().findByGroupName( vxGroup.getName()); boolean groupExists = true; if (xxGroup == null) { xxGroup = new XXGroup(); groupExists = false; } xxGroup = mapViewToEntityBean(vxGroup, xxGroup, 0); XXPortalUser xXPortalUser = daoManager.getXXPortalUser().getById(createdByUserId); if (xXPortalUser != null) { xxGroup.setAddedByUserId(createdByUserId); xxGroup.setUpdatedByUserId(createdByUserId); } if (groupExists) { xxGroup = getDao().update(xxGroup); } else { xxGroup = getDao().create(xxGroup); } vxGroup = postCreate(xxGroup); return vxGroup; } }
XGroupService extends XGroupServiceBase<XXGroup, VXGroup> { public VXGroup createXGroupWithOutLogin(VXGroup vxGroup) { XXGroup xxGroup = daoManager.getXXGroup().findByGroupName( vxGroup.getName()); boolean groupExists = true; if (xxGroup == null) { xxGroup = new XXGroup(); groupExists = false; } xxGroup = mapViewToEntityBean(vxGroup, xxGroup, 0); XXPortalUser xXPortalUser = daoManager.getXXPortalUser().getById(createdByUserId); if (xXPortalUser != null) { xxGroup.setAddedByUserId(createdByUserId); xxGroup.setUpdatedByUserId(createdByUserId); } if (groupExists) { xxGroup = getDao().update(xxGroup); } else { xxGroup = getDao().create(xxGroup); } vxGroup = postCreate(xxGroup); return vxGroup; } XGroupService(); }
XGroupService extends XGroupServiceBase<XXGroup, VXGroup> { public VXGroup createXGroupWithOutLogin(VXGroup vxGroup) { XXGroup xxGroup = daoManager.getXXGroup().findByGroupName( vxGroup.getName()); boolean groupExists = true; if (xxGroup == null) { xxGroup = new XXGroup(); groupExists = false; } xxGroup = mapViewToEntityBean(vxGroup, xxGroup, 0); XXPortalUser xXPortalUser = daoManager.getXXPortalUser().getById(createdByUserId); if (xXPortalUser != null) { xxGroup.setAddedByUserId(createdByUserId); xxGroup.setUpdatedByUserId(createdByUserId); } if (groupExists) { xxGroup = getDao().update(xxGroup); } else { xxGroup = getDao().create(xxGroup); } vxGroup = postCreate(xxGroup); return vxGroup; } XGroupService(); VXGroup getGroupByGroupName(String groupName); VXGroup createXGroupWithOutLogin(VXGroup vxGroup); VXGroup readResourceWithOutLogin(Long id); List<XXTrxLog> getTransactionLog(VXGroup vResource, String action); List<XXTrxLog> getTransactionLog(VXGroup vObj, XXGroup mObj, String action); @Override VXGroup populateViewBean(XXGroup xGroup); Map<Long, XXGroup> getXXGroupIdXXGroupMap(); }
XGroupService extends XGroupServiceBase<XXGroup, VXGroup> { public VXGroup createXGroupWithOutLogin(VXGroup vxGroup) { XXGroup xxGroup = daoManager.getXXGroup().findByGroupName( vxGroup.getName()); boolean groupExists = true; if (xxGroup == null) { xxGroup = new XXGroup(); groupExists = false; } xxGroup = mapViewToEntityBean(vxGroup, xxGroup, 0); XXPortalUser xXPortalUser = daoManager.getXXPortalUser().getById(createdByUserId); if (xXPortalUser != null) { xxGroup.setAddedByUserId(createdByUserId); xxGroup.setUpdatedByUserId(createdByUserId); } if (groupExists) { xxGroup = getDao().update(xxGroup); } else { xxGroup = getDao().create(xxGroup); } vxGroup = postCreate(xxGroup); return vxGroup; } XGroupService(); VXGroup getGroupByGroupName(String groupName); VXGroup createXGroupWithOutLogin(VXGroup vxGroup); VXGroup readResourceWithOutLogin(Long id); List<XXTrxLog> getTransactionLog(VXGroup vResource, String action); List<XXTrxLog> getTransactionLog(VXGroup vObj, XXGroup mObj, String action); @Override VXGroup populateViewBean(XXGroup xGroup); Map<Long, XXGroup> getXXGroupIdXXGroupMap();  }