/** * Start the repository using the supplied repository configuration. Note that this does <i>not</i> create a session. * * @param doc the document containing the configuration; may not be null * @param repoName the name of the repository; may not be null * @throws Exception if there is a problem starting the repository */ protected void startRepositoryWith( Document doc, String repoName ) throws Exception { RepositoryConfiguration config = new RepositoryConfiguration(doc, repoName, new TestingEnvironment()); repository = new JcrRepository(config); repository.start(); }
@Before public void beforeEach() throws Exception { repository = new JcrRepository(new RepositoryConfiguration("repoName", new TestingEnvironment())); repository.start(); print = false; }
public static JcrRepository startRepositoryWithConfig( String configFile ) throws Exception { URL configUrl = TestingUtil.class.getClassLoader().getResource(configFile); RepositoryConfiguration config = RepositoryConfiguration.read(configUrl).with(new TestingEnvironment()); JcrRepository repository = null; repository = new JcrRepository(config); repository.start(); return repository; }
@Override protected RepositoryConfiguration createRepositoryConfiguration(String repositoryName) throws Exception { RepositoryConfiguration config = RepositoryConfiguration.read(getRepositoryConfigStream(), repositoryName); return config.with(new TestingEnvironment()); }
@Before public void beforeEach() throws Exception { environment = new TestingEnvironment(); config = RepositoryConfiguration.read("{ \"name\":\"my-repo\" }").with(environment); engine = new ModeShapeEngine(); }
@Before public void beforeEach() throws Exception { FileUtil.delete("target/concurrent_load_non_clustered"); print = false; config = RepositoryConfiguration.read("load/concurrent-load-repo-config.json").with(new TestingEnvironment()); engine = new ModeShapeEngine(); }
protected void startRepository() throws Exception { RepositoryConfiguration repositoryConfiguration = createRepositoryConfiguration(REPO_NAME); repositoryConfiguration = repositoryConfiguration.with(new TestingEnvironment()); repository = new JcrRepository(repositoryConfiguration); repository.start(); session = repository.login(); }
/** * Subclasses can call this method at the beginning of each test to shutdown any currently-running repository and to start up * a new repository with the given repository configuration * * @param configuration the repository configuration object; may not be null can be used in place of double quote, making it * easier for to specify a JSON content as a Java string) * @throws Exception if there was a problem starting the repository * @see #startRepositoryWithConfiguration(String) * @see #startRepositoryWithConfiguration(Document) * @see #startRepositoryWithConfiguration(InputStream) * @see #startRepositoryAutomatically */ protected void startRepositoryWithConfiguration( RepositoryConfiguration configuration ) throws Exception { // always use the test environment to provide some persistence defaults... configuration = configuration.with(new TestingEnvironment()); assertThat(configuration, is(notNullValue())); if (repository != null) { try { repository.shutdown().get(10, TimeUnit.SECONDS); } finally { repository = null; } } repository = new JcrRepository(configuration); repository.start(); session = repository.login(); }
@Before public void beforeEach() { logger = Logger.getLogger(getClass()); // default to an in-memory h2 schematicDb = Schematic.getDb(new TestingEnvironment().defaultPersistenceConfiguration()); schematicDb.start(); TransactionManagerLookup txManagerLookup = new DefaultTransactionManagerLookup(); TransactionManager txManager = txManagerLookup.getTransactionManager(); assertNotNull("Was not able to locate a transaction manager in the test classpath", txManager); repoEnv = new TestRepositoryEnvironment(txManager, schematicDb); }
protected static void startRepository( RepositoryConfiguration configuration ) throws Exception { TestingEnvironment environment = new TestingEnvironment(); RepositoryConfiguration config = configuration != null ? new RepositoryConfiguration(configuration.getDocument(), configuration.getName(), environment) : new RepositoryConfiguration(REPO_NAME, environment); repository = new JcrRepository(config); repository.start(); session = repository.login(); }
@Override protected void startRepositoryWithConfiguration( Document doc ) throws Exception { stopRepository(); RepositoryConfiguration config = new RepositoryConfiguration(doc, REPO_NAME).with(new TestingEnvironment()); repository = new JcrRepository(config); repository.start(); session = repository.login(); rootNode = session.getRootNode(); addSequencingListeners(session); }
@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); }
@Before public void beforeEach() throws Exception { config = new RepositoryConfiguration("repoName").with(new TestingEnvironment()); repository = new JcrRepository(config); repository.start(); SessionCache systemCache = repository.createSystemSession(repository.runningState().context(), false); system = new SystemContent(systemCache); }
@Before public void beforeEach() throws Exception { config = new RepositoryConfiguration("repoName").with(new TestingEnvironment()); repository = new JcrRepository(config); repository.start(); context = repository.runningState().context(); repoTypeManager = repository.nodeTypeManager(); session = repository.login(); }
@Before public void beforeTest() throws Exception { // create a default in-memory db.... db = Schematic.getDb(new TestingEnvironment().defaultPersistenceConfiguration()); db.start(); TransactionManagerLookup txLookup = new DefaultTransactionManagerLookup(); TransactionManager tm = txLookup.getTransactionManager(); assertNotNull("Cannot find a transaction manager", tm); repoEnv = new TestRepositoryEnvironment(tm, db); localStore = new LocalDocumentStore(db, repoEnv); }
config = new RepositoryConfiguration(config.getDocument(), "repoName", new TestingEnvironment()); repository = new JcrRepository(config); repository.start();
@Test @FixFor( "MODE-2056" ) public void shouldReturnActiveSessions() throws Exception { shutdownDefaultRepository(); RepositoryConfiguration config = new RepositoryConfiguration("repoName", new TestingEnvironment()); repository = new JcrRepository(config); assertEquals(0, repository.getActiveSessionsCount()); repository.start(); JcrSession session1 = repository.login(); JcrSession session2 = repository.login(); assertEquals(2, repository.getActiveSessionsCount()); session2.logout(); assertEquals(1, repository.getActiveSessionsCount()); session1.logout(); assertEquals(0, repository.getActiveSessionsCount()); repository.login(); repository.shutdown().get(); assertEquals(0, repository.getActiveSessionsCount()); }