package com.perforce.cvs.integration; import static org.junit.Assert.fail; import java.io.File; import java.text.Normalizer.Form; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.perforce.config.CFG; import com.perforce.config.CaseSensitivity; import com.perforce.config.Config; import com.perforce.config.ScmType; import com.perforce.cvs.process.CvsProcessChange; import com.perforce.integration.SystemCaller; public class CvsIntegrationTests { private static Logger logger = LoggerFactory .getLogger(CvsIntegrationTests.class); // Set fixed paths private final static String basePath = "test/com/perforce/cvs/integration/integ/base/"; private final static String cvsRootPath = "/test/com/perforce/cvs/integration/dumps/"; private final String journalFile = "jnl.0"; private final static String depotName = "import"; // Globals private static String cwd; // Once at start of regression tests static { try { Config.setDefault(); cwd = System.getProperty("user.dir"); } catch (Exception e) { e.printStackTrace(); } } @Before public void before() { // Setup default test configuration try { Config.setDefault(); Config.set(CFG.TEST, true); Config.set(CFG.SCM_TYPE, ScmType.CVS); Config.set(CFG.P4_MODE, "CONVERT"); Config.set(CFG.P4_PORT, "localhost:4444"); Config.set(CFG.P4_ROOT, "./p4_root/"); Config.set(CFG.VERSION, "alpha/TestMode"); Config.set(CFG.P4_CLIENT_ROOT, "/ws"); } catch (Exception e) { e.printStackTrace(); } } @Test public void case001() throws Exception { Config.set(CFG.CVS_MODULE, "add-edit-del"); testCase("CVScluster01"); } @Test public void case002() throws Exception { Config.set(CFG.CVS_MODULE, "edit-textblock"); testCase("CVScluster01"); } @Test public void case003() throws Exception { Config.set(CFG.CVS_MODULE, "empty-full"); testCase("CVScluster01"); } @Test public void case004() throws Exception { Config.set(CFG.CVS_MODULE, "large-text"); // PROPRIAROTY DATA -- not released // testCase("CVScluster01"); } @Test public void case005() throws Exception { Config.set(CFG.CVS_MODULE, "rcs-deltas"); Config.set(CFG.CVS_LABELS, true); // PROPRIAROTY DATA -- not released // testCase("CVScluster01"); } @Test public void case006() throws Exception { // TEST Config.set(CFG.P4_C1_MODE, true); Config.set(CFG.CVS_MODULE, "reserved_chars"); testCase("CVScluster01"); } @Test public void case007() throws Exception { // TEST Config.set(CFG.P4_C1_MODE, true); Config.set(CFG.CVS_MODULE, "merge-rev"); testCase("CVScluster01"); } @Test public void case008() throws Exception { Config.set(CFG.P4_OFFSET, 100L); Config.set(CFG.CVS_MODULE, "add-edit-del-offset"); testCase("CVScluster01"); } @Test public void case009() throws Exception { Config.set(CFG.CVS_MODULE, "label-r1"); Config.set(CFG.CVS_LABELS, true); // PROPRIAROTY DATA -- not released // testCase("CVScluster01"); } @Test public void case010() throws Exception { Config.set(CFG.CVS_MODULE, "empty-rev"); testCase("CVScluster01"); } @Test public void case011() throws Exception { Config.set(CFG.CVS_MODULE, "empty-edit"); testCase("CVScluster01"); } /* * CVS doesn't support symbolic links * * @Test public void case012() throws Exception { Config.set(CFG.CVS_MODULE, * "symlink"); testCase("CVScluster01"); } * * @Test public void case013() throws Exception { Config.set(CFG.CVS_MODULE, * "symlink-target"); testCase("CVScluster01"); } */ @Test public void case014() throws Exception { Config.set(CFG.P4_UNICODE, false); Config.set(CFG.CVS_MODULE, "utf8-bom"); testCase("CVScluster01"); } @Test public void case015() throws Exception { Config.set(CFG.P4_UNICODE, false); Config.set(CFG.CVS_MODULE, "utf8-nobom"); testCase("CVScluster01"); } @Test public void case016() throws Exception { Form form = (Form) Config.get(CFG.P4_NORMALISATION); if (form.equals(Form.NFD)) Config.set(CFG.CVS_MODULE, "utf8_path_nfd"); else Config.set(CFG.CVS_MODULE, "utf8_path_nfc"); // TODO Config.set(CFG.CVS_MODULE, "utf8_path_nfc_win"); testCase("CVScluster01"); } @Test public void case019() throws Exception { Config.set(CFG.P4_UNICODE, false); Config.set(CFG.CVS_MODULE, "win1251"); testCase("CVScluster01"); } @Test public void case020() throws Exception { Config.set(CFG.CVS_MODULE, "win_line"); testCase("CVScluster01"); } @Test public void case021() throws Exception { Config.set(CFG.CVS_MODULE, "nix_line"); testCase("CVScluster01"); } @Test public void case022() throws Exception { Config.set(CFG.CVS_MODULE, "mac_line"); testCase("CVScluster01"); } @Test public void case023() throws Exception { Config.set(CFG.CVS_MODULE, "huge_file"); // PROPRIAROTY DATA -- not released // testCase("CVScluster01"); } @Test public void case024() throws Exception { Config.set(CFG.P4_UNICODE, false); Config.set(CFG.CVS_MODULE, "utf16_le"); testCase("CVScluster01"); } @Test public void case025() throws Exception { Config.set(CFG.P4_UNICODE, false); Config.set(CFG.CVS_MODULE, "utf16_le_bom"); testCase("CVScluster01"); } @Test public void case026() throws Exception { Config.set(CFG.P4_UNICODE, false); Config.set(CFG.CVS_MODULE, "utf16_be"); testCase("CVScluster01"); } @Test public void case027() throws Exception { Config.set(CFG.P4_UNICODE, false); Config.set(CFG.CVS_MODULE, "utf16_be_bom"); testCase("CVScluster01"); } /* * TODO merge operations * * @Test public void case028() throws Exception { Config.set(CFG.CVS_MODULE, * "merge-copy"); testCase("CVScluster01"); } * * @Test public void case029() throws Exception { Config.set(CFG.CVS_MODULE, * "merge-edit"); testCase("CVScluster01"); } */ @Test public void case030() throws Exception { Config.set(CFG.CVS_MODULE, "label_rev"); Config.set(CFG.CVS_LABELS, true); testCase("CVScluster01"); } @Test public void case031() throws Exception { Config.set(CFG.P4_UNICODE, false); Config.set(CFG.CVS_MODULE, "bad_encoding"); // PROPRIAROTY DATA -- not released // testCase("CVScluster01"); } @Test public void case032() throws Exception { Config.set(CFG.CVS_MODULE, "binary-file"); testCase("CVScluster01"); } @Test public void case033() throws Exception { Config.set(CFG.CVS_MODULE, "no-author"); testCase("CVScluster01"); } @Test public void case034() throws Exception { Config.set(CFG.CVS_MODULE, "revert"); testCase("CVScluster01"); } @Test public void case035() throws Exception { Config.set(CFG.P4_C1_MODE, true); Config.set(CFG.CVS_MODULE, "branch"); testCase("CVScluster01"); } @Test public void case036() throws Exception { Config.set(CFG.CVS_MODULE, "username_umlaut"); // PROPRIAROTY DATA -- not released // testCase("CVScluster01"); } @Test public void case037() throws Exception { Config.set(CFG.CVS_MODULE, "username_rev_chars"); testCase("CVScluster01"); } @Test public void case038() throws Exception { Config.set(CFG.CVS_MODULE, "username_comma"); testCase("CVScluster01"); } @Test public void case039() throws Exception { Config.set(CFG.CVS_MODULE, "revert-from-prev-version-and-modify"); testCase("CVScluster01"); } @Test public void case040() throws Exception { Config.set(CFG.CVS_MODULE, "exec-file"); testCase("CVScluster01"); } @Test public void case041() throws Exception { Config.set(CFG.P4_UNICODE, false); Config.set(CFG.CVS_MODULE, "win1252_non"); testCase("CVScluster01"); } @Test public void case042() throws Exception { Config.set(CFG.P4_UNICODE, true); Config.set(CFG.CVS_MODULE, "win1252"); testCase("CVScluster01"); } @Test public void case043() throws Exception { Config.set(CFG.CVS_MODULE, "null_path"); testCase("CVScluster01"); } @Test public void case044() throws Exception { Config.set(CFG.CVS_MODULE, "replace_dir_with_copy"); testCase("CVScluster01"); } @Test public void case045() throws Exception { CaseSensitivity mode = (CaseSensitivity) Config.get(CFG.P4_CASE); if (mode == CaseSensitivity.NONE) { Config.set(CFG.CVS_MODULE, "rename_case"); } else { Config.set(CFG.CVS_MODULE, "rename_none"); } testCase("CVScluster01"); } @Test public void case046() throws Exception { Config.set(CFG.CVS_MODULE, "replace_file"); testCase("CVScluster01"); } @Test public void case047() throws Exception { Config.set(CFG.CVS_MODULE, "dead-branch"); testCase("CVScluster01"); } @Test public void case048() throws Exception { Config.set(CFG.CVS_MODULE, "end-file"); testCase("CVScluster01"); } private void testCase(String cvsCluster) { try { String p4_root = (String) Config.get(CFG.P4_ROOT); // Select dump file for test case String testCase = (String) Config.get(CFG.CVS_MODULE); logger.info("testcase: " + testCase); String cvsRootTest = cwd + cvsRootPath + cvsCluster + "/"; Config.set(CFG.CVS_ROOT, cvsRootTest); // Paths and configurations String base = basePath + testCase + "/"; // Remove old server String rm = "rm" + " -rf " + p4_root; SystemCaller.exec(rm, true, false); // Remove temp dir String tmp = "rm" + " -rf tmp"; SystemCaller.exec(tmp, true, false); // Run test case CvsProcessChange process = new CvsProcessChange(); process.runSingle(); // Diff archive files String arcTest = p4_root + depotName; String arcBase = base + depotName; new File(arcTest).mkdir(); // some tests have no archive files new File(arcBase).mkdir(); String cmd = "diff -r " + arcTest + " " + arcBase; int arch = SystemCaller.exec(cmd, true, false); Assert.assertEquals("Archive:", 0, arch); // Diff metadata String jnlTest = "p4_root/" + journalFile; String jnlBase = base + journalFile; String sortTest = "<(sort " + jnlTest + ")"; String sortBase = "<(sort " + jnlBase + ")"; String p4m = "diff " + sortTest + " " + sortBase; int meta = SystemCaller.exec(p4m, true, false); Assert.assertEquals("Metadata:", 0, meta); } catch (Throwable e) { e.printStackTrace(); fail("Exception"); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 10825 | Paul Allen | Branching using paul_allen.p4convert | ||
//guest/perforce_software/p4convert/test/com/perforce/cvs/integration/CvsIntegrationTests.java | |||||
#29 | 10774 | Paul Allen |
CVS: Updated end of RCS content block detection. An @ character at the end of the line followed by a blank line could fool the converter into exiting the block early. Detection now uses original line with expanded @@ and counts odd/even. Added test case 048 |
||
#28 | 10730 | Paul Allen |
CVS: Fix for Labels in Import mode. Unable to label a revision in a pending change, so store all tag entries and add them to label after the change is submitted. Includes basic test case 030 |
||
#27 | 10705 | Paul Allen |
CVS: Added condition to support a 'dead' 1.1 revision. - CVS Test case 047 |
||
#26 | 10663 | Paul Allen | CVS TestCase: replace_file (Both) | ||
#25 | 10662 | Paul Allen |
CVS TestCase: rename_[case|none] Rename test case for case sensitive/insensitive platforms. |
||
#24 | 10661 | Paul Allen | CVS TestCase: replace_dir_with_copy (Both) | ||
#23 | 10660 | Paul Allen | CVS TestCase: null_path (Both) | ||
#22 | 10659 | Paul Allen |
CVS TestCase: win1252, win1252_non (Both) Non unicode test conditions translate as UTF8; ok for linux or moden windows, but may cause issues for Windows Command Prompt. ICU4J may get detected type wrong if file is very small, or not enough language context. |
||
#21 | 10656 | Paul Allen | CVS TestCase: exec-file (Both) | ||
#20 | 10637 | Paul Allen | CVS TestCase: revert-from-prev-version-and-modify (Both) | ||
#19 | 10636 | Paul Allen |
Added fix for CVS users with reserved chars in the name. CVS TestCase: username_comma, username_rev_chars |
||
#18 | 10635 | Paul Allen |
CVS TestCase: branch TODO: needs fixing |
||
#17 | 10633 | Paul Allen | CVS TestCase: revert (Both) | ||
#16 | 10631 | Paul Allen | CVS TestCase: no-author (Both) | ||
#15 | 10621 | Paul Allen |
CVS TestCase: merge-copy and merge-edit. TODO: not active (strange results) |
||
#14 | 10620 | Paul Allen |
CVS TestCase: utf16_[le|be]_[<nobom>|bom] Tests fail with BOM option. |
||
#12 | 10618 | Paul Allen | CVS TestCase: [mac|win|nix]_line (Both) | ||
#11 | 10617 | Paul Allen | CVS TestCase: win1251 (non UNICODE) | ||
#10 | 10615 | Paul Allen |
CVS TestCase: nfc/nfd paths. Broken: nfc - will need some work and processing on a Linux box. |
||
#9 | 10613 | Paul Allen | CVS TestCase: utf8-bom, utf8-nobom | ||
#8 | 10612 | Paul Allen | CVS TestCase: empty-edit (Both) | ||
#7 | 10610 | Paul Allen | Removed offset from testcase 010. | ||
#6 | 10609 | Paul Allen | CVS TestCase: empty-rev (Both) | ||
#5 | 10607 | Paul Allen | CVS TestCase: binary-file (Convert) | ||
#4 | 10606 | Paul Allen | CVS TestCase: empty-full (Both) | ||
#3 | 10605 | Paul Allen | CVS TestCase: edit-textblock (Import) | ||
#2 | 10603 | Paul Allen | CVS TestCase: edit-textblock (Convert) | ||
#1 | 9807 | Paul Allen | Initial import of p4-convert (from change 894340) |