@Test public void testRemoveGroupsNull() throws Exception { List<String> tenants = QueryUtil.removeGroups(null); Assert.assertNull(tenants); }
@Test public void testRemoveGroups() throws Exception { List<String> tenants = QueryUtil.removeGroups(getTenantLinks()); Assert.assertNotNull(tenants); Assert.assertEquals(new HashSet<>( Arrays.asList( TLINK_T1, TLINK_T2, TLINK_U1, TLINK_U2 )), new HashSet<>(tenants) ); }
@Override public void handleCreate(Operation startPost) { if (!checkForBody(startPost)) { return; } try { ContainerDescription state = startPost.getBody(ContainerDescription.class); logFine("Initial name is %s", state.name); /** In embedded mode we allow templates to be seen across groups. * To make possible the provisioning in different groups we need * to omit the groups from tenant links when we store the template. */ if (ConfigurationUtil.isEmbedded() && startPost.getRequestHeader(CompositeDescriptionCloneService .CUSTOM_PROPERTIES_CLONED_DESCRIPTION) == null && (state.customProperties == null || !state.customProperties.containsKey("__blueprint_id"))) { if (state.tenantLinks != null) { state.tenantLinks = QueryUtil.removeGroups(state.tenantLinks); } } validateState(state); startPost.complete(); } catch (Throwable e) { logSevere(e); startPost.fail(e); } }
@Override public void handleCreate(Operation startPost) { if (!checkForBody(startPost)) { return; } try { CompositeDescription state = startPost.getBody(CompositeDescription.class); /** In embedded mode we allow templates to be seen across groups. * To make possible the provisioning in different groups we need * to omit the groups from tenant links when we store the template. */ if (ConfigurationUtil.isEmbedded() && startPost.getRequestHeader(CompositeDescriptionCloneService .CUSTOM_PROPERTIES_CLONED_DESCRIPTION) == null && (state.customProperties == null || !state.customProperties.containsKey("__blueprint_id"))) { if (state.tenantLinks != null) { state.tenantLinks = QueryUtil.removeGroups(state.tenantLinks); } } logFine("Initial name is %s", state.name); validateStateOnStart(state); startPost.complete(); } catch (Throwable e) { logSevere(e); startPost.fail(e); } }