protected RepositoryConfiguration assertValid( RepositoryConfiguration config ) { Problems results = config.validate(); assertThat(results.toString(), results.hasProblems(), is(false)); return config; }
}); Problems problems = config.get().validate(); if (problems.hasErrors()) { log.error("Problems with the ModeShape repository configuration: \n{}", problems);
private Repository deployRepository( String uri ) throws ResourceException { if (engine == null) { engine = ra.getEngine(); if (engine == null) { throw new ResourceException("Engine not started by resource adapter!"); } } // load configuration RepositoryConfiguration config = null; try { URL url = isAbsolutePath(uri) ? getClass().getClassLoader().getResource(uri) : new URL(uri); config = RepositoryConfiguration.read(url); } catch (Exception e) { throw new ResourceException(e); } // check configuration Problems problems = config.validate(); if (problems.hasErrors()) { throw new ResourceException(problems.toString()); } try { return engine.deploy(config); } catch (RepositoryException e) { throw new ResourceException(e); } }
Problems problems = config.validate(); if (problems.hasErrors()) { String message = "Problems in the Modeshape configuration";
protected RepositoryConfiguration assertHasWarnings( int numberOfWarnings, RepositoryConfiguration config ) { Problems results = config.validate(); assertThat(results.toString(), results.warningCount(), is(numberOfWarnings)); assertThat(results.toString(), results.hasWarnings(), is(numberOfWarnings != 0)); if (print) { System.out.println(results); } return config; }
/** * Create a Repository instance given the {@link RepositoryConfiguration configuration}. * * @param configuration the repository configuration; may not be null * @throws ConfigurationException if there is a problem with the configuration */ protected JcrRepository( RepositoryConfiguration configuration ) throws ConfigurationException { ModeShape.getName(); // force log message right up front this.config.set(configuration); RepositoryConfiguration config = this.config.get(); // Validate the configuration to make sure there are no errors ... Problems results = configuration.validate(); setConfigurationProblems(results); if (results.hasErrors()) { String msg = JcrI18n.errorsInRepositoryConfiguration.text(this.repositoryName, results.errorCount(), results.toString()); throw new ConfigurationException(results, msg); } this.repositoryName.set(config.getName()); this.logger = Logger.getLogger(getClass()); this.logger.debug("Activating '{0}' repository", this.repositoryName); // Set up the descriptors ... this.descriptors = new HashMap<String, Object>(); initializeDescriptors(); }
/** * Create a Repository instance given the {@link RepositoryConfiguration configuration}. * * @param configuration the repository configuration; may not be null * @throws ConfigurationException if there is a problem with the configuration */ protected JcrRepository( RepositoryConfiguration configuration ) throws ConfigurationException { ModeShape.getName(); // force log message right up front this.config.set(configuration); RepositoryConfiguration config = this.config.get(); // Validate the configuration to make sure there are no errors ... Problems results = configuration.validate(); setConfigurationProblems(results); if (results.hasErrors()) { String msg = JcrI18n.errorsInRepositoryConfiguration.text(this.repositoryName, results.errorCount(), results.toString()); throw new ConfigurationException(results, msg); } this.repositoryName.set(config.getName()); this.logger = Logger.getLogger(getClass()); this.logger.debug("Activating '{0}' repository", this.repositoryName); // Set up the descriptors ... this.descriptors = new HashMap<String, Object>(); initializeDescriptors(); }
protected RepositoryConfiguration assertValidWithWarnings( int warnings, RepositoryConfiguration config ) { Problems results = config.validate(); assertThat(results.toString(), results.hasErrors(), is(false)); assertThat(results.toString(), results.warningCount(), is(warnings)); return config; }
protected RepositoryConfiguration assertNotValid( int numberOfErrors, RepositoryConfiguration config ) { Problems results = config.validate(); assertThat(results.toString(), results.hasProblems(), is(true)); assertThat(results.toString(), results.hasErrors(), is(true)); assertThat(results.toString(), results.errorCount(), is(numberOfErrors)); if (print) { System.out.println(results); } return config; }
Problems problems = config.validate(); if (problems.hasErrors()) { System.err.println("Problems starting the engine.");
Problems problems = repositoryConfiguration.validate(); if (problems.hasErrors()) { throw new ConfigurationException(problems, JcrI18n.repositoryConfigurationIsNotValid.text(repoName,
Problems problems = repositoryConfiguration.validate(); if (problems.hasErrors()) { throw new ConfigurationException(problems, JcrI18n.repositoryConfigurationIsNotValid.text(repoName,
/*** * Validate this configuration if the supplied changes were made to this. Note that this does <i>not</i> actually change this * configuration. * * @param changes the proposed changes to this configuration's underlying document; never null * @return the validation results; never null * @see #edit() * @see #validate() */ public Problems validate( Changes changes ) { // Create a copy of this configuration ... Editor copy = edit(); copy.apply(changes); RepositoryConfiguration updated = new RepositoryConfiguration(copy.unwrap(), this.getName()); return updated.validate(); }
/*** * Validate this configuration if the supplied changes were made to this. Note that this does <i>not</i> actually change this * configuration. * * @param changes the proposed changes to this configuration's underlying document; never null * @return the validation results; never null * @see #edit() * @see #validate() */ public Problems validate( Changes changes ) { // Create a copy of this configuration ... Editor copy = edit(); copy.apply(changes); RepositoryConfiguration updated = new RepositoryConfiguration(copy.unwrap(), this.getName()); return updated.validate(); }
Problems validationResults = repositoryConfig.validate(changes);
@Test( expected = ConfigurationException.class ) public void shouldFailToDeployRepositoryConfigurationWithoutName() throws Throwable { config = new RepositoryConfiguration(); // without a name! assertThat(config.validate().hasErrors(), is(true)); engine.start(); engine.deploy(config); }
Problems validationResults = repositoryConfig.validate(changes);
Problems validationResults = repositoryConfig.validate(changes);
@Override protected void startRepositoryWithConfiguration( InputStream configInputStream ) throws Exception { stopRepository(); RepositoryConfiguration config = RepositoryConfiguration.read(configInputStream, REPO_NAME).with(new TestingEnvironment()); Problems problems = config.validate(); if (problems.hasProblems()) { System.out.println(problems); fail("Problems encountered during repository startup: " + problems); } repository = new JcrRepository(config); repository.start(); session = repository.login(); rootNode = session.getRootNode(); addSequencingListeners(session); }
Problems problems = repositoryConfiguration.validate(); if (!problems.isEmpty()) { LOG.debugv("Problems with configuration for '{0}' repository: {1}", repositoryName, problems);