use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.
the class SessionStructureUnitTest method setUp.
@BeforeEach
void setUp() throws Exception {
WithConfigsTest.setUpConstantMessages();
factory = new VariantFactory();
model = mock(Model.class);
session = new Session(model);
given(model.getSession()).willReturn(session);
given(model.getVariantFactory()).willReturn(factory);
Control.initSingletonForTesting(model);
msg = new HttpMessage();
}
use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.
the class Control method runCommandLineOpenSession.
public void runCommandLineOpenSession(String fileName) throws Exception {
log.debug("runCommandLineOpenSession " + fileName);
getExtensionLoader().sessionAboutToChangeAllPlugin(null);
Session session = Model.getSingleton().getSession();
Model.getSingleton().openSession(fileName);
log.info("Session file opened");
control.getExtensionLoader().databaseOpen(model.getDb());
control.getExtensionLoader().sessionChangedAllPlugin(session);
}
use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.
the class MenuFileControl method saveSession.
public void saveSession() {
Session session = model.getSession();
if (session.isNewState()) {
view.showWarningDialog("Please use Save As...");
return;
}
try {
waitMessageDialog = view.getWaitMessageDialog(// ZAP: i18n
Constant.messages.getString("menu.file.savingSession"));
control.saveSession(session.getFileName(), this);
log.info("saving session file " + session.getFileName());
// ZAP: If the save is quick the dialog can already be null here
if (waitMessageDialog != null) {
waitMessageDialog.setVisible(true);
}
} catch (Exception e) {
view.showWarningDialog(// ZAP: i18n
Constant.messages.getString("menu.file.savingSession.error"));
log.error("error saving session file " + session.getFileName());
log.error(e.getMessage(), e);
}
}
use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.
the class SessionGeneralPanel method saveParam.
@Override
public void saveParam(Object obj) throws Exception {
Session session = (Session) obj;
boolean changed = false;
if (!getTxtSessionName().getText().equals(session.getSessionName())) {
session.setSessionName(getTxtSessionName().getText());
changed = true;
}
if (!getTxtDescription().getText().equals(session.getSessionDesc())) {
session.setSessionDesc(getTxtDescription().getText());
changed = true;
}
if (changed) {
try {
Control.getSingleton().persistSessionProperties();
} catch (Exception e) {
LOGGER.error("Failed to persist the session properties:", e);
throw new Exception(Constant.messages.getString("session.general.error.persist.session.props"));
}
}
}
use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.
the class SessionGeneralPanel method initParam.
@Override
public void initParam(Object obj) {
Session session = (Session) obj;
getTxtSessionName().setText(session.getSessionName());
getTxtSessionName().discardAllEdits();
getTxtDescription().setText(session.getSessionDesc());
getTxtDescription().discardAllEdits();
if (session.getFileName() != null) {
getSessionLocation().setText(session.getFileName());
// In case its really long
getSessionLocation().setToolTipText(session.getFileName());
}
}
Aggregations