Package org.jahia.services.sites

Examples of org.jahia.services.sites.JahiaSite


    private static final String GENEVA = "geneva";


    @BeforeClass
    public static void oneTimeSetUp() throws Exception {
        JahiaSite site = TestHelper.createSite(TESTSITE_NAME);
        assertNotNull(site);

        JCRSessionWrapper session = JCRSessionFactory.getInstance().getCurrentUserSession(Constants.EDIT_WORKSPACE,
                LanguageCodeConverters.languageCodeToLocale(DEFAULT_LANGUAGE));
View Full Code Here


    private final static String SITECONTENT_ROOT_NODE = "/sites/" + TESTSITE_NAME;

    @BeforeClass
    public static void oneTimeSetUp() throws Exception {
        try {
            JahiaSite site = TestHelper.createSite(TESTSITE_NAME);
            assertNotNull(site);

            JCRStoreService jcrService = ServicesRegistry.getInstance()
                    .getJCRStoreService();
            JCRSessionWrapper session = jcrService.getSessionFactory()
View Full Code Here

    protected JCRSiteNode site;

    @Before
    public void setUp() throws Exception {
        try {
            JahiaSite site = TestHelper.createSite("test");
            paramBean = (ParamBean) Jahia.getThreadParamBean();

            paramBean.getSession(true).setAttribute(ParamBean.SESSION_SITE, site);

            session = JCRSessionFactory.getInstance().getCurrentUserSession(Constants.EDIT_WORKSPACE, Locale.ENGLISH);
            this.site = (JCRSiteNode) session.getNode("/sites/"+site.getSiteKey());
           
            String templatesFolder = "/sites/"+site.getSiteKey() + "/templates";
            InputStream importStream = IndexOptionsTest.class.getClassLoader()
                    .getResourceAsStream("imports/importTemplatesForCacheTest.xml");
            session.importXML(templatesFolder + "/base", importStream,
                    ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);
            importStream.close();
            session.save();  
           
            JCRNodeWrapper shared = this.site.getNode("home");
            if (shared.hasNode("testContent")) {
                shared.getNode("testContent").remove();
            }
            if(shared.isVersioned()) session.checkout(shared);
            node = shared.addNode("testContent", "jnt:page");
            node.setProperty("jcr:title", "English test page");
            node.setProperty("j:templateNode", session.getNode(
                    templatesFolder + "/base/pagetemplate/subpagetemplate"));           
            node.addNode("testType2", "jnt:mainContent");
            session.save();
            final JCRPublicationService service = JCRPublicationService.getInstance();
           
            List<PublicationInfo> infoList = service.getPublicationInfo(
                    session.getNode(
                            templatesFolder + "/base/pagetemplate").getIdentifier(), new LinkedHashSet<String>(Arrays.asList(Locale.ENGLISH.toString())),
                    true, true, true, Constants.EDIT_WORKSPACE, Constants.LIVE_WORKSPACE);
            service.publishByInfoList(infoList, Constants.EDIT_WORKSPACE, Constants.LIVE_WORKSPACE,Collections.<String>emptyList());
           
            infoList = service.getPublicationInfo(
                    shared.getIdentifier(), new LinkedHashSet<String>(Arrays.asList(Locale.ENGLISH.toString())),
                    true, true, true, Constants.EDIT_WORKSPACE, Constants.LIVE_WORKSPACE);
            service.publishByInfoList(infoList, Constants.EDIT_WORKSPACE, Constants.LIVE_WORKSPACE,Collections.<String>emptyList());
           
            session = JCRSessionFactory.getInstance().getCurrentUserSession(Constants.LIVE_WORKSPACE, Locale.ENGLISH);
            node = session.getNode("/sites/"+site.getSiteKey()+"/home/testContent");
        } catch (Exception e) {
            logger.warn("Exception during test setUp", e);
        }
    }
View Full Code Here

            fs.delete(testdir, true);
            urlPath = new Path(testdir, "urls");
            crawldbPath = new Path(testdir, "crawldb");
            segmentsPath = new Path(testdir, "segments");

            final JahiaSite defaultSite = ServicesRegistry.getInstance().getJahiaSitesService().getSiteByKey(ACMESITE_NAME);
            if (defaultSite == null) {
                final JCRPublicationService jcrService = ServicesRegistry.getInstance().getJCRPublicationService();
                JCRTemplate.getInstance().doExecuteWithSystemSession(new JCRCallback<Object>() {
                    public Object doInJCR(JCRSessionWrapper session) throws RepositoryException {
                        try {
View Full Code Here

            JCRNodeWrapper homeNode = null;
            try {
                homeNode = session.getRootNode().getNode(sitePath + "/home");
            } catch (PathNotFoundException e) {
                if (ACME_SITECONTENT_ROOT_NODE.equals(sitePath)) {
                    JahiaSite defaultSite = ServicesRegistry.getInstance().getJahiaSitesService().getDefaultSite();
                    sitePath = defaultSite != null ? "sites/" + defaultSite.getSiteKey() : null;
                    homeNode = session.getRootNode().getNode(sitePath + "/home");                   
                }
            }
           
            Resource resource = new Resource(homeNode, "html", null, Resource.CONFIGURATION_PAGE);
View Full Code Here

TOP

Related Classes of org.jahia.services.sites.JahiaSite

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.