use of org.olat.resource.accesscontrol.provider.auto.AdvanceOrder in project OpenOLAT by OpenOLAT.
the class AdvanceOrderDAOTest method shouldDeleteAdvanceOrdersByIdentity.
@Test
public void shouldDeleteAdvanceOrdersByIdentity() {
AdvanceOrder aoPending = sut.create(identity, IdentifierKey.internalId, IDENTIFIER_VALUE, freeMethod);
sut.save(aoPending);
AdvanceOrder aoDone = sut.create(identity, IdentifierKey.externalId, IDENTIFIER_VALUE, freeMethod);
sut.save(aoDone);
sut.accomplishAndSave(aoDone);
Identity otherIdentity = JunitTestHelper.createAndPersistIdentityAsRndUser("otheruser");
AdvanceOrder aoOtherIdentity = sut.create(otherIdentity, IdentifierKey.internalId, "not matching", freeMethod);
sut.save(aoOtherIdentity);
dbInstance.commitAndCloseSession();
sut.deleteAdvanceOrders(identity);
Collection<AdvanceOrder> aoDeletedUser = loadAllAdvanceOrders(identity);
assertThat(aoDeletedUser).hasSize(0);
Collection<AdvanceOrder> aoActiveUser = loadAllAdvanceOrders(otherIdentity);
assertThat(aoActiveUser).hasSize(1);
}
use of org.olat.resource.accesscontrol.provider.auto.AdvanceOrder in project OpenOLAT by OpenOLAT.
the class AdvanceOrderDAOTest method shouldSaveUpdatedAdvanceOrder.
@Test
public void shouldSaveUpdatedAdvanceOrder() {
AdvanceOrder advanceOrder = sut.create(identity, IDENTIFIER_KEY, IDENTIFIER_VALUE, freeMethod);
advanceOrder = sut.save(advanceOrder);
advanceOrder.setStatus(Status.DONE);
dbInstance.commitAndCloseSession();
AdvanceOrder savedAdvanceOrder = sut.save(advanceOrder);
dbInstance.commitAndCloseSession();
assertThat(savedAdvanceOrder.getStatus()).isEqualTo(Status.DONE);
}
use of org.olat.resource.accesscontrol.provider.auto.AdvanceOrder in project OpenOLAT by OpenOLAT.
the class AdvanceOrderDAOTest method shouldSaveNewAdvanceOrder.
@Test
public void shouldSaveNewAdvanceOrder() {
AdvanceOrder advanceOrder = sut.create(identity, IDENTIFIER_KEY, IDENTIFIER_VALUE, freeMethod);
dbInstance.commitAndCloseSession();
AdvanceOrder savedAdvanceOrder = sut.save(advanceOrder);
dbInstance.commitAndCloseSession();
assertThat(savedAdvanceOrder.getKey()).isNotNull();
}
use of org.olat.resource.accesscontrol.provider.auto.AdvanceOrder in project OpenOLAT by OpenOLAT.
the class AdvanceOrderDAOTest method shouldNotExistIfTheIdentifierValueIsDifferent.
@Test
public void shouldNotExistIfTheIdentifierValueIsDifferent() {
AdvanceOrder advanceOrder = sut.create(identity, IDENTIFIER_KEY, IDENTIFIER_VALUE, freeMethod);
sut.save(advanceOrder);
dbInstance.commitAndCloseSession();
boolean exists = sut.exists(identity, IDENTIFIER_KEY, "otherValue", freeMethod);
assertThat(exists).isFalse();
}
use of org.olat.resource.accesscontrol.provider.auto.AdvanceOrder in project OpenOLAT by OpenOLAT.
the class AdvanceOrderDAOTest method shouldNotExistIfTheIdentityIsDifferent.
@Test
public void shouldNotExistIfTheIdentityIsDifferent() {
Identity otherIdentity = JunitTestHelper.createAndPersistIdentityAsRndUser("other");
AdvanceOrder advanceOrder = sut.create(identity, IDENTIFIER_KEY, IDENTIFIER_VALUE, freeMethod);
sut.save(advanceOrder);
dbInstance.commitAndCloseSession();
boolean exists = sut.exists(otherIdentity, IDENTIFIER_KEY, IDENTIFIER_VALUE, freeMethod);
assertThat(exists).isFalse();
}
Aggregations