001: /*
002: * Copyright (C) 2006 Methodhead Software LLC. All rights reserved.
003: *
004: * This file is part of TransferCM.
005: *
006: * TransferCM is free software; you can redistribute it and/or modify it under the
007: * terms of the GNU General Public License as published by the Free Software
008: * Foundation; either version 2 of the License, or (at your option) any later
009: * version.
010: *
011: * TransferCM is distributed in the hope that it will be useful, but WITHOUT ANY
012: * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
013: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
014: * details.
015: *
016: * You should have received a copy of the GNU General Public License along with
017: * TransferCM; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
018: * Fifth Floor, Boston, MA 02110-1301 USA
019: */
020:
021: package com.methodhead.shim;
022:
023: import com.methodhead.persistable.*;
024: import com.methodhead.test.*;
025: import com.methodhead.sitecontext.*;
026: import javax.servlet.http.*;
027:
028: public class TestSite {
029:
030: // constructors /////////////////////////////////////////////////////////////
031:
032: // constants ////////////////////////////////////////////////////////////////
033:
034: // classes //////////////////////////////////////////////////////////////////
035:
036: // methods //////////////////////////////////////////////////////////////////
037:
038: public void createPages() {
039: siteContext1_ = new SiteContext();
040: siteContext1_.saveNew();
041:
042: Panel panel = null;
043:
044: panel = new Panel();
045: panel.setName("body");
046: panel.setModuleClass("com.methodhead.shim.MockModule");
047:
048: page1_ = new Page();
049: page1_.set("title", "Page1");
050: page1_.set("aliasname", "page1");
051: page1_.setBoolean("hidden", false);
052: page1_.setString("template", "template.jsp");
053: page1_.addPanel(panel);
054: page1_.setSiteContext(SiteContext.getDefaultContext());
055: page1_.saveNew();
056:
057: page2_ = new Page();
058: page2_.set("title", "Page2");
059: page2_.set("aliasname", "page2");
060: page2_.setBoolean("hidden", true);
061: page2_.setString("template", "template.jsp");
062: page2_.addPanel(panel);
063: page2_.setSiteContext(SiteContext.getDefaultContext());
064: page2_.saveNew();
065:
066: page3_ = new Page();
067: page3_.set("title", "Page3");
068: page3_.set("aliasname", "page3");
069: page3_.setBoolean("hidden", false);
070: page3_.setString("template", "template.jsp");
071: page3_.addPanel(panel);
072: page3_.setSiteContext(SiteContext.getDefaultContext());
073: page3_.saveNew();
074:
075: page4_ = new Page();
076: page4_.set("title", "Page4");
077: page4_.set("aliasname", "page4");
078: page4_.setBoolean("hidden", false);
079: page4_.setString("template", "template.jsp");
080: page4_.addPanel(panel);
081: page4_.setSiteContext(SiteContext.getDefaultContext());
082: page4_.saveNew();
083:
084: page5_ = new Page();
085: page5_.set("title", "Page5");
086: page5_.set("aliasname", "page5");
087: page5_.setBoolean("hidden", false);
088: page5_.setString("template", "template.jsp");
089: page5_.addPanel(panel);
090: page5_.setSiteContext(SiteContext.getDefaultContext());
091: page5_.saveNew();
092:
093: page6_ = new Page();
094: page6_.set("title", "Page6");
095: page6_.set("aliasname", "page6");
096: page6_.setBoolean("hidden", false);
097: page6_.setString("template", "template.jsp");
098: page6_.addPanel(panel);
099: page6_.setSiteContext(SiteContext.getDefaultContext());
100: page6_.saveNew();
101:
102: page7_ = new Page();
103: page7_.set("title", "Page7");
104: page7_.set("aliasname", "page7");
105: page7_.setBoolean("hidden", false);
106: page7_.setString("template", "template.jsp");
107: page7_.addPanel(panel);
108: page7_.setSiteContext(siteContext1_);
109: page7_.saveNew();
110: }
111:
112: public void createLinks() {
113:
114: link1_ = new Link();
115: link1_.setPageId(1);
116: link1_.setTitle("Page1");
117: link1_.setAlias("page1");
118:
119: link2_ = new Link();
120: link2_.setPageId(2);
121: link2_.setTitle("Page2");
122: link2_.setAlias("page2");
123:
124: link3_ = new Link();
125: link3_.setPageId(3);
126: link3_.setTitle("Page3");
127: link3_.setAlias("page3");
128:
129: link4_ = new Link();
130: link4_.setPageId(4);
131: link4_.setTitle("Page4");
132: link4_.setAlias("page4");
133:
134: link5_ = new Link();
135: link5_.setPageId(5);
136: link5_.setTitle("Page5");
137: link5_.setAlias("page5");
138:
139: link6_ = new Link();
140: link6_.setPageId(6);
141: link6_.setTitle("Page6");
142: link6_.setAlias("page6");
143:
144: //
145: // Page1
146: // Page2
147: // Page3
148: // Page4
149: // Page5
150: // Page6
151: //
152: link1_.add(link2_);
153: link2_.add(link3_);
154: link1_.add(link4_);
155: link5_.add(link6_);
156: link1_.add(link5_);
157: }
158:
159: public void createSiteMap() {
160: siteMap_ = new SiteMap();
161: siteMap_.setRoot(link1_);
162: siteMap_.setSiteContext(SiteContext.getDefaultContext());
163: siteMap_.save();
164: }
165:
166: public void createSiteMapTree() {
167: siteMapTree_ = new SiteMapTree();
168: siteMapTree_.build(siteMap_);
169: }
170:
171: // properties ///////////////////////////////////////////////////////////////
172:
173: // attributes ///////////////////////////////////////////////////////////////
174:
175: public SiteContext siteContext1_ = null;
176:
177: public Page page1_ = null;
178: public Page page2_ = null;
179: public Page page3_ = null;
180: public Page page4_ = null;
181: public Page page5_ = null;
182: public Page page6_ = null;
183:
184: public Page page7_ = null;
185:
186: public Link link1_ = null;
187: public Link link2_ = null;
188: public Link link3_ = null;
189: public Link link4_ = null;
190: public Link link5_ = null;
191: public Link link6_ = null;
192:
193: public SiteMap siteMap_ = null;
194:
195: public SiteMapTree siteMapTree_ = null;
196: }
|