use of org.olat.resource.accesscontrol.provider.auto.AdvanceOrder in project openolat by klemens.
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();
}
use of org.olat.resource.accesscontrol.provider.auto.AdvanceOrder in project openolat by klemens.
the class AdvanceOrderDAOTest method shouldCreateAdvanceOrder.
@Test
public void shouldCreateAdvanceOrder() {
AdvanceOrder advanceOrder = sut.create(identity, IDENTIFIER_KEY, IDENTIFIER_VALUE, freeMethod);
assertThat(advanceOrder.getKey()).isNull();
assertThat(advanceOrder.getCreationDate()).isNotNull();
assertThat(advanceOrder.getLastModified()).isNotNull();
assertThat(advanceOrder.getIdentity()).isEqualTo(identity);
assertThat(advanceOrder.getIdentifierKey()).isEqualTo(IDENTIFIER_KEY);
assertThat(advanceOrder.getIdentifierValue()).isEqualTo(IDENTIFIER_VALUE);
assertThat(advanceOrder.getMethod()).isEqualTo(freeMethod);
assertThat(advanceOrder.getStatus()).isEqualTo(Status.PENDING);
assertThat(advanceOrder.getStatusModified()).isNotNull();
}
use of org.olat.resource.accesscontrol.provider.auto.AdvanceOrder in project openolat by klemens.
the class AdvanceOrderDAOTest method shouldNotExistIfTheIdentifierKeyIsDifferent.
@Test
public void shouldNotExistIfTheIdentifierKeyIsDifferent() {
AdvanceOrder advanceOrder = sut.create(identity, IDENTIFIER_KEY, IDENTIFIER_VALUE, freeMethod);
sut.save(advanceOrder);
dbInstance.commitAndCloseSession();
boolean exists = sut.exists(identity, IdentifierKey.internalId, IDENTIFIER_VALUE, freeMethod);
assertThat(exists).isFalse();
}
use of org.olat.resource.accesscontrol.provider.auto.AdvanceOrder in project openolat by klemens.
the class AdvanceOrderDAOTest method shouldMarkAsDoneWhenAccomplished.
@Test
public void shouldMarkAsDoneWhenAccomplished() {
AdvanceOrder advanceOrder = sut.create(identity, IDENTIFIER_KEY, IDENTIFIER_VALUE, freeMethod);
advanceOrder = sut.save(advanceOrder);
AdvanceOrder accomplishedAdvanceOrder = sut.accomplishAndSave(advanceOrder);
assertThat(accomplishedAdvanceOrder.getStatus()).isEqualTo(Status.DONE);
}
use of org.olat.resource.accesscontrol.provider.auto.AdvanceOrder in project openolat by klemens.
the class AdvanceOrderDAOTest method shouldNotMarkedAsDoneIfNoOffer.
@Test
public void shouldNotMarkedAsDoneIfNoOffer() {
AdvanceOrder advanceOrder = sut.create(identity, IDENTIFIER_KEY, IDENTIFIER_VALUE, freeMethod);
advanceOrder = sut.save(advanceOrder);
AdvanceOrder accomplishedAdvanceOrder = sut.accomplishAndSave(advanceOrder);
assertThat(accomplishedAdvanceOrder.getStatus()).isEqualTo(advanceOrder.getStatus());
}
Aggregations