1 31 32 package org.opencms.importexport; 33 34 import junit.framework.TestCase; 35 36 46 public class TestCmsImport extends TestCase { 47 48 53 public TestCmsImport(String arg0) { 54 55 super(arg0); 56 } 57 58 63 public void testConvertDigestEncoding() throws Throwable { 64 65 A_CmsImport imp = new CmsImportVersion4(); 66 String result; 67 68 result = imp.convertDigestEncoding("dfcd4cbbda27e5569d03a75e38024f19"); 70 assertEquals(result, "X03MO1qnZdYdgyfeuILPmQ=="); 71 72 result = imp.convertDigestEncoding("a1a3afa9fad72527c309ca8eca009f43"); 74 assertEquals(result, "ISMvKXpXpadDiUoOSoAfww=="); 75 76 result = imp.convertDigestEncoding("890feb4dc6a153f34a5ece03a6a73476"); 78 assertEquals(result, "CY9rzUYh03PK3k6DJie09g=="); 79 80 result = imp.convertDigestEncoding("7d0566ad1b6bc5c207f16ce8049832f1"); 82 assertEquals(result, "/YXmLZvrRUKHcexohBiycQ=="); 83 84 result = imp.convertDigestEncoding("7fd2de3ccff5567c2fc64fe744283452"); 86 assertEquals(result, "/1JevE911vyvRs9nxKi00g=="); 87 } 88 89 92 public void testSetDirectories() { 93 94 String [] rules = { 95 "s#/default/vfs/content/bodys/(.*)#/default/vfs/system/bodies/$1#", 96 "s#/default/vfs/pics/system/(.*)#/default/vfs/system/workplace/resources/$1#", 97 "s#/default/vfs/pics/(.*)#/default/vfs/system/galleries/pics/$1#", 98 "s#/default/vfs/download/(.*)#/default/vfs/system/galleries/download/$1#", 99 "s#/default/vfs/externallinks/(.*)#/default/vfs/system/galleries/externallinks/$1#", 100 "s#/default/vfs/htmlgalleries/(.*)#/default/vfs/system/galleries/htmlgalleries/$1#", 101 "s#/default/vfs/content/(.*)#/default/vfs/system/modules/org.opencms.default/$1#", 102 "s#/default/vfs/moduledemos/(.*)#/default/vfs/system/moduledemos/$1#", 103 "s#/default/vfs/system/workplace/config/language/(.*)#/default/vfs/system/workplace/locales/$1#", 104 "s#/default/vfs/system/workplace/css/(.*)#/default/vfs/system/workplace/resources/$1#", 105 "s#/default/vfs/system/workplace/templates/js/(.*)#/default/vfs/system/workplace/scripts/$1#"}; 106 107 String content, result; 108 109 content = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" 110 + "<PAGE>\n" 111 + " <class>com.opencms.template.CmsXmlTemplate</class>\n" 112 + " <masterTemplate>/system/modules/org.opencms.frontend/templates/group_main</masterTemplate>\n" 113 + " <ELEMENTDEF name=\"body\">\n" 114 + " <CLASS>com.opencms.template.CmsXmlTemplate</CLASS>\n" 115 + " <TEMPLATE>/content/bodys/group/de/index.html</TEMPLATE>\n" 116 + " </ELEMENTDEF>\n" 117 + "</PAGE>"; 118 119 result = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" 120 + "<PAGE>\n" 121 + " <class>com.opencms.template.CmsXmlTemplate</class>\n" 122 + " <masterTemplate>/system/modules/org.opencms.frontend/templates/group_main</masterTemplate>\n" 123 + " <ELEMENTDEF name=\"body\">\n" 124 + " <CLASS>com.opencms.template.CmsXmlTemplate</CLASS>\n" 125 + " <TEMPLATE>/system/bodies/group/de/index.html</TEMPLATE>\n" 126 + " </ELEMENTDEF>\n" 127 + "</PAGE>"; 128 129 content = CmsImportVersion2.setDirectories(content, rules); 130 assertEquals(content, result); 131 132 content = ".hbackground {background:url(/open/cms/system/modules/li.castle.frontend/pics/bg_1.gif) no-repeat; background-color:#FFFFFF; }\n" 133 + ".hibackground {background:url(/open/cms/system/modules/li.castle.frontend/pics/bg_1_cai_cpe.gif); no-repeat; background-color:#FFFFFF; }" 134 + "<img SRC=\"{OpenCmsContext}/pics/test/\">\n" 135 + "picDir=/system/modules/li.castle.frontend/pics/\n" 136 + "<img alt=\"Slogan CPE\" SRC=\"]]><LINK><![CDATA[/pics/castle/slogan_cpe_de.gif]]></LINK><![CDATA[\">"; 137 138 result = ".hbackground {background:url(/open/cms/system/modules/li.castle.frontend/pics/bg_1.gif) no-repeat; background-color:#FFFFFF; }\n" 139 + ".hibackground {background:url(/open/cms/system/modules/li.castle.frontend/pics/bg_1_cai_cpe.gif); no-repeat; background-color:#FFFFFF; }" 140 + "<img SRC=\"{OpenCmsContext}/system/galleries/pics/test/\">\n" 141 + "picDir=/system/modules/li.castle.frontend/pics/\n" 142 + "<img alt=\"Slogan CPE\" SRC=\"]]><LINK><![CDATA[/system/galleries/pics/castle/slogan_cpe_de.gif]]></LINK><![CDATA[\">"; 143 144 content = CmsImportVersion2.setDirectories(content, rules); 145 146 System.out.println(content); 147 assertEquals(content, result); 148 } 149 } 150 | Popular Tags |