@Test void testGetAppByNameUnknownAppName() { String name = "unknownName"; @SuppressWarnings("unchecked") Query<App> query = mock(Query.class, RETURNS_SELF); when(dataService.query("sys_App", App.class)).thenReturn(query); when(query.eq("name", name).findOne()).thenReturn(null); assertThrows( AppForURIDoesNotExistException.class, () -> appManagerServiceImpl.getAppByName(name)); }
@Override public AppResponse getAppByName(String appName) { App app = dataService.query(AppMetadata.APP, App.class).eq(AppMetadata.NAME, appName).findOne(); if (app == null) { throw new AppForURIDoesNotExistException(appName); } return AppResponse.create(app); }
AppManagerServiceImpl implements AppManagerService { @Override public AppResponse getAppByName(String appName) { App app = dataService.query(AppMetadata.APP, App.class).eq(AppMetadata.NAME, appName).findOne(); if (app == null) { throw new AppForURIDoesNotExistException(appName); } return AppResponse.create(app); } }
AppManagerServiceImpl implements AppManagerService { @Override public AppResponse getAppByName(String appName) { App app = dataService.query(AppMetadata.APP, App.class).eq(AppMetadata.NAME, appName).findOne(); if (app == null) { throw new AppForURIDoesNotExistException(appName); } return AppResponse.create(app); } AppManagerServiceImpl(
      AppFactory appFactory,
      DataService dataService,
      FileStore fileStore,
      Gson gson,
      PluginFactory pluginFactory); }
AppManagerServiceImpl implements AppManagerService { @Override public AppResponse getAppByName(String appName) { App app = dataService.query(AppMetadata.APP, App.class).eq(AppMetadata.NAME, appName).findOne(); if (app == null) { throw new AppForURIDoesNotExistException(appName); } return AppResponse.create(app); } AppManagerServiceImpl(
      AppFactory appFactory,
      DataService dataService,
      FileStore fileStore,
      Gson gson,
      PluginFactory pluginFactory); @Override List<AppResponse> getApps(); @Override AppResponse getAppByName(String appName); @Override @Transactional void activateApp(App app); @Override @Transactional void deactivateApp(App app); @Override @Transactional void deleteApp(String id); @Override String uploadApp(InputStream zipData, String zipFileName, String formFieldName); @Override AppConfig checkAndObtainConfig(String tempDir, String configContent); @Override @Transactional void configureApp(AppConfig appConfig, String htmlTemplate); @Override String extractFileContent(String appDir, String fileName); }
AppManagerServiceImpl implements AppManagerService { @Override public AppResponse getAppByName(String appName) { App app = dataService.query(AppMetadata.APP, App.class).eq(AppMetadata.NAME, appName).findOne(); if (app == null) { throw new AppForURIDoesNotExistException(appName); } return AppResponse.create(app); } AppManagerServiceImpl(
      AppFactory appFactory,
      DataService dataService,
      FileStore fileStore,
      Gson gson,
      PluginFactory pluginFactory); @Override List<AppResponse> getApps(); @Override AppResponse getAppByName(String appName); @Override @Transactional void activateApp(App app); @Override @Transactional void deactivateApp(App app); @Override @Transactional void deleteApp(String id); @Override String uploadApp(InputStream zipData, String zipFileName, String formFieldName); @Override AppConfig checkAndObtainConfig(String tempDir, String configContent); @Override @Transactional void configureApp(AppConfig appConfig, String htmlTemplate); @Override String extractFileContent(String appDir, String fileName); static final String APPS_DIR; static final String ZIP_INDEX_FILE; static final String ZIP_CONFIG_FILE; static final String APP_PLUGIN_ROOT; }