KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > methodhead > shim > TestSite


1 /*
2  * Copyright (C) 2006 Methodhead Software LLC. All rights reserved.
3  *
4  * This file is part of TransferCM.
5  *
6  * TransferCM is free software; you can redistribute it and/or modify it under the
7  * terms of the GNU General Public License as published by the Free Software
8  * Foundation; either version 2 of the License, or (at your option) any later
9  * version.
10  *
11  * TransferCM is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * TransferCM; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
18  * Fifth Floor, Boston, MA 02110-1301 USA
19  */

20
21 package com.methodhead.shim;
22
23 import com.methodhead.persistable.*;
24 import com.methodhead.test.*;
25 import com.methodhead.sitecontext.*;
26 import javax.servlet.http.*;
27
28 public class TestSite {
29
30   // constructors /////////////////////////////////////////////////////////////
31

32   // constants ////////////////////////////////////////////////////////////////
33

34   // classes //////////////////////////////////////////////////////////////////
35

36   // methods //////////////////////////////////////////////////////////////////
37

38   public void createPages() {
39     siteContext1_ = new SiteContext();
40     siteContext1_.saveNew();
41
42     Panel panel = null;
43
44     panel = new Panel();
45     panel.setName( "body" );
46     panel.setModuleClass( "com.methodhead.shim.MockModule" );
47
48     page1_ = new Page();
49     page1_.set( "title", "Page1" );
50     page1_.set( "aliasname", "page1" );
51     page1_.setBoolean( "hidden", false );
52     page1_.setString( "template", "template.jsp" );
53     page1_.addPanel( panel );
54     page1_.setSiteContext( SiteContext.getDefaultContext() );
55     page1_.saveNew();
56
57     page2_ = new Page();
58     page2_.set( "title", "Page2" );
59     page2_.set( "aliasname", "page2" );
60     page2_.setBoolean( "hidden", true );
61     page2_.setString( "template", "template.jsp" );
62     page2_.addPanel( panel );
63     page2_.setSiteContext( SiteContext.getDefaultContext() );
64     page2_.saveNew();
65
66     page3_ = new Page();
67     page3_.set( "title", "Page3" );
68     page3_.set( "aliasname", "page3" );
69     page3_.setBoolean( "hidden", false );
70     page3_.setString( "template", "template.jsp" );
71     page3_.addPanel( panel );
72     page3_.setSiteContext( SiteContext.getDefaultContext() );
73     page3_.saveNew();
74
75     page4_ = new Page();
76     page4_.set( "title", "Page4" );
77     page4_.set( "aliasname", "page4" );
78     page4_.setBoolean( "hidden", false );
79     page4_.setString( "template", "template.jsp" );
80     page4_.addPanel( panel );
81     page4_.setSiteContext( SiteContext.getDefaultContext() );
82     page4_.saveNew();
83
84     page5_ = new Page();
85     page5_.set( "title", "Page5" );
86     page5_.set( "aliasname", "page5" );
87     page5_.setBoolean( "hidden", false );
88     page5_.setString( "template", "template.jsp" );
89     page5_.addPanel( panel );
90     page5_.setSiteContext( SiteContext.getDefaultContext() );
91     page5_.saveNew();
92
93     page6_ = new Page();
94     page6_.set( "title", "Page6" );
95     page6_.set( "aliasname", "page6" );
96     page6_.setBoolean( "hidden", false );
97     page6_.setString( "template", "template.jsp" );
98     page6_.addPanel( panel );
99     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 }
197
Popular Tags