ConfigModelContext { private ConfigModelContext(ApplicationType applicationType, DeployState deployState, VespaModel vespaModel, ConfigModelRepoAdder configModelRepoAdder, AbstractConfigProducer parent, String producerId) { this.applicationType = applicationType; this.deployState = deployState; this.vespaModel = vespaModel; this.configModelRepoAdder = configModelRepoAdder; this.parent = parent; this.producerId = producerId; } private  ConfigModelContext(ApplicationType applicationType,
                               DeployState deployState,
                               VespaModel vespaModel,
                               ConfigModelRepoAdder configModelRepoAdder,
                               AbstractConfigProducer parent,
                               String producerId); ApplicationPackage getApplicationPackage(); String getProducerId(); AbstractConfigProducer getParentProducer(); DeployLogger getDeployLogger(); DeployState getDeployState(); ApplicationType getApplicationType(); VespaModel vespaModel(); ModelContext.Properties properties(); ConfigModelRepoAdder getConfigModelRepoAdder(); ConfigModelContext withParent(AbstractConfigProducer newParent); ConfigModelContext withId(String producerId); ConfigModelContext with(VespaModel vespaModel); static ConfigModelContext create(DeployState deployState,
                                            VespaModel vespaModel,
                                            ConfigModelRepoAdder configModelRepoAdder,
                                            AbstractConfigProducer parent,
                                            String producerId); static ConfigModelContext create(ApplicationType applicationType,
                                            DeployState deployState,
                                            VespaModel vespaModel,
                                            ConfigModelRepoAdder configModelRepoAdder,
                                            AbstractConfigProducer parent,
                                            String producerId);  }
@Test public void testConfigModelContext() { MockRoot root = new MockRoot(); String id = "foobar"; ApplicationPackage pkg = new MockApplicationPackage.Builder() .withServices("<services version=\"1.0\"><admin version=\"2.0\" /></services>") .build(); DeployState deployState = DeployState.createTestState(pkg); DeployLogger logger = deployState.getDeployLogger(); ConfigModelContext ctx = ConfigModelContext.create(deployState, null, null, root, id); assertThat(ctx.getApplicationPackage(), is(pkg)); assertThat(ctx.getProducerId(), is(id)); assertThat(ctx.getParentProducer(), is(root)); assertThat(ctx.getDeployLogger(), is(logger)); ctx = ConfigModelContext.create(root.getDeployState(), null, null, root, id); assertThat(ctx.getProducerId(), is(id)); assertThat(ctx.getParentProducer(), is(root)); AbstractConfigProducer newRoot = new MockRoot("bar"); ctx = ctx.withParent(newRoot); assertThat(ctx.getProducerId(), is(id)); assertThat(ctx.getParentProducer(), is(not(root))); assertThat(ctx.getParentProducer(), is(newRoot)); }