Search in sources :

Example 1 with DataverseEngine

use of edu.harvard.iq.dataverse.engine.DataverseEngine in project dataverse by IQSS.

the class UpdatePermissionRootCommandTest method testNoChange.

@Test
public void testNoChange() throws CommandException {
    Dataverse dv = MocksFactory.makeDataverse();
    DataverseEngine ngn = new TestDataverseEngine(testCommandContext);
    dv.setPermissionRoot(false);
    UpdatePermissionRootCommand sut = new UpdatePermissionRootCommand(false, MocksFactory.makeRequest(), dv);
    Dataverse result = ngn.submit(sut);
    assertFalse(result.isPermissionRoot());
    assertFalse(serviceBeanCalled);
    dv.setPermissionRoot(true);
    sut = new UpdatePermissionRootCommand(true, MocksFactory.makeRequest(), dv);
    result = ngn.submit(sut);
    assertTrue(result.isPermissionRoot());
    assertFalse(serviceBeanCalled);
}
Also used : DataverseEngine(edu.harvard.iq.dataverse.engine.DataverseEngine) TestDataverseEngine(edu.harvard.iq.dataverse.engine.TestDataverseEngine) Dataverse(edu.harvard.iq.dataverse.Dataverse) TestDataverseEngine(edu.harvard.iq.dataverse.engine.TestDataverseEngine) Test(org.junit.Test)

Example 2 with DataverseEngine

use of edu.harvard.iq.dataverse.engine.DataverseEngine in project dataverse by IQSS.

the class UpdatePermissionRootCommandTest method testChange.

@Test
public void testChange() throws CommandException {
    Dataverse dv = MocksFactory.makeDataverse();
    DataverseEngine ngn = new TestDataverseEngine(testCommandContext);
    dv.setPermissionRoot(false);
    UpdatePermissionRootCommand sut = new UpdatePermissionRootCommand(true, MocksFactory.makeRequest(), dv);
    Dataverse result = ngn.submit(sut);
    assertTrue(result.isPermissionRoot());
    assertTrue(serviceBeanCalled);
    dv.setPermissionRoot(true);
    sut = new UpdatePermissionRootCommand(false, MocksFactory.makeRequest(), dv);
    result = ngn.submit(sut);
    assertFalse(result.isPermissionRoot());
    assertTrue(serviceBeanCalled);
}
Also used : DataverseEngine(edu.harvard.iq.dataverse.engine.DataverseEngine) TestDataverseEngine(edu.harvard.iq.dataverse.engine.TestDataverseEngine) Dataverse(edu.harvard.iq.dataverse.Dataverse) TestDataverseEngine(edu.harvard.iq.dataverse.engine.TestDataverseEngine) Test(org.junit.Test)

Aggregations

Dataverse (edu.harvard.iq.dataverse.Dataverse)2 DataverseEngine (edu.harvard.iq.dataverse.engine.DataverseEngine)2 TestDataverseEngine (edu.harvard.iq.dataverse.engine.TestDataverseEngine)2 Test (org.junit.Test)2