@Test public void advancedGet() throws IOException, ClearCaseException { File path = createTempPath(); String viewTag = ccenv.getUniqueName() + "_TAG2b"; Stream oneInt = ccenv.context.streams.get("one_int"); Baseline model1 = ccenv.context.baselines.get("model-1"); Baseline model2 = ccenv.context.baselines.get("model-2"); Stream container = Stream.create(oneInt, "container2b", true, model1); GetView gv = new GetView(path, viewTag).createIfAbsent().setStream(container); SnapshotView view = gv.get(); SnapshotView.LoadRules lr = new SnapshotView.LoadRules(view, SnapshotView.Components.ALL); new UpdateView(view).setLoadRules(lr).update(); /* Verify first */ listFiles(view.getViewRoot()); verifyView(gv, ccenv.getUniqueName() + "/Model/model.h", "#1"); new Rebase(container).addBaseline(model2).rebase(true); /* Verify second */ GetView gv2 = new GetView(path, viewTag); verifyView(gv2, ccenv.getUniqueName() + "/Model/model.h", "#1#2"); }
@Test(expected = ViewException.class) public void testNonExistent() throws IOException, ClearCaseException { File path = createTempPath(); String viewTag = ccenv.getUniqueName() + "_TAG3"; Stream oneInt = ccenv.context.streams.get("one_int"); Baseline model1 = ccenv.context.baselines.get("model-1"); Stream container = Stream.create(oneInt, "container3", true, model1); GetView gv = new GetView(path, viewTag).createIfAbsent().setStream(container); SnapshotView view = gv.get(); SnapshotView.LoadRules lr = new SnapshotView.LoadRules(view, SnapshotView.Components.ALL); new UpdateView(view).setLoadRules(lr).update(); /* Verify first */ listFiles(view.getViewRoot()); verifyView(gv, ccenv.getUniqueName() + "/Model/model.h", "#1"); /* Verify second */ GetView gv2 = new GetView( new File(path.getParent(), "98u2n918u2n9831u2n3981nu23981u2398/hahahaha"), viewTag); gv2.get(); }
@Test public void basicCreate() throws IOException, ClearCaseException { File path = createTempPath(); String viewTag = ccenv.getUniqueName() + "_TAG1"; Stream oneInt = ccenv.context.streams.get("one_int"); Baseline model1 = ccenv.context.baselines.get("model-1"); Stream container = Stream.create(oneInt, "container1", true, model1); GetView gv = new GetView(path, viewTag).createIfAbsent().setStream(container); SnapshotView view = gv.get(); SnapshotView.LoadRules lr = new SnapshotView.LoadRules(view, SnapshotView.Components.ALL); new UpdateView(view).setLoadRules(lr).update(); listFiles(view.getViewRoot()); verifyView(gv, ccenv.getUniqueName() + "/Model/model.h", "#1"); }