AppNamespaceService { public AppNamespace findPublicAppNamespace(String namespaceName) { List<AppNamespace> appNamespaces = appNamespaceRepository.findByNameAndIsPublic(namespaceName, true); if (CollectionUtils.isEmpty(appNamespaces)) { return null; } return appNamespaces.get(0); } AppNamespaceService(
      final UserInfoHolder userInfoHolder,
      final AppNamespaceRepository appNamespaceRepository,
      final RoleInitializationService roleInitializationService,
      final @Lazy AppService appService,
      final RolePermissionService rolePermissionService); List<AppNamespace> findPublicAppNamespaces(); AppNamespace findPublicAppNamespace(String namespaceName); AppNamespace findByAppIdAndName(String appId, String namespaceName); List<AppNamespace> findByAppId(String appId); @Transactional void createDefaultAppNamespace(String appId); boolean isAppNamespaceNameUnique(String appId, String namespaceName); AppNamespace createAppNamespaceInLocal(AppNamespace appNamespace); @Transactional AppNamespace createAppNamespaceInLocal(AppNamespace appNamespace, boolean appendNamespacePrefix); @Transactional AppNamespace deleteAppNamespace(String appId, String namespaceName); void batchDeleteByAppId(String appId, String operator);  }
@Test @Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testFindPublicAppNamespace() { List<AppNamespace> appNamespaceList = appNamespaceService.findPublicAppNamespaces(); Assert.assertNotNull(appNamespaceList); Assert.assertEquals(5, appNamespaceList.size()); }
@Test @Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testFindPublicAppNamespaceByName() { Assert.assertNotNull(appNamespaceService.findPublicAppNamespace("datasourcexml")); Assert.assertNull(appNamespaceService.findPublicAppNamespace("TFF.song0711-02")); }