Search in sources :

Example 1 with EnrichedSessionState

use of io.github.vocabhunter.analysis.session.EnrichedSessionState in project VocabHunter by VocabHunter.

the class AnalysisSystemTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    Analyser analyser = new SimpleAnalyser();
    FileStreamer target = new FileStreamer(analyser);
    URL resource = FileStreamerTest.class.getResource("/" + INPUT_DOCUMENT);
    Path file = Paths.get(resource.toURI());
    EnrichedSessionState enrichedSession = target.createNewSession(file);
    SessionState sessionState = enrichedSession.getState();
    words = sessionState.getOrderedUses();
}
Also used : Path(java.nio.file.Path) SessionState(io.github.vocabhunter.analysis.session.SessionState) EnrichedSessionState(io.github.vocabhunter.analysis.session.EnrichedSessionState) EnrichedSessionState(io.github.vocabhunter.analysis.session.EnrichedSessionState) SimpleAnalyser(io.github.vocabhunter.analysis.simple.SimpleAnalyser) Analyser(io.github.vocabhunter.analysis.model.Analyser) SimpleAnalyser(io.github.vocabhunter.analysis.simple.SimpleAnalyser) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Example 2 with EnrichedSessionState

use of io.github.vocabhunter.analysis.session.EnrichedSessionState in project VocabHunter by VocabHunter.

the class FileStreamerTest method testDifferentSession.

@Test
public void testDifferentSession() {
    EnrichedSessionState state1 = createNewSession(FILE_TEXT);
    EnrichedSessionState state2 = createNewSession(FILE_WORD);
    assertNotEquals("Different session", state1, state2);
}
Also used : EnrichedSessionState(io.github.vocabhunter.analysis.session.EnrichedSessionState) Test(org.junit.Test)

Example 3 with EnrichedSessionState

use of io.github.vocabhunter.analysis.session.EnrichedSessionState in project VocabHunter by VocabHunter.

the class FileStreamerTest method testEqualHashCode.

@Test
public void testEqualHashCode() {
    EnrichedSessionState state1 = createNewSession(FILE_TEXT);
    EnrichedSessionState state2 = createNewSession(FILE_TEXT);
    assertEquals("Equal hash code session", state1.hashCode(), state2.hashCode());
}
Also used : EnrichedSessionState(io.github.vocabhunter.analysis.session.EnrichedSessionState) Test(org.junit.Test)

Example 4 with EnrichedSessionState

use of io.github.vocabhunter.analysis.session.EnrichedSessionState in project VocabHunter by VocabHunter.

the class FileStreamerTest method testSessionToString.

@Test
public void testSessionToString() {
    EnrichedSessionState state = createNewSession(FILE_TEXT);
    assertTrue("Session toString", StringUtils.isNotBlank(state.toString()));
}
Also used : EnrichedSessionState(io.github.vocabhunter.analysis.session.EnrichedSessionState) Test(org.junit.Test)

Example 5 with EnrichedSessionState

use of io.github.vocabhunter.analysis.session.EnrichedSessionState in project VocabHunter by VocabHunter.

the class GuiFileHandler method processNewSession.

private void processNewSession() {
    Path file = checkUnsavedChangesAndChooseFile(FileDialogueType.NEW_SESSION);
    if (file == null) {
        statusManager.completeAction();
    } else {
        statusManager.performAction(file);
        LOG.info("New session from '{}'", file);
        GuiTask<EnrichedSessionState> task = new GuiTask<>(guiTaskHandler, statusManager, () -> sessionFileService.createNewSession(file), this::finishOpen, e -> FileErrorTool.open(file, e));
        guiTaskHandler.executeInBackground(task);
    }
}
Also used : Path(java.nio.file.Path) GuiTask(io.github.vocabhunter.gui.status.GuiTask) EnrichedSessionState(io.github.vocabhunter.analysis.session.EnrichedSessionState)

Aggregations

EnrichedSessionState (io.github.vocabhunter.analysis.session.EnrichedSessionState)10 Test (org.junit.Test)4 Path (java.nio.file.Path)3 SessionState (io.github.vocabhunter.analysis.session.SessionState)2 GuiTask (io.github.vocabhunter.gui.status.GuiTask)2 Analyser (io.github.vocabhunter.analysis.model.Analyser)1 SimpleAnalyser (io.github.vocabhunter.analysis.simple.SimpleAnalyser)1 SessionModel (io.github.vocabhunter.gui.model.SessionModel)1 URL (java.net.URL)1 BeforeClass (org.junit.BeforeClass)1