/******************************************************************************* * Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Edgar Mueller - initial API and implementation ******************************************************************************/ package org.eclipse.emf.emfstore.server.accesscontrol.test; import static org.junit.Assert.fail; import org.eclipse.emf.emfstore.client.test.common.util.ServerUtil; import org.eclipse.emf.emfstore.internal.server.exceptions.AccessControlException; import org.eclipse.emf.emfstore.server.auth.ESProjectAdminPrivileges; import org.eclipse.emf.emfstore.server.exceptions.ESException; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; /** * Test the missing {@link ESProjectAdminPrivileges#CreateGroup} privilege of a * {@link org.eclipse.emf.emfstore.internal.server.model.accesscontrol.roles.ProjectAdminRole ProjectAdminRole}. * * @author emueller * */ public class CreateGroupMissingPrivilegeTest extends ProjectAdminTest { @BeforeClass public static void beforeClass() { startEMFStoreWithPAProperties(ESProjectAdminPrivileges.CreateGroup); } @AfterClass public static void afterClass() { stopEMFStore(); } @Override @After public void after() { try { ServerUtil.deleteGroup(getSuperUsersession(), getNewGroupName()); ServerUtil.deleteGroup(getSuperUsersession(), getNewOtherGroupName()); } catch (final ESException ex) { fail(ex.getMessage()); } super.after(); } @Override @Before public void before() { super.before(); } @Test public void createGroup() throws ESException { makeUserPA(); getAdminBroker().createGroup(getNewGroupName()); } @Test(expected = AccessControlException.class) public void createGroupNotPA() throws ESException { getAdminBroker().createGroup(getNewGroupName()); } }