Skip to content

Commit

Permalink
Merge pull request #70 from bia-technologies/feature/report-settings-…
Browse files Browse the repository at this point in the history
…refactor

Рефакторинг логики работы с настройками отчета
  • Loading branch information
alkoleft authored Jan 27, 2025
2 parents c502b22 + 524ad54 commit 3c67bdc
Show file tree
Hide file tree
Showing 21 changed files with 358 additions and 840 deletions.

This file was deleted.

12 changes: 0 additions & 12 deletions viewer/src/main/java/ru/biatech/edt/junit/model/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com._1c.g5.v8.dt.core.platform.IV8Project;
import lombok.Getter;
import lombok.Setter;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.debug.core.ILaunch;
import ru.biatech.edt.junit.TestViewerPlugin;
import ru.biatech.edt.junit.kinds.ITestKind;
Expand Down Expand Up @@ -49,15 +48,12 @@
@Getter
public class Session extends Report<TestSuiteElement> implements ITestRunSession {

private static final String EMPTY_STRING = ""; //$NON-NLS-1$
/**
* Ссылка на 1С проект, or <code>null</code>.
*/
private IV8Project launchedProject;
private String projectName;

private final ListenerList<ITestSessionListener> sessionListeners = new ListenerList<>();

/**
* Number of tests started during this test run.
*/
Expand Down Expand Up @@ -206,14 +202,6 @@ public IV8Project getLaunchedProject() {
return null;
}
}
public synchronized void addTestSessionListener(ITestSessionListener listener) {
// swapIn();
sessionListeners.add(listener);
}

public void removeTestSessionListener(ITestSessionListener listener) {
sessionListeners.remove(listener);
}

public synchronized void swapOut() { // TODO Не ясно, нужно или нет
// if (fTestRoot == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ private void notifySessionAdded(Session session) {

private static final class SessionListener implements ISessionListener {
private Session activeSession;
private ITestSessionListener sessionListener;

@Override
public void sessionAdded(Session session) {
Expand All @@ -270,77 +269,11 @@ public void sessionAdded(Session session) {
return;

activeSession = session;

sessionListener = new ITestSessionListener() {
@Override
public void testAdded(ITestElement testElement) {
}

@Override
public void sessionStarted() {
TestViewerPlugin.core().getNewTestRunListeners().forEach(it -> it.sessionStarted(activeSession));
}

@Override
public void sessionTerminated() {
TestViewerPlugin.core().getNewTestRunListeners().forEach(it -> it.sessionTerminated(activeSession));
sessionRemoved(activeSession);
}

@Override
public void sessionStopped(long elapsedTime) {
TestViewerPlugin.core().getNewTestRunListeners().forEach(it -> it.sessionFinished(activeSession));
sessionRemoved(activeSession);
}

@Override
public void sessionEnded(long elapsedTime) {
TestViewerPlugin.core().getNewTestRunListeners().forEach(it -> it.sessionFinished(activeSession));
sessionRemoved(activeSession);
}

@Override
public void runningBegins() {
// ignore
}

@Override
public void testStarted(ITestCaseElement testCaseElement) {
// not fire
// TestViewerPlugin.core().getNewTestRunListeners().forEach(it->it.testCaseStarted(testCaseElement));
}

@Override
public void testFailed(ITestElement testElement, TestStatus status, String trace, String expected, String actual) {
// not fire
// TestViewerPlugin.core().getNewTestRunListeners().forEach(it->it.testCaseFinished(testElement));
}

@Override
public void testEnded(ITestCaseElement testCaseElement) {
// not fire
// TestViewerPlugin.core().getNewTestRunListeners().forEach(it->it.testCaseFinished(testCaseElement));
}

@Override
public void testRerun(ITestCaseElement testCaseElement, TestStatus status, String trace, String expectedResult, String actualResult) {
// not fire
// TestViewerPlugin.core().getNewTestRunListeners().forEach(it->it.testCaseRerun(testCaseElement));
}

@Override
public boolean acceptsSwapToDisk() {
return true;
}
};
activeSession.addTestSessionListener(sessionListener);
}

@Override
public void sessionRemoved(Session session) {
if (activeSession == session) {
activeSession.removeTestSessionListener(sessionListener);
sessionListener = null;
activeSession = null;
}
}
Expand Down

This file was deleted.

Loading

0 comments on commit 3c67bdc

Please sign in to comment.