Search in sources :

Example 1 with RestrictedPropertyAccessor

use of org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedPropertyAccessor in project scheduling by ow2-proactive.

the class OptionalParserValidatorTest method init.

@Before
public void init() throws SchedulerException, IOException {
    MockitoAnnotations.initMocks(this);
    when(context.getSpace()).thenReturn(schedulerSpaceInterface);
    when(schedulerSpaceInterface.checkFileExists(USERSPACE_NAME, existUserFilePath)).thenReturn(true);
    when(schedulerSpaceInterface.checkFileExists(USERSPACE_NAME, notExistUserFilePath)).thenReturn(false);
    when(schedulerSpaceInterface.checkFileExists(GLOBALSPACE_NAME, existGlobalFilePath)).thenReturn(true);
    when(schedulerSpaceInterface.checkFileExists(GLOBALSPACE_NAME, notExistGlobalFilePath)).thenReturn(false);
    when(context.getScheduler()).thenReturn(scheduler);
    when(scheduler.thirdPartyCredentialsKeySet()).thenReturn(Collections.singleton(existCredential));
    modelFile = testFolder.newFile("modelFile");
    FileUtils.writeStringToFile(modelFile, validModel, Charset.defaultCharset());
    StandardEvaluationContext spelContext = new StandardEvaluationContext();
    spelContext.setTypeLocator(new RestrictedTypeLocator());
    spelContext.setMethodResolvers(Collections.singletonList(new RestrictedMethodResolver()));
    spelContext.addPropertyAccessor(new RestrictedPropertyAccessor());
    when(context.getSpELContext()).thenReturn(spelContext);
}
Also used : RestrictedTypeLocator(org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedTypeLocator) RestrictedMethodResolver(org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedMethodResolver) StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) RestrictedPropertyAccessor(org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedPropertyAccessor) Before(org.junit.Before)

Example 2 with RestrictedPropertyAccessor

use of org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedPropertyAccessor in project scheduling by ow2-proactive.

the class SpelValidatorTest method before.

@Before
public void before() {
    ModelValidatorContext.SpELVariables spELVariables = new ModelValidatorContext.SpELVariables(null, null, null);
    context = new StandardEvaluationContext(spELVariables);
    context.setTypeLocator(new RestrictedTypeLocator());
    context.setMethodResolvers(Collections.singletonList(new RestrictedMethodResolver()));
    context.addPropertyAccessor(new RestrictedPropertyAccessor());
    validatorContext = new ModelValidatorContext(context);
    validatorContext.setSpELVariables(spELVariables);
}
Also used : RestrictedTypeLocator(org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedTypeLocator) RestrictedMethodResolver(org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedMethodResolver) StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) RestrictedPropertyAccessor(org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedPropertyAccessor) ModelValidatorContext(org.ow2.proactive.scheduler.common.job.factories.spi.model.ModelValidatorContext) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)2 RestrictedMethodResolver (org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedMethodResolver)2 RestrictedPropertyAccessor (org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedPropertyAccessor)2 RestrictedTypeLocator (org.ow2.proactive.scheduler.common.job.factories.spi.model.utils.RestrictedTypeLocator)2 StandardEvaluationContext (org.springframework.expression.spel.support.StandardEvaluationContext)2 ModelValidatorContext (org.ow2.proactive.scheduler.common.job.factories.spi.model.ModelValidatorContext)1