Source Code Cross Referenced for RpConvertTest.java in  » Content-Management-System » openedit » com » openedit » store » retailproconvert » 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 » Content Management System » openedit » com.openedit.store.retailproconvert 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Sep 15, 2004
003:         */
004:        package com.openedit.store.retailproconvert;
005:
006:        import java.io.File;
007:        import java.io.FilenameFilter;
008:        import java.util.Iterator;
009:        import java.util.List;
010:
011:        import org.openedit.money.Money;
012:        import org.openedit.store.Category;
013:        import org.openedit.store.InventoryItem;
014:        import org.openedit.store.Option;
015:        import org.openedit.store.Product;
016:        import org.openedit.store.StoreTestCase;
017:        import org.openedit.store.convert.ConvertStatus;
018:        import org.openedit.store.customer.Customer;
019:        import org.openedit.store.retailproconvert.RetailProCatalogConverter;
020:
021:        import com.openedit.util.OutputFiller;
022:
023:        /**
024:         * @author cburkey
025:         *
026:         */
027:        public class RpConvertTest extends StoreTestCase {
028:
029:            /**
030:             * @param inArg0
031:             */
032:            public RpConvertTest(String inArg0) {
033:                super (inArg0);
034:
035:            }
036:
037:            public static void main(String[] args) throws Exception {
038:                //		 runner = new TestRunner();
039:                //TestRunner.run(ProductEditTest.class);
040:                RpConvertTest test = new RpConvertTest("dffd");
041:                test.setUp();
042:                test.testCatalogConvert();
043:            }
044:
045:            public void testFind() throws Exception {
046:                String f = "R:/Web Pics/Some Path.jpg";
047:                String r = f.replaceAll("R:/Web Pics/",
048:                        "/store/products/images/extras/");
049:                assertEquals(r, "/store/products/images/extras/Some Path.jpg");
050:            }
051:
052:            public void testCatalogConvert() throws Exception {
053:
054:                RetailProCatalogConverter convert = new RetailProCatalogConverter();
055:                ConvertStatus errors = new ConvertStatus();
056:                convert.convert(getStore(), errors);
057:
058:                for (Iterator iter = errors.getLog().iterator(); iter.hasNext();) {
059:                    String element = (String) iter.next();
060:                    System.out.println(element);
061:
062:                }
063:                File productsDir = new File(getStore().getStoreDirectory(),
064:                        "products");
065:
066:                File[] listxconfs = productsDir.listFiles(new FilenameFilter() {
067:                    public boolean accept(File inDir, String inName) {
068:                        if (inName.startsWith("PAA")
069:                                && inName.endsWith(".xconf")) {
070:                            return true;
071:                        }
072:                        return false;
073:                    }
074:                });
075:
076:                assertTrue(listxconfs.length > 50);
077:                File[] listhtml = productsDir.listFiles(new FilenameFilter() {
078:                    public boolean accept(File inDir, String inName) {
079:                        if (inName.startsWith("PAA")
080:                                && inName.endsWith(".html")) {
081:                            return true;
082:                        }
083:                        return false;
084:                    }
085:                });
086:                assertTrue(listhtml.length > 50);
087:                File thumbnailsDir = new File(getStore().getStoreDirectory(),
088:                        "/products/images/thumb");
089:                File[] thumbnailList = thumbnailsDir
090:                        .listFiles(new FilenameFilter() {
091:                            public boolean accept(File dir, String name) {
092:                                if (name.startsWith("PAA")
093:                                        && name.endsWith(".jpg")) {
094:                                    return true;
095:                                }
096:                                return false;
097:                            }
098:                        });
099:                assertTrue(thumbnailList.length > 20);
100:            }
101:
102:            public void testCatalog() throws Exception {
103:
104:                List catalogs = getStore().getCatalogArchive()
105:                        .listAllCatalogs();
106:                assertTrue(catalogs.size() > 2);
107:
108:                Product product = getStore().getProduct("PAAAAAPCJLCAEGAI");
109:
110:                // there are 6 items, and all 6 should be imported even though one is out of stock
111:                assertEquals(6, product.getInventoryItemCount());
112:
113:                assertTrue(product.isAvailable());
114:                assertTrue(product.isInStock());
115:                //assertTrue(product.isOnSale()); //New Retail pro data has sale in new field
116:                Money price = product.getYourPrice();
117:                assertNotNull(price);
118:                //this depend on what is in stock
119:                //assertEquals(545D,price.doubleValue(),0.001);
120:
121:                InventoryItem item = product.getInventoryItemBySku("4163");
122:                assertEquals(0, item.getQuantityInStock());
123:
124:                Category catalog = getStore().getCatalog("LMABAAAAGHOLGIBC");
125:                assertNotNull(catalog);
126:                assertTrue(product.isInCatalog(catalog));
127:
128:                product = getStore().getProduct("PAAAIAJDBDFHAEBN");
129:                item = product.getInventoryItem(3);
130:                Option option = item.getOption("handling");
131:                assertNotNull("Should have handling option", option);
132:                assertEquals("Handling amount", 1.00, option.getPriceSupport()
133:                        .getYourPriceByQuantity(1).doubleValue(), 0.001);
134:
135:                //fldProdAvail="Sell Always"  fldOutStockMsg_i="3" fldOutStockMsg="Please Allow 6-8 Weeks for Delivery" 
136:                product = getStore().getProduct("PAAAIACGONDPBBAI");
137:                assertTrue(product.isAvailable());
138:                assertTrue(product.isInStock());
139:                assertEquals("Please Allow 6-8 Weeks for Delivery", product
140:                        .getProperty("outOfStockMsg"));
141:            }
142:
143:            public void XXXtestCustomerData() throws Exception {
144:                Customer user = getStore().getCustomerArchive().getCustomer(
145:                        "3452");
146:                assertNotNull(user);
147:            }
148:
149:            public void testParseDescription_Keywords() throws Exception {
150:                RetailProCatalogConverter convert = new RetailProCatalogConverter();
151:                String input = "Test keywords.";
152:                String desc = convert.parseDescription(input);
153:                String kwds = convert.parseKeywords(input);
154:                assertEquals(input, desc);
155:                assertNull(kwds);
156:                input = "[[keyword1, keyword2 ]]  Test keywords.";
157:                desc = convert.parseDescription(input);
158:                kwds = convert.parseKeywords(input);
159:                assertEquals("Test keywords.", desc);
160:                assertEquals("keyword1, keyword2", kwds);
161:
162:            }
163:
164:            public void setUp() throws Exception {
165:                File uploadDir = new File(getStore().getStoreDirectory(),
166:                        "/upload");
167:                uploadDir.mkdir();
168:                File testDir = new File(uploadDir.getParentFile()
169:                        .getParentFile().getParentFile(), "etc/testupload");
170:                File[] zipfiles = testDir.listFiles(new FilenameFilter() {
171:
172:                    public boolean accept(File inDir, String inName) {
173:                        return inName.endsWith(".zip");
174:                    }
175:                });
176:                OutputFiller filler = new OutputFiller();
177:                for (int i = 0; i < zipfiles.length; i++) {
178:                    String name = zipfiles[i].getName();
179:                    File newFile = new File(uploadDir, name);
180:                    if (!newFile.exists()) {
181:                        filler.fill(zipfiles[i], newFile);
182:                    }
183:                }
184:            }
185:
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.