Search in sources :

Example 1 with OrchidServer

use of com.eden.orchid.api.server.OrchidServer in project Orchid by JavaEden.

the class OptionsServiceImpl method addView.

private void addView(Map<String, Object> siteData, OrchidView view) {
    siteData.put("view", view);
    siteData.put("controller", view.getController());
    siteData.put("params", view.getParams());
    OrchidServer server = context.resolve(OrchidServer.class);
    siteData.put("httpServerPort", server.getHttpServerPort());
    siteData.put("websocketPort", server.getWebsocketPort());
    siteData.put("optionsExtractor", context.resolve(OptionsExtractor.class));
    addPage(siteData, view);
}
Also used : OrchidServer(com.eden.orchid.api.server.OrchidServer)

Example 2 with OrchidServer

use of com.eden.orchid.api.server.OrchidServer in project Orchid by JavaEden.

the class TaskServiceTest method setUp.

@BeforeEach
public void setUp() {
    Set<OrchidTask> tasks = new HashSet<>();
    OrchidTask task1 = mock(OrchidTask.class);
    when(task1.getName()).thenReturn("task1");
    tasks.add(task1);
    OrchidTask task2 = mock(OrchidTask.class);
    when(task2.getName()).thenReturn("task2");
    tasks.add(task2);
    Set<OrchidCommand> commands = new HashSet<>();
    OrchidFileController controller = mock(OrchidFileController.class);
    OrchidServer server = new OrchidServer(new HashSet<>(), controller);
    FileWatcher fileWatcher = mock(FileWatcher.class);
    // test the service directly
    context = mock(OrchidContext.class);
    service = new TaskServiceImpl(tasks, commands, "", 8080, server, fileWatcher);
    service.initialize(context);
    // test that the default implementation is identical to the real implementation
    underTest = new TaskService() {

        public void initialize(OrchidContext context) {
        }

        public <T extends OrchidService> T getService(Class<T> serviceClass) {
            return (T) service;
        }
    };
}
Also used : OrchidContext(com.eden.orchid.api.OrchidContext) OrchidServer(com.eden.orchid.api.server.OrchidServer) FileWatcher(com.eden.orchid.api.server.FileWatcher) OrchidFileController(com.eden.orchid.api.server.OrchidFileController) HashSet(java.util.HashSet) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

OrchidServer (com.eden.orchid.api.server.OrchidServer)2 OrchidContext (com.eden.orchid.api.OrchidContext)1 FileWatcher (com.eden.orchid.api.server.FileWatcher)1 OrchidFileController (com.eden.orchid.api.server.OrchidFileController)1 HashSet (java.util.HashSet)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1