/** * Shortcut for {@link Context#workingTree()} */ protected WorkingTree workingTree() { return context.workingTree(); }
/** * Shortcut for {@link Context#workingTree()} */ protected WorkingTree workingTree() { return context.workingTree(); }
@Override public WorkingTree workingTree() { return context.workingTree(); }
@Override public WorkingTree workingTree() { return context.workingTree(); }
/** * @return */ WorkingTree getWorkingTree() { Context commandLocator = getCommandLocator(); WorkingTree workingTree = commandLocator.workingTree(); return workingTree; }
/** * @return */ WorkingTree getWorkingTree() { Context commandLocator = getCommandLocator(); WorkingTree workingTree = commandLocator.workingTree(); return workingTree; }
public MergeStatusBuilder(Context context, boolean ours, List<ObjectId> commits, ProgressListener progress) { this.context = context; this.index = context.stagingArea(); this.workingTree = context.workingTree(); this.ours = ours; this.progress = progress; progress.setMaxProgress(0); ObjectId commitId = commits.get(0); Optional<Ref> ref = context.command(ResolveBranchId.class).setObjectId(commitId).call(); if (ref.isPresent()) { mergeMsg.append("Merge branch " + ref.get().getName()); } else { mergeMsg.append("Merge commit '" + commitId.toString() + "'. "); } mergeMsg.append("\n\nConflicts:\n"); }
public MergeStatusBuilder(Context context, boolean ours, List<ObjectId> commits, ProgressListener progress) { this.context = context; this.index = context.stagingArea(); this.workingTree = context.workingTree(); this.ours = ours; this.progress = progress; progress.setMaxProgress(0); ObjectId commitId = commits.get(0); Optional<Ref> ref = context.command(ResolveBranchId.class).setObjectId(commitId).call(); if (ref.isPresent()) { mergeMsg.append("Merge branch " + ref.get().getName()); } else { mergeMsg.append("Merge commit '" + commitId.toString() + "'. "); } mergeMsg.append("\n\nConflicts:\n"); }
public TestData remove(String... featureIds) { WorkingTree workingTree = getContext().workingTree(); workingTree.delete(Arrays.asList(featureIds).iterator(), new DefaultProgressListener()); return this; }
@Test public void testDeleteException() throws Exception { WorkingTree workTree = mock(WorkingTree.class); Context cmdl = mock(Context.class); when(cmdl.workingTree()).thenReturn(workTree); doThrow(new RuntimeException("Exception")).when(workTree).delete(any(String.class)); ImportOp importOp = new ImportOp(); importOp.setContext(cmdl); importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); importOp.setAll(true); exception.expect(GeoToolsOpException.class); importOp.call(); }
@Override protected void setUpInternal() throws Exception { insertAndAdd(points1, points2, points3); commit("inital"); SimpleFeatureType fullSchema = pointsType; RevFeatureType nativeType = RevFeatureTypeBuilder.build(fullSchema); Context actualContext = repo.context(); context = spy(actualContext); difftree = spy(context.command(DiffTree.class)); doReturn(difftree).when(context).command(eq(DiffTree.class)); NodeRef typeRef = context.workingTree().getFeatureTypeTrees().get(0); FeatureReaderBuilder b = FeatureReaderBuilder.builder(context, nativeType, typeRef); builder = spy(b); }
@Test public void testDeleteException() throws Exception { WorkingTree workTree = mock(WorkingTree.class); Context cmdl = mock(Context.class); when(cmdl.workingTree()).thenReturn(workTree); doThrow(new RuntimeException("Exception")).when(workTree).delete(any(String.class)); ImportOp importOp = new ImportOp(); importOp.setContext(cmdl); importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); importOp.setAll(true); exception.expect(GeoToolsOpException.class); importOp.call(); }
@Override protected void setUpInternal() throws Exception { insertAndAdd(points1, points2, points3); commit("inital"); SimpleFeatureType fullSchema = pointsType; RevFeatureType nativeType = RevFeatureType.builder().type(fullSchema).build(); Context actualContext = repo.context(); context = spy(actualContext); difftree = spy(context.command(DiffTree.class)); doReturn(difftree).when(context).command(eq(DiffTree.class)); NodeRef typeRef = context.workingTree().getFeatureTypeTrees().get(0); FeatureReaderBuilder b = FeatureReaderBuilder.builder(context, nativeType, typeRef); builder = spy(b); }
@Test public void testIgnoreIndex() { createIndex(); builder.ignoreIndex().build(); NodeRef typeRef = context.workingTree().getFeatureTypeTrees().get(0); ObjectId canonicalTreeId = typeRef.getObjectId(); verify(difftree).setNewTree(eq(canonicalTreeId)); }
@Test public void testIgnoreIndex() { createIndex(); builder.ignoreIndex().build(); NodeRef typeRef = context.workingTree().getFeatureTypeTrees().get(0); ObjectId canonicalTreeId = typeRef.getObjectId(); verify(difftree).setNewTree(eq(canonicalTreeId)); }
public TestData remove(SimpleFeature... features) { WorkingTree workingTree = getContext().workingTree(); for (SimpleFeature sf : features) { String parentTreePath = sf.getType().getName().getLocalPart(); workingTree.delete(parentTreePath, sf.getID()); } return this; }
public TestData remove(SimpleFeature... features) { WorkingTree workingTree = getContext().workingTree(); for (SimpleFeature sf : features) { String parentTreePath = sf.getType().getName().getLocalPart(); workingTree.delete(parentTreePath, sf.getID()); } return this; }
verify(context).workingTree();
public TestData insert(SimpleFeature... features) { WorkingTree workingTree = getContext().workingTree(); Map<FeatureType, RevFeatureType> types = new HashMap<>(); for (SimpleFeature sf : features) { SimpleFeatureType ft = sf.getType(); RevFeatureType rft = types.get(ft); if (null == rft) { rft = RevFeatureTypeBuilder.build(ft); types.put(ft, rft); getContext().objectDatabase().put(rft); } String parentTreePath = ft.getName().getLocalPart(); String path = NodeRef.appendChild(parentTreePath, sf.getID()); FeatureInfo fi = FeatureInfo.insert(RevFeatureBuilder.build(sf), rft.getId(), path); workingTree.insert(fi); } return this; }
public TestData insert(List<SimpleFeature> features) { Context context = getContext(); WorkingTree workingTree = context.workingTree(); Map<FeatureType, RevFeatureType> types = new HashMap<>(); for (SimpleFeature sf : features) { SimpleFeatureType ft = sf.getType(); RevFeatureType rft = types.get(ft); if (null == rft) { rft = RevFeatureType.builder().type(ft).build(); types.put(ft, rft); context.objectDatabase().put(rft); } String parentTreePath = ft.getName().getLocalPart(); String path = NodeRef.appendChild(parentTreePath, sf.getID()); FeatureInfo fi = FeatureInfo.insert(RevFeature.builder().build(sf), rft.getId(), path); workingTree.insert(fi); } return this; }