Skip to content

Commit 6843281

Browse files
committed
Fix failing tests
1 parent 625710f commit 6843281

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

core/src/main/java/edu/wpi/grip/core/GRIPCoreModule.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
105105

106106
bind(EventBus.class).toInstance(eventBus);
107107

108-
bind(FileManager.class).to(GripFileManager.class);
109-
110108
// Allow for just injecting the settings provider, instead of the whole pipeline
111109
bind(SettingsProvider.class).to(Pipeline.class);
112110

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package edu.wpi.grip.core;
2+
3+
import com.google.inject.AbstractModule;
4+
5+
public class GripFileModule extends AbstractModule {
6+
@Override
7+
protected void configure() {
8+
bind(FileManager.class).to(GripFileManager.class);
9+
}
10+
}

core/src/test/java/edu/wpi/grip/core/CoreSanityTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public CoreSanityTest() {
1818
AddOperation.class,
1919
ManualPipelineRunner.class,
2020
SubtractionOperation.class,
21+
GripFileManager.class,
2122
Main.class
2223
).contains(c));
2324
setDefault(OutputSocket.class, new MockOutputSocket("Mock Out"));

core/src/test/java/edu/wpi/grip/core/operations/OperationsFactory.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
import com.google.common.eventbus.EventBus;
5+
import edu.wpi.grip.core.FileManager;
56
import edu.wpi.grip.core.operations.network.MapNetworkPublisherFactory;
67
import edu.wpi.grip.core.operations.network.MockMapNetworkPublisher;
78
import edu.wpi.grip.core.operations.network.ros.JavaToMessageConverter;
@@ -11,6 +12,7 @@
1112
import edu.wpi.grip.core.sockets.MockInputSocketFactory;
1213
import edu.wpi.grip.core.sockets.MockOutputSocketFactory;
1314
import edu.wpi.grip.core.sockets.OutputSocket;
15+
import edu.wpi.grip.core.util.MockFileManager;
1416

1517
import java.util.Optional;
1618

@@ -38,17 +40,16 @@ public void close() {
3840
}
3941

4042
public static Operations create(EventBus eventBus) {
41-
42-
return create(eventBus, MockMapNetworkPublisher::new, MockROSMessagePublisher::new,
43-
new MockInputSocketFactory(eventBus), new MockOutputSocketFactory(eventBus));
43+
return create(eventBus, MockMapNetworkPublisher::new, MockROSMessagePublisher::new, new MockFileManager(), new MockInputSocketFactory(eventBus), new MockOutputSocketFactory(eventBus));
4444
}
4545

4646
public static Operations create(EventBus eventBus,
4747
MapNetworkPublisherFactory mapFactory,
4848
ROSNetworkPublisherFactory rosFactory,
49+
FileManager fileManager,
4950
InputSocket.Factory isf,
5051
OutputSocket.Factory osf) {
51-
return new Operations(eventBus, mapFactory, rosFactory, isf, osf);
52+
return new Operations(eventBus, mapFactory, rosFactory, fileManager, isf, osf);
5253
}
5354

5455
public static CVOperations createCV(EventBus eventBus) {

ui/src/main/java/edu/wpi/grip/ui/Main.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import edu.wpi.grip.core.operations.network.GRIPNetworkModule;
1616
import edu.wpi.grip.core.serialization.Project;
1717
import edu.wpi.grip.core.sources.GRIPSourcesHardwareModule;
18+
import edu.wpi.grip.core.GripFileModule;
1819
import edu.wpi.grip.core.util.SafeShutdown;
1920
import edu.wpi.grip.ui.util.DPIUtility;
2021
import javafx.application.Application;
@@ -63,13 +64,13 @@ public void start(Stage stage) throws Exception {
6364

6465
if (parameters.contains("--headless")) {
6566
// If --headless was specified on the command line, run in headless mode (only use the core module)
66-
injector = Guice.createInjector(new GRIPCoreModule(), new GRIPNetworkModule(), new GRIPSourcesHardwareModule());
67+
injector = Guice.createInjector(new GRIPCoreModule(), new GripFileModule(), new GRIPNetworkModule(), new GRIPSourcesHardwareModule());
6768
injector.injectMembers(this);
6869

6970
parameters.remove("--headless");
7071
} else {
7172
// Otherwise, run with both the core and UI modules, and show the JavaFX stage
72-
injector = Guice.createInjector(Modules.override(new GRIPCoreModule(), new GRIPNetworkModule(), new GRIPSourcesHardwareModule()).with(new GRIPUIModule()));
73+
injector = Guice.createInjector(Modules.override(new GRIPCoreModule(), new GripFileModule(), new GRIPNetworkModule(), new GRIPSourcesHardwareModule()).with(new GRIPUIModule()));
7374
injector.injectMembers(this);
7475

7576
root = FXMLLoader.load(Main.class.getResource("MainWindow.fxml"), null, null, injector::getInstance);

0 commit comments

Comments
 (0)