KubernetesNamespaceFactory { protected Set<String> getClusterRoleNames() { return clusterRoleNames; } @Inject  KubernetesNamespaceFactory(
      @Nullable @Named("che.infra.kubernetes.namespace") String legacyNamespaceName,
      @Nullable @Named("che.infra.kubernetes.service_account_name") String serviceAccountName,
      @Nullable @Named("che.infra.kubernetes.workspace_sa_cluster_roles") String clusterRoleNames,
      @Nullable @Named("che.infra.kubernetes.namespace.default") String defaultNamespaceName,
      @Named("che.infra.kubernetes.namespace.allow_user_defined")
          boolean allowUserDefinedNamespaces,
      @Named("che.infra.kubernetes.namespace.creation_allowed") boolean namespaceCreationAllowed,
      KubernetesClientFactory clientFactory,
      UserManager userManager,
      PreferenceManager preferenceManager,
      KubernetesSharedPool sharedPool); KubernetesNamespace access(String workspaceId, String namespace); void checkIfNamespaceIsAllowed(String namespaceName); List<KubernetesNamespaceMeta> list(); KubernetesNamespace getOrCreate(RuntimeIdentity identity); KubernetesNamespace get(RuntimeIdentity identity); KubernetesNamespace get(Workspace workspace); String evaluateLegacyNamespaceName(NamespaceResolutionContext resolutionCtx); String evaluateNamespaceName(NamespaceResolutionContext resolutionCtx); void deleteIfManaged(Workspace workspace);  }
@Test public void testNullClusterRolesResultsInEmptySet() { namespaceFactory = new KubernetesNamespaceFactory( "blabol-<userid>-<username>-<userid>-<username>--", "", null, "che-<userid>", false, true, clientFactory, userManager, preferenceManager, pool); assertTrue(namespaceFactory.getClusterRoleNames().isEmpty()); }
@Test public void testClusterRolesProperlyParsed() { namespaceFactory = new KubernetesNamespaceFactory( "blabol-<userid>-<username>-<userid>-<username>--", "", " one,two, three ,,five ", "che-<userid>", false, true, clientFactory, userManager, preferenceManager, pool); Set<String> expected = Sets.newHashSet("one", "two", "three", "five"); assertTrue(namespaceFactory.getClusterRoleNames().containsAll(expected)); assertTrue(expected.containsAll(namespaceFactory.getClusterRoleNames())); }