AppNamespaceService { public AppNamespace createAppNamespaceInLocal(AppNamespace appNamespace) { return createAppNamespaceInLocal(appNamespace, true); } 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(expected = BadRequestException.class) @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 testCreatePublicAppNamespaceExisted() { AppNamespace appNamespace = assembleBaseAppNamespace(); appNamespace.setPublic(true); appNamespace.setName("old"); appNamespace.setFormat(ConfigFileFormat.Properties.getValue()); appNamespaceService.createAppNamespaceInLocal(appNamespace); }
@Test(expected = BadRequestException.class) @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 testCreatePublicAppNamespaceExistedAsPrivateAppNamespace() { AppNamespace appNamespace = assembleBaseAppNamespace(); appNamespace.setPublic(true); appNamespace.setName("private-01"); appNamespace.setFormat(ConfigFileFormat.Properties.getValue()); appNamespaceService.createAppNamespaceInLocal(appNamespace); }
@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 testCreatePublicAppNamespaceNotExistedWithNoAppendnamespacePrefix() { AppNamespace appNamespace = assembleBaseAppNamespace(); appNamespace.setPublic(true); appNamespace.setName("old"); appNamespace.setFormat(ConfigFileFormat.Properties.getValue()); AppNamespace createdAppNamespace = appNamespaceService.createAppNamespaceInLocal(appNamespace, false); Assert.assertNotNull(createdAppNamespace); Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName()); }
@Test(expected = BadRequestException.class) @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 testCreatePublicAppNamespaceExistedWithNoAppendnamespacePrefix() { AppNamespace appNamespace = assembleBaseAppNamespace(); appNamespace.setPublic(true); appNamespace.setName("datasource"); appNamespace.setFormat(ConfigFileFormat.Properties.getValue()); appNamespaceService.createAppNamespaceInLocal(appNamespace, false); }
@Test(expected = BadRequestException.class) @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 testCreatePrivateAppNamespaceExisted() { AppNamespace appNamespace = assembleBaseAppNamespace(); appNamespace.setPublic(false); appNamespace.setName("datasource"); appNamespace.setAppId("100003173"); appNamespaceService.createAppNamespaceInLocal(appNamespace); }
@Test(expected = BadRequestException.class) @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 testCreatePrivateAppNamespaceExistedInAnotherAppIdAsPublic() { AppNamespace appNamespace = assembleBaseAppNamespace(); appNamespace.setPublic(false); appNamespace.setName("SCC.song0711-03"); appNamespace.setAppId("100003173"); appNamespace.setFormat(ConfigFileFormat.Properties.getValue()); appNamespaceService.createAppNamespaceInLocal(appNamespace); }