public void FindAllSymbolicLinksTest() { string expected = CC_SYMBOLIC_LINK_PATH; string actual = new ClearCase(BranchCCInfo).FindAllSymbolicLinks()[0].SymbolicLink; Assert.AreEqual(expected, actual); }
public void CheckAnyFileIsNotCheckedOutTest() { string checkoutFile = "main.txt"; ClearCase cc = new ClearCase(BranchCCInfo); cc.CheckCheckedoutFileNotExistsInCurrentView(); cc.Checkout(checkoutFile); try { cc.CheckCheckedoutFileNotExistsInCurrentView(); } catch (GiccException ex) { Console.WriteLine("success : caught checkedout file"); Console.WriteLine(ex.Message); return; } finally { cc.Uncheckout(checkoutFile); } Assert.Fail("could not catch checkout file : " + checkoutFile); }
private static void Label(string[] args) { if (args.Length < 4) { WriteLine(Resource.USAGE_LABEL); return; } string labeledBranch; switch (args[1].ToLower()) { case "-main": case "-m": labeledBranch = "main"; break; case "-branch": case "-b": labeledBranch = "main\\" + args[2]; break; default: WriteLine(Resource.USAGE_LABEL); return; } ClearCase cc = new ClearCase(CreateCCInfo(labeledBranch, Environment.CurrentDirectory)); cc.LabelLastElements(labeledBranch, args[3]); }
public void CanCatchInvalidLabelConfiguration() { ClearCase clearCase = new ClearCase(); const string invalidXml = "<sourcecontrol type=\"ClearCase\"><useLabel>NOT_A_BOOLEAN</useLabel></sourcecontrol>"; Assert.That(delegate { NetReflector.Read(invalidXml, clearCase); }, Throws.TypeOf <NetReflectorConverterException>()); }
// CastCS() is tested as well. public void SetDefaultCSTest() { new ClearCase(BranchCCInfo).SetDefaultCS(); List <string> expected = new List <string>( new string[] { "element * CHECKEDOUT", "element * /main/LATEST" } ); List <string> actual = new ClearCase(MainCCInfo).CatCS(); Assert.That(actual, Is.EquivalentTo(expected)); }
public void ShouldNotGetSourceIfAutoGetSourceFalse() { DynamicMock executor = new DynamicMock(typeof(ProcessExecutor)); ClearCase clearCase = new ClearCase((ProcessExecutor)executor.MockInstance); clearCase.Executable = EXECUTABLE; clearCase.ViewPath = VIEWPATH; clearCase.AutoGetSource = false; executor.ExpectNoCall("Execute", typeof(ProcessInfo)); clearCase.GetSource(new IntegrationResult()); executor.Verify(); }
public void ShouldNotGetSourceIfAutoGetSourceFalse() { var executor = new Mock <ProcessExecutor>(); ClearCase clearCase = new ClearCase((ProcessExecutor)executor.Object); clearCase.Executable = EXECUTABLE; clearCase.ViewPath = VIEWPATH; clearCase.AutoGetSource = false; clearCase.GetSource(new IntegrationResult()); executor.Verify(); executor.VerifyNoOtherCalls(); }
public void ShouldGetSourceIfAutoGetSourceTrue() { DynamicMock executor = new DynamicMock(typeof(ProcessExecutor)); ClearCase clearCase = new ClearCase((ProcessExecutor)executor.MockInstance); clearCase.Executable = EXECUTABLE; clearCase.ViewPath = VIEWPATH; clearCase.AutoGetSource = true; ProcessInfo expectedProcessRequest = new ProcessInfo(EXECUTABLE, @"update -force -overwrite """ + VIEWPATH + @""""); expectedProcessRequest.TimeOut = Timeout.DefaultTimeout.Millis; executor.ExpectAndReturn("Execute", new ProcessResult("foo", null, 0, false), expectedProcessRequest); clearCase.GetSource(new IntegrationResult()); executor.Verify(); }
public void ShouldGetSourceIfAutoGetSourceTrue() { var executor = new Mock <ProcessExecutor>(); ClearCase clearCase = new ClearCase((ProcessExecutor)executor.Object); clearCase.Executable = EXECUTABLE; clearCase.ViewPath = VIEWPATH; clearCase.AutoGetSource = true; ProcessInfo expectedProcessRequest = new ProcessInfo(EXECUTABLE, @"update -force -overwrite """ + VIEWPATH + @""""); expectedProcessRequest.TimeOut = Timeout.DefaultTimeout.Millis; executor.Setup(e => e.Execute(expectedProcessRequest)).Returns(new ProcessResult("foo", null, 0, false)).Verifiable(); clearCase.GetSource(new IntegrationResult()); executor.Verify(); }
public void CheckoutTest() { ClearCase cc = new ClearCase(BranchCCInfo); cc.SetBranchCS(); List <string> targetFiles = new List <string>(new string[] { "main.txt", @".\sub\main.txt" }); List <string> actual; cc.Checkout(targetFiles[0]); cc.Checkout(targetFiles[1]); actual = cc.LscheckoutInCurrentViewByLoginUser(); Assert.That(actual, Is.EquivalentTo(targetFiles)); cc.Uncheckout(targetFiles[0]); cc.Uncheckout(targetFiles[1]); actual = cc.LscheckoutInCurrentViewByLoginUser(); Assert.IsTrue(actual.Count == 0); }
protected void Setup() { clearCase = new ClearCase(); NetReflector.Read(CLEARCASE_XML, clearCase); }
public void IsTargetExtensionTest(string path, bool result) { ClearCase cc = new ClearCase(BranchCCInfo); Assert.AreEqual(result, cc.IsLabelingTargetExtension(path)); }
private static void Main(string[] args) { if (args.Length == 0) { WriteLine(Resource.USAGE_MAIN); return; } ClearCase cc; switch (args[0].ToLower()) { case "clone": Clone(args); WriteLine("Clone success!"); break; case "pull": if (args.Length == 2) { new GiccCore(Environment.CurrentDirectory).Pull(); } else { WriteLine(Resource.USAGE_PULL); } WriteLine("Pull success!"); break; case "push": if (args.Length == 2) { new GiccCore(Environment.CurrentDirectory).PushWorkingBranch(); } else { WriteLine(Resource.USAGE_PUSH); } WriteLine("Push success!"); break; case "merge": if (args.Length == 2) { new GiccCore(Environment.CurrentDirectory).MergeWorkingBranchIntoMaster(); } else { //WriteLine(Resource.USAGE_MERGE); } WriteLine("Merge success!"); break; case "list": if (args.Length < 2) { WriteLine(Resource.USAGE_LIST); return; } cc = new ClearCase(CreateCCInfo(args[1], Environment.CurrentDirectory)); cc.FindAllFilesInBranch().ForEach(file => WriteLine(file)); break; case "tree": if (args.Length < 2) { WriteLine(Resource.USAGE_TREE); return; } cc = new ClearCase(CreateCCInfo(args[1], Environment.CurrentDirectory)); cc.FindAllFilesInBranch().ForEach(filePath => cc.ViewVersionTree(filePath)); break; case "label": Label(args); break; case "cs": ConfigSpec(args); break; default: WriteLine(Resource.USAGE_MAIN); return; } }