Package atg.nucleus

Examples of atg.nucleus.Nucleus


        final Field[] fields = testInstance.getClass().getDeclaredFields();
        for (final Field field : fields) {
            if (field.isAnnotationPresent(Nuke.class)) {
                foundNucleus = true;
                try {
                    final Nucleus nucleus = (Nucleus) FieldUtils.readField(field, testInstance, true);
                    logger.info("Found Nucleus: {}.", nucleus.getAbsoluteName());
                    if (nucleus.isRunning()) {
                        logger.info("Stopping Nucleus.");
                        nucleus.stopService();
                    }
                } catch (IllegalAccessException e) {
                    logger.catching(e);
                    logger.error("Can't access test instance's Nucleus. Strange.");
                } catch (ServiceException e) {
View Full Code Here


    }

    public Nucleus createNucleus(@NotNull final File configPath)
            throws IOException {
        logger.entry(configPath);
        final Nucleus existing = getAlreadyRunningNucleus(configPath);
        if (existing != null) {
            return existing;
        }
        setUpConfiguration(configPath);
        readDynamoLicense();
        setSystemPropertiesFromEnvironment();
        final String fullConfigPath = buildAtgConfigPath(configPath);
        setSystemAtgConfigPath(fullConfigPath);
        final Nucleus nucleus = initializeNucleusWithConfigPath(fullConfigPath);
        nuclei.put(configPath, nucleus);
        return logger.exit(nucleus);
    }
View Full Code Here

    }

    private Nucleus getAlreadyRunningNucleus(final File configPath) {
        logger.entry(configPath);
        if (nuclei.containsKey(configPath)) {
            final Nucleus nucleus = nuclei.get(configPath);
            if (nucleus != null && nucleus.isRunning()) {
                return logger.exit(nucleus);
            }
        }
        return logger.exit(null);
    }
View Full Code Here

        );
        propFile.deleteOnExit();
        List<String> initial = new ArrayList<String>();
        initial.add("/test/SimpleComponentGlobalScope");
        NucleusUtils.createInitial(configpath, initial);
        Nucleus n = NucleusUtils.startNucleus(configpath);
        SimpleComponent testComponent = null;
        try {
            testComponent = (SimpleComponent) n.resolveName("/test/SimpleComponentGlobalScope");
            assertNotNull("Could not resolve test component", testComponent);
            assertTrue(
                    "Test component did not start up cleanly.", testComponent.isCleanStart
            );

        } finally {
            n.stopService();
            assertNotNull(testComponent);
            assertFalse(
                    "Test component did not shut down cleanly.", testComponent.isCleanStart
            );
            testComponent = null;
View Full Code Here

     * component is added that exact same one
     */
    @Test
    public void testAddComponent()
            throws Exception {
        Nucleus n = null;
        try {
            n = new Nucleus("");
            Object component = "I'm the test component";
            String path = "/foo/Test";
            Object component2 = "I'm the test component too";
            String path2 = "/foo/Test2";
            NucleusUtils.addComponent(n, path, component);
            NucleusUtils.addComponent(n, path2, component2);
            Object result = n.resolveName(path);
            Object result2 = n.resolveName(path2);
            // Make sure we get something
            assertNotNull(result);
            assertNotNull(result2);
            // Make sure it's the same component we added
            assertEquals(component, result);
            assertEquals(component2, result2);
        } finally {
            if (n != null) {
                n.stopService();
            }
        }
    }
View Full Code Here

        GSATestUtils.getGSATestUtils().initializeMinimalConfigpath(
                configpath, "/SimpleRepository", definitionFiles, props, null, null, null, false
        );

        // Start Nucleus
        Nucleus n = startNucleus(configpath);

        TransactionDemarcation td = new TransactionDemarcation();
        MutableRepository r = (MutableRepository) n.resolveName("/SimpleRepository");

        try {
            // Start a new transaction
            td.begin(((GSARepository) r).getTransactionManager());
            // Create the item
            MutableRepositoryItem item = r.createItem("simpleItem");
            item.setPropertyValue("name", "simpleName");
            // Persist to the repository
            r.addItem(item);
            // Try to get it back from the repository
            String id = item.getRepositoryId();
            RepositoryItem item2 = r.getItem(id, "simpleItem");
            assertNotNull(
                    " We did not get back the item just created from the repository.", item2
            );
            rollback = false;
        } finally {
            // End the transaction, rollback on error
            td.end(rollback);
            // shut down Nucleus
            n.stopService();
            // Shut down HSQLDB
            db.shutdown();
        }
    }
View Full Code Here

                null,
                null,
                null,
                true
        );
        Nucleus n = startNucleus(pConfigPathWhereToCreateTheRepository);
        GSARepository r = (GSARepository) n.resolveName(repositoryComponentPath);
        try {
            getClass().getMethod(pMethodName, new Class[] { GSARepository.class })
                    .invoke(this, r);
        } catch ( NoSuchMethodError e ) {
            throw new AssertionError(
                    "Please declare a method with name "
                    + pMethodName
                    + " in your class. It must take an atg.adapter.gsa.GSARepository as the only parameter."
            );
        } finally {
            // if it were null a NPE would have occurred at the earlier dereference
            //if(n != null)
            n.stopService();
        }
    }
View Full Code Here

            listArgs.add("-initialService");
            listArgs.add(startupOptions.getInitialService());

            PropertyEditors.registerEditors();
            logger.info("Starting nucleus with arguments: " + listArgs);
            Nucleus n = Nucleus.startNucleus(listArgs.toArray(new String[listArgs.size()]));

            // remember our temporary server directory for later deletion
            nucleiConfigPathsCache.put(n, fileServerDir);
            // clear out the variable, so our finally clause knows not to
            // delete it
View Full Code Here

    public static Repository duplicateRepository(GSARepository pRepository,
                                                 DataSource pDS,
                                                 boolean pStart)
            throws ServiceException {
        Configuration c = pRepository.getServiceConfiguration();
        Nucleus n = pRepository.getNucleus();
        NucleusNameResolver r = new NucleusNameResolver(
                n, n, pRepository.getNameContext(), true
        );
        GSARepository newRepository = null;
        if (pRepository instanceof VersionRepository) {
View Full Code Here

     *
     * @throws ServiceException
     */
    void prepare()
            throws ServiceException {
        Nucleus n = Nucleus.getGlobalNucleus();
        if ( n == null ) {
            throw new ServiceException("Nucleus is not running.");
        } else {
            n.logInfo("Prepared.");
        }
        isCleanStart = true;
    }
View Full Code Here

TOP

Related Classes of atg.nucleus.Nucleus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.