|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package complete.pvcs_profile; import complete.GenericStub.GenericNode; import java.io.File; import java.util.Date; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.netbeans.jellytools.EditorOperator; import org.netbeans.jellytools.EditorWindowOperator; import org.netbeans.jellytools.TopComponentOperator; import org.netbeans.jellytools.actions.Action; import org.netbeans.jellytools.actions.DeleteAction; import org.netbeans.jellytools.actions.OpenAction; import org.netbeans.jellytools.modules.vcscore.GroupVerificationOperator; import org.netbeans.jellytools.modules.vcscore.VCSCommandsOutputOperator; import org.netbeans.jellytools.modules.vcsgeneric.actions.PVCSAddAction; import org.netbeans.jellytools.modules.vcsgeneric.actions.PVCSGetAction; import org.netbeans.jellytools.modules.vcsgeneric.actions.RefreshRevisionsAction; import org.netbeans.jellytools.modules.vcsgeneric.nodes.PVCSFileNode; import org.netbeans.jellytools.modules.vcsgeneric.pvcs.*; import org.netbeans.jellytools.nodes.FilesystemNode; import org.netbeans.jellytools.nodes.Node; import org.netbeans.jellytools.properties.PropertySheetOperator; import org.netbeans.jellytools.properties.PropertySheetTabOperator; import org.netbeans.jellytools.properties.StringProperty; import org.netbeans.jellytools.util.StringFilter; import org.netbeans.junit.NbTestSuite; import org.netbeans.modules.vcscore.runtime.RuntimeCommand; import org.openide.util.Utilities; public class StubAllTogether extends PVCSStub { public StubAllTogether(String testName) { super(testName); } public static Test suite() { // complete.GenericStub.DEBUG = true; TestSuite suite = new NbTestSuite(); try { System.out.println ("vlog return code: " + Runtime.getRuntime().exec("vlog").waitFor()); } catch (Exception e) { e.printStackTrace (); return suite; } suite.addTest(new StubAllTogether("configure")); suite.addTest(new StubAllTogether("testCreateProject")); suite.addTest(new StubAllTogether("testAddSingleFile")); suite.addTest(new StubAllTogether("testAddMultipleFiles")); suite.addTest(new StubAllTogether("testAddFileWithLock")); suite.addTest(new StubAllTogether("testCheckoutFile")); suite.addTest(new StubAllTogether("testModifyFile")); suite.addTest(new StubAllTogether("testViewDifferences")); suite.addTest(new StubAllTogether("testCheckinFile")); suite.addTest(new StubAllTogether("testViewHistory")); suite.addTest(new StubAllTogether("testUnlockFile")); suite.addTest(new StubAllTogether("testGetMissingFile")); suite.addTest(new StubAllTogether("testRemoveRevision")); suite.addTest(new StubAllTogether("testCreateOwnRevision")); suite.addTest(new StubAllTogether("testCheckoutRevision")); suite.addTest(new StubAllTogether("testLockFile")); suite.addTest(new StubAllTogether("testCreateBranch")); suite.addTest(new StubAllTogether("testVersioningExplorer")); suite.addTest(new StubAllTogether("testViewOldRevision")); suite.addTest(new StubAllTogether("testCompareRevisions")); suite.addTest(new StubAllTogether("testAddToGroup")); suite.addTest(new StubAllTogether("testCheckinGroup")); suite.addTest(new StubAllTogether("testVerifyGroup")); suite.addTest(new StubAllTogether("testUnmount")); return suite; } public static void main(java.lang.String[] args) { TestRunner.run(suite()); } GenericNode test, another, A_File, B_File, D_File, C_File; static String username = null; public void createStructure () { test = new GenericNode (root, "test"); another = new GenericNode (test, "another"); A_File = new GenericNode (root, "A_File", ".java"); B_File = new GenericNode (test, "B_File", ".java"); D_File = new GenericNode (another, "D_File", ".java"); // C_File = new GenericNode (test, "C_File", new String[] { ".java", ".form" }); // bug in add command - serial execution needed C_File = new GenericNode (test, "C_File", ".java"); // workaround } public void configure () { new File (getWorkDirPath() + File.separator + "client" + File.separator + "test").mkdirs (); // workaround for unreported problem in prepareClient method super.configure (); } public void testUnmount() { new FilesystemNode(repository.tree(), root.node ()).unmount(); new Node (repository.tree (), "").waitChildNotPresent(root.node ()); } public void testCreateProject () { another.mkdirs (); // root.pvcsNode ().pVCSRefresh (); // unreported problem - sometimes does not work - workaround in configure test case // history.waitCommand ("Refresh", root.history ()); test.waitStatus ("Local"); createProject (test); another.waitStatus ("Local"); createProject (another); } public void testAddSingleFile () { // NewWizardOperator.create("Java Classes|Main", A_File.parent ().node (), A_File.name ()); A_File.save ("/** This is testing file.\n */\n\n public class Testing_File {\n }\n"); refresh (A_File.parent ()); A_File.waitStatus ("Local"); A_File.pvcsNode ().pVCSAdd (); AddCommandOperator addCommand = new AddCommandOperator(A_File.filename (0)); addCommand.setWorkfileDescription("Auto-generated class file."); addCommand.setChangeDescription("Initial revision."); addCommand.ok(); addCommand.waitClosed (); A_File.waitHistory ("Add"); A_File.waitStatus ("Current"); } public void testAddMultipleFiles () { B_File.save ("B_File - Initial content"); refresh (B_File.parent ()); B_File.waitStatus ("Local"); D_File.save ("B_File - Initial content"); D_File.parent ().pvcsNode ().pVCSRefresh(); history.waitCommand("Refresh", D_File.parent ().history ()); D_File.waitStatus ("Local"); new PVCSAddAction ().perform (new Node [] { B_File.pvcsNode (), D_File.pvcsNode (), }); AddCommandOperator addCommand = new AddCommandOperator(B_File.filename(0) + " ..."); addCommand.setWorkfileDescription("Auto-generated class file."); addCommand.setChangeDescription("Initial revision."); addCommand.ok(); addCommand.waitClosed (); RuntimeCommand breakpoint = history.getBreakpoint(); B_File.waitHistory ("Add"); history.setBreakpoint (breakpoint); D_File.waitHistory ("Add"); history.breakpoint(); B_File.waitStatus ("Current"); D_File.waitStatus ("Current"); } public void testAddFileWithLock() { C_File.save ("Initial save"); // C_File.save (1, ""); // bug in add command - serial execution needed refresh (C_File.parent ()); C_File.waitStatus ("Local"); C_File.pvcsNode ().pVCSAdd (); AddCommandOperator addCommand = new AddCommandOperator(C_File.filename(0)); addCommand.setWorkfileDescription("Auto-generated form file."); addCommand.setChangeDescription("Initial revision."); addCommand.setAssignAVersionLabel("My_Version"); addCommand.checkKeepTheRevisionLocked(true); addCommand.checkFloatLabelWithTheTipRevision(true); addCommand.ok(); addCommand.waitClosed (); C_File.waitHistory ("Add"); C_File.waitStatus ("Current; 1.1"); C_File.waitLock (true); } public void testCheckoutFile () { A_File.waitStatus ("Current"); A_File.pvcsNode ().pVCSGet (); GetCommandOperator getCommand = new GetCommandOperator(A_File.filename (0)); getCommand.checkLockForTheCurrentUser(true); getCommand.checkCheckOutWritableWorkfile(true); getCommand.ok(); getCommand.waitClosed (); A_File.waitHistory ("Get"); A_File.waitStatus ("Current; 1.1"); username = getLockText(A_File.pvcsNode ().getText()); A_File.waitLock (true); new DeleteAction().perform(A_File.pvcsNode ()); assertConfirmObjectDeletionNo (null); refresh (A_File.parent ()); A_File.waitStatus ("Current; 1.1"); } public void testModifyFile() { A_File.waitStatus ("Current; 1.1"); A_File.save ("/** This is testing A_File.java file.\n */\n public class Testing_File {\n int i;\n }\n"); // new OpenAction().perform(A_File.pvcsNode ()); refreshFile(A_File); A_File.waitStatus ("Locally Modified; 1.1"); } public void testViewDifferences() { A_File.waitStatus ("Locally Modified; 1.1"); A_File.pvcsNode ().pVCSDiff (); DiffCommandOperator diff = new DiffCommandOperator (A_File.filename (0)); diff.ok (); diff.waitClosed (); EditorWindowOperator ewo = new EditorWindowOperator (); TopComponentOperator tco = new TopComponentOperator (ewo, "Diff: " + A_File.filename (0)); try { out.println ("!!!! ==== Comparing revisions: HEAD and Local ==== !!!!"); dumpDiffGraphicalGraphical (tco); compareReferenceFiles(); } finally { tco.close(); waitIsShowing(tco.getSource()); } } public void testCheckinFile() { A_File.waitStatus ("Locally Modified; 1.1"); A_File.pvcsNode ().pVCSPut (); PutCommandOperator putCommand = new PutCommandOperator(A_File.filename (0)); putCommand.setChangeDescription("Three lines have changed."); putCommand.ok(); putCommand.waitClosed (); A_File.waitHistory ("Put"); A_File.waitStatus ("Current"); A_File.waitLock (false); assertTrue ("A_File remained read-write after check in", A_File.isNotWriteable()); } public void testViewHistory() { assertNotNull ("UserName field is null", username); StringFilter sf = new StringFilter (); sf.addReplaceAllFilter(username, " |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.