Search in sources :

Example 1 with MockModelContext

use of com.yahoo.config.model.MockModelContext in project vespa by vespa-engine.

the class VespaModelFactoryTest method testThatFactoryModelValidationFailsWithIllegalArgumentException.

// Uses an application package that throws IllegalArgumentException when validating
@Test(expected = IllegalArgumentException.class)
public void testThatFactoryModelValidationFailsWithIllegalArgumentException() {
    VespaModelFactory modelFactory = new VespaModelFactory(new NullConfigModelRegistry());
    modelFactory.createAndValidateModel(new MockModelContext(createApplicationPackageThatFailsWhenValidating()), false);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) MockModelContext(com.yahoo.config.model.MockModelContext) Test(org.junit.Test)

Example 2 with MockModelContext

use of com.yahoo.config.model.MockModelContext in project vespa by vespa-engine.

the class VespaModelFactoryTest method testThatFactoryModelValidationCanBeIgnored.

@Test
public void testThatFactoryModelValidationCanBeIgnored() {
    VespaModelFactory modelFactory = new VespaModelFactory(new NullConfigModelRegistry());
    ModelCreateResult createResult = modelFactory.createAndValidateModel(new MockModelContext(createApplicationPackageThatFailsWhenValidating()), true);
    assertNotNull(createResult.getModel());
    assertNotNull(createResult.getConfigChangeActions());
    assertTrue(createResult.getConfigChangeActions().isEmpty());
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) MockModelContext(com.yahoo.config.model.MockModelContext) ModelCreateResult(com.yahoo.config.model.api.ModelCreateResult) Test(org.junit.Test)

Aggregations

MockModelContext (com.yahoo.config.model.MockModelContext)2 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)2 Test (org.junit.Test)2 ModelCreateResult (com.yahoo.config.model.api.ModelCreateResult)1