本文整理汇总了Java中org.apache.isis.applib.services.wrapper.DisabledException类的典型用法代码示例。如果您正苦于以下问题:Java DisabledException类的具体用法?Java DisabledException怎么用?Java DisabledException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DisabledException类属于org.apache.isis.applib.services.wrapper包,在下文中一共展示了DisabledException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: complete_should_fail_when_not_having_appropriate_role_type_test
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void complete_should_fail_when_not_having_appropriate_role_type_test() {
Exception error = new Exception();
// given
Person personEmmaWithNoRoleAsPropertyManager = (Person) partyRepository.findPartyByReference(
Person_enum.EmmaTreasurerGb.getRef());
SortedSet<PartyRole> rolesforEmma = personEmmaWithNoRoleAsPropertyManager.getRoles();
assertThat(rolesforEmma.size()).isEqualTo(1);
assertThat(rolesforEmma.first().getRoleType()).isEqualTo(partyRoleTypeRepository.findByKey(PartyRoleTypeEnum.TREASURER.getKey()));
// when
try {
queryResultsCache.resetForNextTransaction(); // workaround: clear MeService#me cache
sudoService.sudo(Person_enum.EmmaTreasurerGb.getRef().toLowerCase(), (Runnable) () ->
wrap(mixin(IncomingInvoice_complete.class, incomingInvoice)).act("PROPERTY_MANAGER", null, null));
} catch (DisabledException e){
error = e;
}
assertThat(error.getMessage()).isNotNull();
assertThat(error.getMessage()).contains("Reason: Task assigned to 'PROPERTY_MANAGER' role");
}
示例2: disable_change_values_when_controlled_by_budget_works
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void disable_change_values_when_controlled_by_budget_works() {
// given
topmodelBudget2015 = Budget_enum.OxfBudget2015.findUsing(serviceRegistry);
Assertions.assertThat(topmodelBudget2015).isNotNull();
startDate = topmodelBudget2015.getStartDate();
wrap(mixin(Budget_Calculate.class, topmodelBudget2015)).calculate(true);
lastServiceChargeTerm = (LeaseTermForServiceCharge) LeaseItemForServiceCharge_enum.OxfTopModel001Gb.findUsing(serviceRegistry).getTerms().last();
Assertions.assertThat(lastServiceChargeTerm).isNotNull();
Assertions.assertThat(lastServiceChargeTerm.getStartDate()).isEqualTo(startDate);
// expect
expectedExceptions.expect(DisabledException.class);
expectedExceptions.expectMessage("This term is controlled by a budget");
// when
wrap(lastServiceChargeTerm).changeValues(null, null);
}
示例3: if_no_background_service
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void if_no_background_service() throws Exception {
// given
assumeThat(backgroundCommandService, is(nullValue()));
// when
final TranslatableString reason = _createAndAttachDocumentAndScheduleRender(demoObject).disable$$();
// then
assertThat(reason).isNotNull();
// expect
expectedExceptions.expect(DisabledException.class);
// when
final DocumentTemplate anyTemplate = templateFs.getFmkTemplate();
wrap(_createAndAttachDocumentAndScheduleRender(demoObject)).$$(anyTemplate);
}
示例4: not_editable
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void not_editable() throws Exception {
// expect
expectedExceptions.expect(DisabledException.class);
// when
wrap(employee).setName("new name");
}
示例5: not_editable
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void not_editable() throws Exception {
// expect
expectedExceptions.expect(DisabledException.class);
// when
wrap(simpleObject).setName("new name");
}
示例6: cannotBeUpdatedDirectly
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void cannotBeUpdatedDirectly() throws Exception {
// expect
expectedExceptions.expect(DisabledException.class);
// when
quickObjectWrapped.setName("new name");
}
示例7: cannotBeUpdatedDirectly
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void cannotBeUpdatedDirectly() throws Exception {
// expect
expectedExceptions.expect(DisabledException.class);
// when
simpleObjectWrapped.setName("new name");
}
示例8: cannotModifyDirectly
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void cannotModifyDirectly() throws Exception {
// then
expectedExceptions.expect(DisabledException.class);
expectedExceptions.expectMessage("Reason: Always disabled. Identifier: org.isisaddons.module.security.dom.user.ApplicationUser#username()");
// when
user.setUsername("fred");
}
示例9: cannotAddUsingSupportingMethod
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void cannotAddUsingSupportingMethod() throws Exception {
// expect
expectedException.expect(DisabledException.class);
// when
user.addToRoles(userRole);
}
示例10: complete_works_when_having_appropriate_role_type_test
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void complete_works_when_having_appropriate_role_type_test() {
Exception error = new Exception();
// given
Person personEmma = (Person) partyRepository.findPartyByReference(
Person_enum.EmmaTreasurerGb.getRef());
PartyRoleType roleAsPropertyManager = partyRoleTypeRepository.findByKey("PROPERTY_MANAGER");
personEmma.addRole(roleAsPropertyManager);
transactionService.nextTransaction();
SortedSet<PartyRole> rolesforEmma = personEmma.getRoles();
assertThat(rolesforEmma.size()).isEqualTo(2);
assertThat(rolesforEmma.first().getRoleType()).isEqualTo(partyRoleTypeRepository.findByKey("PROPERTY_MANAGER"));
// when
try {
queryResultsCache.resetForNextTransaction(); // workaround: clear MeService#me cache
sudoService.sudo(Person_enum.EmmaTreasurerGb.getRef().toLowerCase(), (Runnable) () ->
wrap(mixin(IncomingInvoice_complete.class, incomingInvoice)).act("PROPERTY_MANAGER", null, null));
} catch (DisabledException e){
error = e;
}
assertThat(error.getMessage()).isNull();
assertThat(incomingInvoice.getApprovalState()).isEqualTo(IncomingInvoiceApprovalState.COMPLETED);
}
示例11: cannot_discard_when_has_linked_items
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void cannot_discard_when_has_linked_items() throws Exception {
// expecting
expectedExceptions.expect(DisabledException.class);
// when
final Order_discard mixin = mixin(Order_discard.class, order);
sudoService.sudo(Person_enum.JonathanPropertyManagerGb.getSecurityUserName(), () -> {
wrap(mixin).act("Discarding junk");
});
}
示例12: cannot_update_charge_dimension_when_has_linked_items
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void cannot_update_charge_dimension_when_has_linked_items() throws Exception {
// expecting
expectedExceptions.expect(DisabledException.class);
// when
wrap(orderItem).editCharge(fakeDataService.collections().anyOf(chargeRepository.allIncoming()));
}
示例13: cannot_update_period_dimension_when_has_linked_items
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void cannot_update_period_dimension_when_has_linked_items() throws Exception {
// expecting
expectedExceptions.expect(DisabledException.class);
// when
wrap(orderItem).editPeriod("F2018");
}
示例14: cannot_change_without_administrator_role
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test(expected = DisabledException.class)
public void cannot_change_without_administrator_role() throws Exception {
sudoService.sudo("estatio-user", Lists.newArrayList("estatio-user"), new Runnable() {
@Override public void run() {
wrap(guaranteeWithFinancialAccount).changeGuaranteeType(GuaranteeType.UNKNOWN); }
});
}
示例15: whenAlreadyDisposed
import org.apache.isis.applib.services.wrapper.DisabledException; //导入依赖的package包/类
@Test
public void whenAlreadyDisposed() throws Exception {
//
// given
//
final Property property = fs.getObject();
//
// and given
//
final LocalDate disposalDate = clockService.now().plusDays(fakeDataService.ints().between(10, 20));
wrap(property).dispose(disposalDate);
assertThat(property.getDisposalDate()).isEqualTo(disposalDate);
//
// expect
//
expectedExceptions.expect(DisabledException.class);
expectedExceptions.expectMessage("already disposed");
//
// when
//
final LocalDate disposalDate2 = clockService.now().plusDays(fakeDataService.ints().between(30, 40));
wrap(property).dispose(disposalDate);
//
// then
//
assertThat(property.getDisposalDate()).isEqualTo(disposalDate);
}