@Test public void testCreatingLocationTagDoesNothingIfItAlreadyExist() throws Exception { LocationService locationService = mock(LocationService.class); when(locationService.getLocationTagByName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN)).thenReturn(new LocationTag()); new AppFrameworkActivator().setupLoginLocationTag(locationService); verify(locationService, never()).saveLocationTag(any(LocationTag.class)); }
public void setupLoginLocationTag(LocationService locationService) { LocationTag supportsLogin = locationService.getLocationTagByName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN); if (supportsLogin == null) { supportsLogin = new LocationTag(); supportsLogin.setName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN); supportsLogin.setDescription(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN_DESCRIPTION); supportsLogin.setUuid(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN_UUID); locationService.saveLocationTag(supportsLogin); } }
AppFrameworkActivator extends BaseModuleActivator implements ModuleActivator { public void setupLoginLocationTag(LocationService locationService) { LocationTag supportsLogin = locationService.getLocationTagByName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN); if (supportsLogin == null) { supportsLogin = new LocationTag(); supportsLogin.setName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN); supportsLogin.setDescription(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN_DESCRIPTION); supportsLogin.setUuid(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN_UUID); locationService.saveLocationTag(supportsLogin); } } }
AppFrameworkActivator extends BaseModuleActivator implements ModuleActivator { public void setupLoginLocationTag(LocationService locationService) { LocationTag supportsLogin = locationService.getLocationTagByName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN); if (supportsLogin == null) { supportsLogin = new LocationTag(); supportsLogin.setName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN); supportsLogin.setDescription(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN_DESCRIPTION); supportsLogin.setUuid(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN_UUID); locationService.saveLocationTag(supportsLogin); } }  }
AppFrameworkActivator extends BaseModuleActivator implements ModuleActivator { public void setupLoginLocationTag(LocationService locationService) { LocationTag supportsLogin = locationService.getLocationTagByName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN); if (supportsLogin == null) { supportsLogin = new LocationTag(); supportsLogin.setName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN); supportsLogin.setDescription(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN_DESCRIPTION); supportsLogin.setUuid(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN_UUID); locationService.saveLocationTag(supportsLogin); } }  void contextRefreshed(); void registerAppsAndExtensions(List<AppFrameworkFactory> appFrameworkFactories, AllAppTemplates allAppTemplates,
                                          AllAppDescriptors allAppDescriptors, AllFreeStandingExtensions allFreeStandingExtensions,
                                          AppFrameworkConfig config); @Override void started(); void setupLoginLocationTag(LocationService locationService); }
AppFrameworkActivator extends BaseModuleActivator implements ModuleActivator { public void setupLoginLocationTag(LocationService locationService) { LocationTag supportsLogin = locationService.getLocationTagByName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN); if (supportsLogin == null) { supportsLogin = new LocationTag(); supportsLogin.setName(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN); supportsLogin.setDescription(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN_DESCRIPTION); supportsLogin.setUuid(AppFrameworkConstants.LOCATION_TAG_SUPPORTS_LOGIN_UUID); locationService.saveLocationTag(supportsLogin); } }  void contextRefreshed(); void registerAppsAndExtensions(List<AppFrameworkFactory> appFrameworkFactories, AllAppTemplates allAppTemplates,
                                          AllAppDescriptors allAppDescriptors, AllFreeStandingExtensions allFreeStandingExtensions,
                                          AppFrameworkConfig config); @Override void started(); void setupLoginLocationTag(LocationService locationService);  }