Source Code Cross Referenced for TestRegistryDirectPart1a.java in  » Portal » jetspeed-2.1.3 » org » apache » jetspeed » components » portletregistry » direct » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » jetspeed 2.1.3 » org.apache.jetspeed.components.portletregistry.direct 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.jetspeed.components.portletregistry.direct;
018:
019:        import java.util.Arrays;
020:        import java.util.Locale;
021:
022:        import javax.portlet.PortletMode;
023:
024:        import org.apache.jetspeed.components.persistence.store.LockFailedException;
025:        import org.apache.jetspeed.components.portletregistry.AbstractRegistryTest;
026:        import org.apache.jetspeed.components.portletregistry.RegistryException;
027:        import org.apache.jetspeed.om.common.DublinCore;
028:        import org.apache.jetspeed.om.common.GenericMetadata;
029:        import org.apache.jetspeed.om.common.JetspeedServiceReference;
030:        import org.apache.jetspeed.om.common.UserAttribute;
031:        import org.apache.jetspeed.om.common.UserAttributeRef;
032:        import org.apache.jetspeed.om.common.portlet.ContentTypeComposite;
033:        import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
034:        import org.apache.jetspeed.om.common.preference.PreferenceComposite;
035:        import org.apache.jetspeed.om.impl.DublinCoreImpl;
036:        import org.apache.jetspeed.om.impl.JetspeedServiceReferenceImpl;
037:        import org.apache.jetspeed.om.impl.UserAttributeImpl;
038:        import org.apache.jetspeed.om.impl.UserAttributeRefImpl;
039:        import org.apache.jetspeed.om.portlet.impl.ContentTypeImpl;
040:        import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
041:        import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
042:        import org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl;
043:        import org.apache.jetspeed.util.JetspeedLocale;
044:        import org.apache.pluto.om.common.PreferenceSetCtrl;
045:
046:        /**
047:         * 
048:         * TestRegistry runs a suite tests creating, updating, retreiving and deleting
049:         * portlet information from the registry.
050:         * 
051:         * @author <a href="mailto:weaver@apache.org">Scott T. Weaver </a>
052:         * @version $Id: TestRegistryDirectPart1a.java 516448 2007-03-09 16:25:47Z ate $
053:         *  
054:         */
055:        public class TestRegistryDirectPart1a extends AbstractRegistryTest {
056:
057:            /*
058:             * (non-Javadoc)
059:             * 
060:             * @see junit.framework.TestCase#setUp()
061:             */
062:            protected void setUp() throws Exception {
063:                super .setUp();
064:                buildTestData();
065:
066:            }
067:
068:            /*
069:             * (non-Javadoc)
070:             * 
071:             * @see junit.framework.TestCase#tearDown()
072:             */
073:            protected void tearDown() throws Exception {
074:                //  super.tearDown();
075:            }
076:
077:            /**
078:             * <p>
079:             * buildTestData
080:             * </p>
081:             * 
082:             * @throws RegistryException
083:             * @throws LockFailedException
084:             */
085:            private void buildTestData() throws RegistryException,
086:                    LockFailedException {
087:                // Create an Application and a Web app      
088:                PortletApplicationDefinitionImpl app = new PortletApplicationDefinitionImpl();
089:                app.setName("App_1");
090:                app.setApplicationIdentifier("App_1");
091:
092:                UserAttributeRef uaRef = new UserAttributeRefImpl(
093:                        "user-name-family", "user.name.family");
094:                app.addUserAttributeRef(uaRef);
095:
096:                UserAttribute ua = new UserAttributeImpl("user.name.family",
097:                        "User Last Name");
098:                app.addUserAttribute(ua);
099:
100:                JetspeedServiceReference service1 = new JetspeedServiceReferenceImpl(
101:                        "PortletEntityAccessComponent");
102:                app.addJetspeedService(service1);
103:                JetspeedServiceReference service2 = new JetspeedServiceReferenceImpl(
104:                        "PortletRegistryComponent");
105:                app.addJetspeedService(service2);
106:
107:                addDublinCore(app.getMetadata());
108:
109:                WebApplicationDefinitionImpl webApp = new WebApplicationDefinitionImpl();
110:                webApp.setContextRoot("/app1");
111:                webApp.addDescription(Locale.FRENCH,
112:                        "Description: Le fromage est dans mon pantalon!");
113:                webApp.addDisplayName(Locale.FRENCH,
114:                        "Display Name: Le fromage est dans mon pantalon!");
115:
116:                PortletDefinitionComposite portlet = new PortletDefinitionImpl();
117:                portlet.setClassName("org.apache.Portlet");
118:                portlet.setName("Portlet 1");
119:                portlet.addDescription(Locale.getDefault(),
120:                        "Portlet description.");
121:                portlet.addDisplayName(Locale.getDefault(),
122:                        "Portlet display Name.");
123:
124:                portlet
125:                        .addInitParameter("testparam", "test value",
126:                                "This is a test portlet parameter", Locale
127:                                        .getDefault());
128:
129:                addDublinCore(portlet.getMetadata());
130:
131:                // PreferenceComposite pc = new PrefsPreference();
132:                app.addPortletDefinition(portlet);
133:                PreferenceSetCtrl prefSetCtrl = (PreferenceSetCtrl) portlet
134:                        .getPreferenceSet();
135:                PreferenceComposite pc = (PreferenceComposite) prefSetCtrl.add(
136:                        "preference 1", Arrays.asList(new String[] { "value 1",
137:                                "value 2" }));
138:                pc.addDescription(JetspeedLocale.getDefaultLocale(),
139:                        "Preference Description");
140:
141:                assertNotNull(pc.getValueAt(0));
142:
143:                portlet.addLanguage(registry.createLanguage(
144:                        Locale.getDefault(), "Portlet 1", "Portlet 1",
145:                        "This is Portlet 1", null));
146:
147:                ContentTypeComposite html = new ContentTypeImpl();
148:                html.setContentType("html/text");
149:                ContentTypeComposite wml = new ContentTypeImpl();
150:                html.addPortletMode(new PortletMode(MODE_EDIT));
151:                html.addPortletMode(new PortletMode(MODE_VIEW));
152:                html.addPortletMode(new PortletMode(MODE_HELP));
153:                wml.setContentType("wml");
154:                wml.addPortletMode(new PortletMode(MODE_HELP));
155:                wml.addPortletMode(new PortletMode(MODE_VIEW));
156:                portlet.addContentType(html);
157:                portlet.addContentType(wml);
158:
159:                app.setWebApplicationDefinition(webApp);
160:                registry.registerPortletApplication(app);
161:            }
162:
163:            private void addDublinCore(GenericMetadata metadata) {
164:                DublinCore dc = new DublinCoreImpl(metadata);
165:                dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 1");
166:                dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 2");
167:                dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 3");
168:                dc.addContributor(JetspeedLocale.getDefaultLocale(),
169:                        "Contrib 1");
170:                dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 1");
171:                dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 2");
172:                dc.addCreator(JetspeedLocale.getDefaultLocale(), "Creator 1");
173:                dc.addDescription(JetspeedLocale.getDefaultLocale(),
174:                        "Description 1");
175:                dc.addFormat(JetspeedLocale.getDefaultLocale(), "Format 1");
176:                dc.addIdentifier(JetspeedLocale.getDefaultLocale(),
177:                        "Identifier 1");
178:                dc.addLanguage(JetspeedLocale.getDefaultLocale(), "Language 1");
179:                dc.addPublisher(JetspeedLocale.getDefaultLocale(),
180:                        "Publisher 1");
181:                dc.addRelation(JetspeedLocale.getDefaultLocale(), "Relation 1");
182:                dc.addRight(JetspeedLocale.getDefaultLocale(), "Right 1");
183:                dc.addSource(JetspeedLocale.getDefaultLocale(), "Source 1");
184:                dc.addSubject(JetspeedLocale.getDefaultLocale(), "Subject 1");
185:                dc.addType(JetspeedLocale.getDefaultLocale(), "Type 1");
186:            }
187:
188:            public void testData() throws Exception {
189:                verifyData(false);
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.