use of org.locationtech.geogig.api.Platform in project GeoGig by boundlessgeo.
the class SLImportTest method setUpGeogig.
private void setUpGeogig(GeogigCLI cli) throws Exception {
final File userhome = tempFolder.newFolder("mockUserHomeDir");
final File workingDir = tempFolder.newFolder("mockWorkingDir");
tempFolder.newFolder("mockWorkingDir/.geogig");
final Platform platform = mock(Platform.class);
when(platform.pwd()).thenReturn(workingDir);
when(platform.getUserHome()).thenReturn(userhome);
cli.setPlatform(platform);
}
use of org.locationtech.geogig.api.Platform in project GeoGig by boundlessgeo.
the class SQLServerDescribeTest method setUpGeogig.
private void setUpGeogig(GeogigCLI cli) throws Exception {
final File userhome = tempFolder.newFolder("mockUserHomeDir");
final File workingDir = tempFolder.newFolder("mockWorkingDir");
tempFolder.newFolder("mockWorkingDir/.geogig");
final Platform platform = mock(Platform.class);
when(platform.pwd()).thenReturn(workingDir);
when(platform.getUserHome()).thenReturn(userhome);
cli.setPlatform(platform);
}
use of org.locationtech.geogig.api.Platform in project GeoGig by boundlessgeo.
the class GlobalState method setupGeogig.
public static void setupGeogig() throws Exception {
assertNotNull(platform);
stdIn = new ByteArrayInputStream(new byte[0]);
stdOut = new ByteArrayOutputStream();
if (GlobalState.consoleReader != null) {
GlobalState.consoleReader.shutdown();
}
// GlobalState.consoleReader = new ConsoleReader(stdIn,
// new TeeOutputStream(stdOut, System.err), new UnsupportedTerminal());
GlobalState.consoleReader = new ConsoleReader(stdIn, stdOut, new UnsupportedTerminal());
ContextBuilder injectorBuilder = new CLITestContextBuilder(platform);
Context injector = injectorBuilder.build();
if (geogigCLI != null) {
geogigCLI.close();
}
geogigCLI = new GeogigCLI(GlobalState.consoleReader);
GlobalContextBuilder.builder = injectorBuilder;
Platform platform = injector.platform();
geogigCLI.setPlatform(platform);
geogigCLI.tryConfigureLogging();
}
use of org.locationtech.geogig.api.Platform in project GeoGig by boundlessgeo.
the class InitOpTest method setUp.
@Before
public void setUp() throws IOException, RepositoryConnectionException {
injector = mock(Context.class);
mockRefParse = mock(RefParse.class);
when(mockRefParse.setName(anyString())).thenReturn(mockRefParse);
mockUpdateRef = mock(UpdateRef.class);
when(mockUpdateRef.setName(anyString())).thenReturn(mockUpdateRef);
when(mockUpdateRef.setDelete(anyBoolean())).thenReturn(mockUpdateRef);
when(mockUpdateRef.setNewValue((ObjectId) anyObject())).thenReturn(mockUpdateRef);
when(mockUpdateRef.setOldValue((ObjectId) anyObject())).thenReturn(mockUpdateRef);
when(mockUpdateRef.setReason(anyString())).thenReturn(mockUpdateRef);
mockUpdateSymRef = mock(UpdateSymRef.class);
when(mockUpdateSymRef.setName(anyString())).thenReturn(mockUpdateSymRef);
when(mockUpdateSymRef.setDelete(anyBoolean())).thenReturn(mockUpdateSymRef);
when(mockUpdateSymRef.setNewValue(anyString())).thenReturn(mockUpdateSymRef);
when(mockUpdateSymRef.setOldValue(anyString())).thenReturn(mockUpdateSymRef);
when(mockUpdateSymRef.setReason(anyString())).thenReturn(mockUpdateSymRef);
when(injector.command(eq(RefParse.class))).thenReturn(mockRefParse);
when(injector.command(eq(UpdateRef.class))).thenReturn(mockUpdateRef);
when(injector.command(eq(UpdateSymRef.class))).thenReturn(mockUpdateSymRef);
platform = mock(Platform.class);
when(injector.platform()).thenReturn(platform);
defaults = PluginDefaults.NO_PLUGINS;
init = new InitOp(defaults);
init.setContext(injector);
mockRepo = mock(Repository.class);
objectDatabase = new HeapObjectDatabse();
when(mockRepo.objectDatabase()).thenReturn(objectDatabase);
Mockito.doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
objectDatabase.open();
return null;
}
}).when(mockRepo).open();
workingDir = tempFolder.getRoot();
when(platform.pwd()).thenReturn(workingDir);
}
use of org.locationtech.geogig.api.Platform in project GeoGig by boundlessgeo.
the class DiffTreeTest method setUp.
@Before
public void setUp() throws Exception {
File workingDirectory = tempFolder.newFolder("mockWorkingDir");
Platform testPlatform = new TestPlatform(workingDirectory);
Context injector = Guice.createInjector(Modules.override(new GeogigModule()).with(new MemoryModule(testPlatform))).getInstance(Context.class);
geogit = new GeoGIG(injector);
assertNotNull(geogit.getOrCreateRepository());
diffTree = geogit.command(DiffTree.class);
SimpleFeatureType ft = DataUtilities.createType("points", "sp:String,ip:Integer,pp:Point:srid=3857");
revtype = RevFeatureTypeImpl.build(ft);
metadataId = revtype.getId();
geogit.getContext().objectDatabase().put(revtype);
}
Aggregations