Source Code Cross Referenced for UpgradeUtilsTest.java in  » Portal » Open-Portal » com » sun » portal » fabric » upgrade » test » 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 » Open Portal » com.sun.portal.fabric.upgrade.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.sun.portal.fabric.upgrade.test;
002:
003:        import junit.framework.*;
004:        import com.sun.portal.fabric.upgrade.UpgradeUtils;
005:        import com.sun.portal.fabric.upgrade.UpgradeConstants;
006:        import com.sun.portal.fabric.upgrade.UpgradeException;
007:        import com.sun.portal.fabric.util.FileUtil;
008:        import com.sun.portal.fabric.util.ExecuteUtil;
009:
010:        import java.io.File;
011:        import java.util.Properties;
012:        import java.util.logging.Logger;
013:
014:        public class UpgradeUtilsTest extends TestCase {
015:            UpgradeUtils upgradeUtils;
016:
017:            public void testAnything() {
018:                Properties p = new Properties();
019:                boolean PORTAL_INSTALLED = true;
020:                p.setProperty("PORTAL_INSTALLED", "" + PORTAL_INSTALLED);
021:                if (p.getProperty("PORTAL_INSTALLED").equalsIgnoreCase("true"))
022:                    System.out.print("ok");
023:            }
024:
025:            public void testCopyAllAMFilesToVarTmpPortal() throws Exception {
026:                System.out.println("Test File copy operation.");
027:                System.out.println("List of Files in PS631 directory:");
028:                String[] resDirs631 = UpgradeConstants.RESOURCE_DIRS_PS631;
029:
030:                String[] flist = null;
031:                flist = UpgradeUtils.returnFileListEndingWith(resDirs631[0],
032:                        null, ".xml");
033:                if (flist != null)
034:                    for (int i = 0; i < flist.length; i++)
035:                        System.out.println("File in resource dir " + flist[i]);
036:
037:                System.out.println();
038:                //Method to test.
039:                upgradeUtils.copyAllAMFilesToVarTmpPortal(resDirs631);
040:
041:                String portalUpgradeTmpDir = UpgradeConstants.SOLARIS_TMP_DIR
042:                        + File.separator
043:                        + "portal"
044:                        + File.separator
045:                        + resDirs631[0].substring(resDirs631[0]
046:                                .lastIndexOf(File.separator) + 1, resDirs631[0]
047:                                .length());
048:                flist = UpgradeUtils.returnFileListEndingWith(
049:                        portalUpgradeTmpDir, null, ".xml");
050:                if (flist != null)
051:                    for (int i = 0; i < flist.length; i++)
052:                        System.out.println("File in " + portalUpgradeTmpDir
053:                                + " is " + flist[i]);
054:            }
055:
056:            public void testReturnFileListHavingPattern() throws Exception {
057:                String[] flist = null;
058:                flist = UpgradeUtils
059:                        .returnFileListEndingWith(".", null, ".xml");
060:                if (flist != null)
061:                    System.out.println("Files count=" + flist.length);
062:
063:                flist = new File(".").list();
064:                for (int i = 0; i < flist.length; i++)
065:                    System.out.println(flist[i]);
066:                System.out.println(new File(".").getAbsolutePath());
067:            }
068:
069:            /**
070:             * This Test case verifies that for a given upgrade scenario, whether DP updates processing is Fine.
071:             * Example here is for  PS6.3.1-->PS7.1 upgrade
072:             * @throws Exception
073:             * @throws UpgradeException
074:             */
075:            public void testExecuteDesktopProfileUpdates631To71()
076:                    throws Exception, UpgradeException {
077:                //Print the Test Case name for diagonistic purposes.
078:                System.out
079:                        .println("Test case description : DP Updates for PS6.3.1-->PS7.1 upgrade");
080:
081:                //Create a Properties object we want to past to the executeDesktopProfileUpdates method.
082:                Properties props = new Properties();
083:
084:                //These are the directories to Scan for DPChanges.txt for PS6.3.1-->PS7.1 upgrade.
085:                String[] resDirs631 = { "meta/psupgrade/ps631",
086:                        "meta/psupgrade/ps70" };
087:
088:                //This is required. Otherwise an exception is thrown.
089:                //TODO: The Logger Actually should be PortalLogger with a well defined FileHandler.
090:                UpgradeUtils.setLogger(Logger
091:                        .getLogger("UpgradeUtilsTest.class"));
092:
093:                //Print the current directory for diagonistic purposes.
094:                System.out.println("Current Directory is : " + new File("."));
095:                //Print the Resource directories for diagonistic purposes.
096:                for (int i = 0; i < resDirs631.length; i++) {
097:                    File f = new File(resDirs631[i]);
098:                    if (f.exists()) {
099:                        System.out
100:                                .println("Upgrade resource directory complete path now is: "
101:                                        + f.getAbsolutePath());
102:                    } else {
103:                        fail("Upgrade resource directory "
104:                                + f.getAbsolutePath()
105:                                + " does not exist!"
106:                                + "Make sure the test infrastructure is Setup properly.");
107:                    }
108:                }
109:
110:                //Now test the case.
111:                try {
112:                    UpgradeUtils
113:                            .executeDesktopProfileUpdates(props, resDirs631);
114:                } catch (Exception e) {
115:                    fail("DP updates processing failed for PS6.3.1-->PS7.1 with Exception!\n"
116:                            + e);
117:                }
118:            }
119:
120:            /**
121:             * This Test case verifies that for a given upgrade scenario, whether AccessManager updates processing is Fine.
122:             * Example here is for  PS6.3.1-->PS7.1 upgrade
123:             *
124:             */
125:            public void testExecuteAccessManager631Updates() {
126:                //Create a Properties object we want to past to the executeAccessManagerUpdates method.
127:                Properties props = new Properties();
128:                props.setProperty("PORTAL_INSTALLED", "true");
129:                props.setProperty("ORG_DN", "dc=india,dc=sun,dc=com");
130:                props.setProperty("AM_BASEDIR", "/opt");
131:                props.setProperty("AM_PRODUCT_DIR", "SUNWam");
132:                props.setProperty("ADMIN_DN", "amadmin");
133:                props.setProperty("IDSAME_ADMIN_PASSWORD", "ampassword");
134:                props.setProperty("DS_HOST", "dagarwal.india.sun.com");
135:                props.setProperty("DS_PORT", "389");
136:                props.setProperty("DS_DIRMGR_DN", "cn=Directory Manager");
137:                props.setProperty("DS_DIRMGR_PASSWORD", "dmpassword");
138:
139:                String[] resDirs631 = { "meta/psupgrade/ps631",
140:                        "meta/psupgrade/ps70" };
141:                UpgradeUtils.setLogger(Logger
142:                        .getLogger("UpgradeUtilsTest.class"));
143:                UpgradeUtils.setExecUtil(new ExecuteUtil());
144:
145:                //Print the current directory for diagonistic purposes.
146:                System.out.println("Current Directory is : " + new File("."));
147:                //Print the Resource directories for diagonistic purposes.
148:                for (int i = 0; i < resDirs631.length; i++) {
149:                    File f = new File(resDirs631[i]);
150:                    if (f.exists()) {
151:                        System.out
152:                                .println("Upgrade resource directory complete path now is: "
153:                                        + f.getAbsolutePath());
154:                    } else {
155:                        fail("Upgrade resource directory "
156:                                + f.getAbsolutePath()
157:                                + " does not exist!"
158:                                + "Make sure the test infrastructure is Setup properly.");
159:                    }
160:                }
161:
162:                //Now test the case.
163:                try {
164:                    UpgradeUtils.executeAccessManagerUpdates(props, resDirs631);
165:                } catch (UpgradeException e) {
166:                    fail("AM updates failed for PS6.3.1-->PS7.1 with Exception!\n"
167:                            + e);
168:                }
169:            }
170:
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.