diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientHistoryTableModel.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ClientHistoryTableModel.java index 13ffb6b9260..a705eea6dce 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientHistoryTableModel.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ClientHistoryTableModel.java @@ -24,6 +24,9 @@ import java.util.List; import javax.swing.table.AbstractTableModel; import org.parosproxy.paros.Constant; +import org.zaproxy.addon.client.internal.ReportedElement; +import org.zaproxy.addon.client.internal.ReportedEvent; +import org.zaproxy.addon.client.internal.ReportedObject; public class ClientHistoryTableModel extends AbstractTableModel { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientIntegrationAPI.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ClientIntegrationAPI.java index baf69dba6d2..8c033142e91 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientIntegrationAPI.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ClientIntegrationAPI.java @@ -28,6 +28,10 @@ import org.parosproxy.paros.network.HttpHeader; import org.parosproxy.paros.network.HttpMessage; import org.parosproxy.paros.network.HttpRequestHeader; +import org.zaproxy.addon.client.internal.ClientNode; +import org.zaproxy.addon.client.internal.ClientSideComponent; +import org.zaproxy.addon.client.internal.ReportedElement; +import org.zaproxy.addon.client.internal.ReportedEvent; import org.zaproxy.zap.extension.api.API; import org.zaproxy.zap.extension.api.ApiAction; import org.zaproxy.zap.extension.api.ApiException; @@ -92,22 +96,13 @@ private void handleReportObject(JSONObject json) { () -> { ClientNode node = this.extension.getOrAddClientNode(urlStr, false, false); - ClientSideDetails details = node.getUserObject(); - boolean wasVisited = details.isVisited(); ClientSideComponent component = new ClientSideComponent(json); - boolean componentAdded = details.addComponent(component); - if (!wasVisited || componentAdded) { - details.setVisited(true); - this.extension.clientNodeChanged(node); - } + extension.addComponentToNode(node, component); if (component.isStorageEvent()) { String storageUrl = node.getSite() + component.getTypeForDisplay(); - ClientNode storageNode = - this.extension.getOrAddClientNode(storageUrl, false, true); - ClientSideDetails storageDetails = storageNode.getUserObject(); - storageDetails.setStorage(true); - storageDetails.addComponent(component); - this.extension.clientNodeChanged(storageNode); + extension.addComponentToNode( + this.extension.getOrAddClientNode(storageUrl, false, true), + component); } }); } diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ComponentTableModel.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ComponentTableModel.java index 53051bddf17..607a5d88951 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ComponentTableModel.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ComponentTableModel.java @@ -23,6 +23,7 @@ import java.util.List; import javax.swing.table.AbstractTableModel; import org.parosproxy.paros.Constant; +import org.zaproxy.addon.client.internal.ClientSideComponent; public class ComponentTableModel extends AbstractTableModel { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ExtensionClientIntegration.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ExtensionClientIntegration.java index b947287b329..31a4fab280a 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ExtensionClientIntegration.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ExtensionClientIntegration.java @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; @@ -44,16 +45,34 @@ import org.parosproxy.paros.extension.ExtensionHook; import org.parosproxy.paros.extension.SessionChangedListener; import org.parosproxy.paros.extension.history.ExtensionHistory; +import org.parosproxy.paros.model.Model; import org.parosproxy.paros.model.Session; import org.parosproxy.paros.model.SiteNode; import org.parosproxy.paros.view.View; import org.zaproxy.addon.client.impl.ClientZestRecorder; +import org.zaproxy.addon.client.internal.ClientMap; +import org.zaproxy.addon.client.internal.ClientNode; +import org.zaproxy.addon.client.internal.ClientSideComponent; +import org.zaproxy.addon.client.internal.ClientSideDetails; +import org.zaproxy.addon.client.internal.ReportedElement; +import org.zaproxy.addon.client.internal.ReportedEvent; +import org.zaproxy.addon.client.internal.ReportedObject; import org.zaproxy.addon.client.pscan.ClientPassiveScanController; import org.zaproxy.addon.client.pscan.ClientPassiveScanHelper; import org.zaproxy.addon.client.pscan.OptionsPassiveScan; import org.zaproxy.addon.client.spider.ClientSpider; import org.zaproxy.addon.client.spider.ClientSpiderDialog; import org.zaproxy.addon.client.spider.PopupMenuSpider; +import org.zaproxy.addon.client.ui.ClientDetailsPanel; +import org.zaproxy.addon.client.ui.ClientHistoryPanel; +import org.zaproxy.addon.client.ui.ClientMapPanel; +import org.zaproxy.addon.client.ui.PopupMenuClientAttack; +import org.zaproxy.addon.client.ui.PopupMenuClientCopyUrls; +import org.zaproxy.addon.client.ui.PopupMenuClientDelete; +import org.zaproxy.addon.client.ui.PopupMenuClientDetailsCopy; +import org.zaproxy.addon.client.ui.PopupMenuClientHistoryCopy; +import org.zaproxy.addon.client.ui.PopupMenuClientOpenInBrowser; +import org.zaproxy.addon.client.ui.PopupMenuClientShowInSites; import org.zaproxy.addon.network.ExtensionNetwork; import org.zaproxy.zap.ZAP; import org.zaproxy.zap.eventBus.Event; @@ -75,7 +94,7 @@ public class ExtensionClientIntegration extends ExtensionAdaptor { private static final String FIREFOX_PROFILES_INI = "profiles.ini"; - protected static final String PREFIX = "client"; + public static final String PREFIX = "client"; protected static final String RESOURCES = "resources"; @@ -112,7 +131,8 @@ public ExtensionClientIntegration() { } @Override - public void init() { + public void initModel(Model model) { + super.initModel(model); clientHistoryTableModel = new ClientHistoryTableModel(); clientTree = new ClientMap( @@ -417,6 +437,14 @@ public void clientNodeChanged(ClientNode node) { this.clientTree.nodeChanged(node); } + public boolean addComponentToNode(ClientNode node, ClientSideComponent component) { + if (this.clientTree.addComponentToNode(node, component)) { + this.clientNodeChanged(node); + return true; + } + return false; + } + public void deleteNodes(List nodes) { this.clientTree.deleteNodes(nodes); if (View.isInitialised()) { @@ -623,11 +651,18 @@ private ZapMenuItem getMenuItemCustomScan() { public ImageIcon getIcon() { if (icon == null) { - icon = - DisplayUtils.getScaledIcon( - ExtensionClientIntegration.class.getResource( - ExtensionClientIntegration.RESOURCES + "/spiderClient.png")); + icon = getIcon("spiderClient.png"); } return icon; } + + public static ImageIcon getIcon(String name) { + String resourceName = RESOURCES + "/" + name; + URL url = ExtensionClientIntegration.class.getResource(resourceName); + if (url == null) { + LOGGER.error("No icon with name {}", resourceName); + return null; + } + return DisplayUtils.getScaledIcon(url); + } } diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/MissingUrlsThread.java b/addOns/client/src/main/java/org/zaproxy/addon/client/MissingUrlsThread.java index f721ce19088..fbc604d03c2 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/MissingUrlsThread.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/MissingUrlsThread.java @@ -31,6 +31,8 @@ import org.parosproxy.paros.network.HttpRequestHeader; import org.parosproxy.paros.network.HttpSender; import org.parosproxy.paros.view.View; +import org.zaproxy.addon.client.internal.ClientNode; +import org.zaproxy.addon.client.internal.ClientSideDetails; import org.zaproxy.zap.eventBus.Event; import org.zaproxy.zap.model.SessionStructure; import org.zaproxy.zap.model.StructuralNode; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientMap.java b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientMap.java similarity index 94% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ClientMap.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientMap.java index 4d51fb37963..beee0c02e6b 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientMap.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientMap.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.internal; import java.util.Comparator; import java.util.HashMap; @@ -27,6 +27,7 @@ import javax.swing.tree.TreeNode; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.zaproxy.addon.client.ClientUtils; import org.zaproxy.zap.ZAP; import org.zaproxy.zap.eventBus.Event; import org.zaproxy.zap.eventBus.EventPublisher; @@ -156,6 +157,16 @@ public void clear() { public String getPublisherName() { return this.getClass().getCanonicalName(); } + + public boolean addComponentToNode(ClientNode node, ClientSideComponent component) { + ClientSideDetails details = node.getUserObject(); + boolean wasVisited = details.isVisited(); + boolean componentAdded = details.addComponent(component); + if (!wasVisited || componentAdded) { + details.setVisited(true); + } + return componentAdded; + } } /** diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientNode.java b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientNode.java similarity index 98% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ClientNode.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientNode.java index da568d991c9..9b77f7aa95a 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientNode.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientNode.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.internal; import java.util.ArrayList; import java.util.List; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientSideComponent.java b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientSideComponent.java similarity index 97% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ClientSideComponent.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientSideComponent.java index 45a0e520b82..0a8197e25b5 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientSideComponent.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientSideComponent.java @@ -17,11 +17,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.internal; import java.util.Objects; import net.sf.json.JSONObject; import org.parosproxy.paros.Constant; +import org.zaproxy.addon.client.ExtensionClientIntegration; public class ClientSideComponent { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientSideDetails.java b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientSideDetails.java similarity index 89% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ClientSideDetails.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientSideDetails.java index 07650c5d2e9..95720ff6cc6 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientSideDetails.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientSideDetails.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.internal; import java.util.HashSet; import java.util.Set; @@ -57,11 +57,11 @@ public Set getComponents() { return components; } - public void setVisited(boolean visited) { + protected void setVisited(boolean visited) { this.visited = visited; } - public boolean addComponent(ClientSideComponent component) { + protected boolean addComponent(ClientSideComponent component) { return this.components.add(component); } @@ -69,7 +69,7 @@ public boolean isStorage() { return storage; } - public void setStorage(boolean storage) { + protected void setStorage(boolean storage) { this.storage = storage; } } diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ReportedElement.java b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ReportedElement.java similarity index 96% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ReportedElement.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/internal/ReportedElement.java index 936420fad33..91c172b17b2 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ReportedElement.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ReportedElement.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.internal; import net.sf.json.JSONObject; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ReportedEvent.java b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ReportedEvent.java similarity index 96% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ReportedEvent.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/internal/ReportedEvent.java index 6ccad3b5869..e1b4bfe6b4b 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ReportedEvent.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ReportedEvent.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.internal; import net.sf.json.JSONObject; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ReportedObject.java b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ReportedObject.java similarity index 98% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ReportedObject.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/internal/ReportedObject.java index 0b79f6bdec8..25ab82d39b4 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ReportedObject.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/internal/ReportedObject.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.internal; import java.util.Date; import net.sf.json.JSONObject; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/ClientPassiveAbstractScanRule.java b/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/ClientPassiveAbstractScanRule.java index c948747d9f9..3e53fc5ca68 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/ClientPassiveAbstractScanRule.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/ClientPassiveAbstractScanRule.java @@ -21,7 +21,7 @@ import org.parosproxy.paros.core.scanner.Alert; import org.parosproxy.paros.core.scanner.Alert.Source; -import org.zaproxy.addon.client.ReportedObject; +import org.zaproxy.addon.client.internal.ReportedObject; public abstract class ClientPassiveAbstractScanRule implements ClientPassiveScanRule { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/ClientPassiveScanRule.java b/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/ClientPassiveScanRule.java index e8aa990c0b8..0ec54e3763d 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/ClientPassiveScanRule.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/ClientPassiveScanRule.java @@ -19,7 +19,7 @@ */ package org.zaproxy.addon.client.pscan; -import org.zaproxy.addon.client.ReportedObject; +import org.zaproxy.addon.client.internal.ReportedObject; import org.zaproxy.zap.extension.alert.ExampleAlertProvider; public interface ClientPassiveScanRule extends ExampleAlertProvider { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/InformationInStorageScanRule.java b/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/InformationInStorageScanRule.java index 85897f0c209..a0666d9d334 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/InformationInStorageScanRule.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/InformationInStorageScanRule.java @@ -25,8 +25,8 @@ import org.parosproxy.paros.Constant; import org.parosproxy.paros.core.scanner.Alert; import org.zaproxy.addon.client.ClientUtils; -import org.zaproxy.addon.client.ReportedElement; -import org.zaproxy.addon.client.ReportedObject; +import org.zaproxy.addon.client.internal.ReportedElement; +import org.zaproxy.addon.client.internal.ReportedObject; public class InformationInStorageScanRule extends ClientPassiveAbstractScanRule { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/JwtInStorageScanRule.java b/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/JwtInStorageScanRule.java index 12cb9c470aa..325c9734143 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/JwtInStorageScanRule.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/JwtInStorageScanRule.java @@ -28,8 +28,8 @@ import org.parosproxy.paros.Constant; import org.parosproxy.paros.core.scanner.Alert; import org.zaproxy.addon.client.ClientUtils; -import org.zaproxy.addon.client.ReportedElement; -import org.zaproxy.addon.client.ReportedObject; +import org.zaproxy.addon.client.internal.ReportedElement; +import org.zaproxy.addon.client.internal.ReportedObject; public class JwtInStorageScanRule extends ClientPassiveAbstractScanRule { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/SensitiveInfoInStorageScanRule.java b/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/SensitiveInfoInStorageScanRule.java index 241ca58909d..594a7607a56 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/SensitiveInfoInStorageScanRule.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/pscan/SensitiveInfoInStorageScanRule.java @@ -28,8 +28,8 @@ import org.parosproxy.paros.core.scanner.Alert; import org.parosproxy.paros.model.HistoryReference; import org.zaproxy.addon.client.ClientUtils; -import org.zaproxy.addon.client.ReportedElement; -import org.zaproxy.addon.client.ReportedObject; +import org.zaproxy.addon.client.internal.ReportedElement; +import org.zaproxy.addon.client.internal.ReportedObject; public class SensitiveInfoInStorageScanRule extends ClientPassiveAbstractScanRule { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/spider/ClientSpider.java b/addOns/client/src/main/java/org/zaproxy/addon/client/spider/ClientSpider.java index b306e710293..8a0fc88e96d 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/spider/ClientSpider.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/spider/ClientSpider.java @@ -35,10 +35,10 @@ import org.openqa.selenium.WebDriver; import org.parosproxy.paros.control.Control; import org.parosproxy.paros.view.View; -import org.zaproxy.addon.client.ClientMap; -import org.zaproxy.addon.client.ClientNode; import org.zaproxy.addon.client.ClientOptions; import org.zaproxy.addon.client.ExtensionClientIntegration; +import org.zaproxy.addon.client.internal.ClientMap; +import org.zaproxy.addon.client.internal.ClientNode; import org.zaproxy.zap.ZAP; import org.zaproxy.zap.eventBus.Event; import org.zaproxy.zap.eventBus.EventConsumer; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientDetailsPanel.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientDetailsPanel.java similarity index 88% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ClientDetailsPanel.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientDetailsPanel.java index 4c4a04873fb..f9d5fbc6e78 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientDetailsPanel.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientDetailsPanel.java @@ -17,18 +17,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.util.List; -import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import org.parosproxy.paros.Constant; import org.parosproxy.paros.extension.AbstractPanel; +import org.zaproxy.addon.client.ExtensionClientIntegration; +import org.zaproxy.addon.client.internal.ClientNode; +import org.zaproxy.addon.client.internal.ClientSideComponent; import org.zaproxy.zap.view.LayoutHelper; public class ClientDetailsPanel extends AbstractPanel { @@ -44,11 +46,7 @@ public ClientDetailsPanel() { this.setLayout(new GridBagLayout()); setName(Constant.messages.getString(ExtensionClientIntegration.PREFIX + ".details.title")); - setIcon( - new ImageIcon( - ExtensionClientIntegration.class.getResource( - ExtensionClientIntegration.RESOURCES - + "/application-browser.png"))); + setIcon(ExtensionClientIntegration.getIcon("application-browser.png")); introPanel = new JPanel(); introPanel.setLayout(new GridBagLayout()); diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientHistoryPanel.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientHistoryPanel.java similarity index 94% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ClientHistoryPanel.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientHistoryPanel.java index 89d46561467..3bca6b0bf7b 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientHistoryPanel.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientHistoryPanel.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.Component; import java.awt.GridBagLayout; @@ -26,7 +26,6 @@ import java.util.Date; import java.util.List; import java.util.stream.Collectors; -import javax.swing.ImageIcon; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.table.TableRowSorter; @@ -35,6 +34,9 @@ import org.parosproxy.paros.Constant; import org.parosproxy.paros.extension.AbstractPanel; import org.parosproxy.paros.view.View; +import org.zaproxy.addon.client.ClientHistoryTableModel; +import org.zaproxy.addon.client.ExtensionClientIntegration; +import org.zaproxy.addon.client.internal.ReportedObject; import org.zaproxy.zap.utils.FontUtils; import org.zaproxy.zap.view.LayoutHelper; import org.zaproxy.zap.view.ZapTable; @@ -50,10 +52,7 @@ public class ClientHistoryPanel extends AbstractPanel { public ClientHistoryPanel(ClientHistoryTableModel clientHistoryTableModel) { setName(Constant.messages.getString(ExtensionClientIntegration.PREFIX + ".history.title")); - setIcon( - new ImageIcon( - ExtensionClientIntegration.class.getResource( - ExtensionClientIntegration.RESOURCES + "/calendar-browser.png"))); + setIcon(ExtensionClientIntegration.getIcon("calendar-browser.png")); this.clientHistoryTableModel = clientHistoryTableModel; this.setLayout(new GridBagLayout()); diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientMapPanel.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientMapPanel.java similarity index 94% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ClientMapPanel.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientMapPanel.java index 6bb342aab8c..5b2c58da04e 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientMapPanel.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientMapPanel.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.Component; import java.awt.GridBagConstraints; @@ -26,7 +26,6 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.swing.ImageIcon; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTree; @@ -36,6 +35,9 @@ import org.parosproxy.paros.Constant; import org.parosproxy.paros.extension.AbstractPanel; import org.parosproxy.paros.view.View; +import org.zaproxy.addon.client.ExtensionClientIntegration; +import org.zaproxy.addon.client.internal.ClientMap; +import org.zaproxy.addon.client.internal.ClientNode; import org.zaproxy.zap.view.LayoutHelper; @SuppressWarnings("serial") @@ -59,11 +61,7 @@ public ClientMapPanel(ExtensionClientIntegration extension, ClientMap clientMap) this.setLayout(new GridBagLayout()); setName(Constant.messages.getString(ExtensionClientIntegration.PREFIX + ".tree.title")); - setIcon( - new ImageIcon( - ExtensionClientIntegration.class.getResource( - ExtensionClientIntegration.RESOURCES - + "/sitemap-application-blue.png"))); + setIcon(ExtensionClientIntegration.getIcon("sitemap-application-blue.png")); add( scrollPane, LayoutHelper.getGBC( diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientMapTreeCellRenderer.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientMapTreeCellRenderer.java similarity index 72% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ClientMapTreeCellRenderer.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientMapTreeCellRenderer.java index ba1b0ecfb8a..1b85053d74d 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientMapTreeCellRenderer.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientMapTreeCellRenderer.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.Component; import java.awt.FlowLayout; @@ -26,46 +26,30 @@ import javax.swing.JPanel; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; +import org.zaproxy.addon.client.ExtensionClientIntegration; +import org.zaproxy.addon.client.internal.ClientNode; +import org.zaproxy.addon.client.internal.ClientSideDetails; import org.zaproxy.zap.utils.DisplayUtils; import org.zaproxy.zap.view.OverlayIcon; public class ClientMapTreeCellRenderer extends DefaultTreeCellRenderer { private static final ImageIcon ROOT_ICON = - new ImageIcon( - ClientMapTreeCellRenderer.class.getResource( - ExtensionClientIntegration.RESOURCES - + "/sitemap-application-blue.png")); + ExtensionClientIntegration.getIcon("sitemap-application-blue.png"); private static final ImageIcon LEAF_ICON = - new ImageIcon( - ClientMapTreeCellRenderer.class.getResource( - ExtensionClientIntegration.RESOURCES + "/blue-document.png")); + ExtensionClientIntegration.getIcon("blue-document.png"); private static final ImageIcon LEAF_NOT_VISITED_ICON = - new ImageIcon( - ClientMapTreeCellRenderer.class.getResource( - ExtensionClientIntegration.RESOURCES + "/blue-document--minus.png")); + ExtensionClientIntegration.getIcon("blue-document--minus.png"); private static final ImageIcon FRAGMENT_ICON = - new ImageIcon( - ClientMapTreeCellRenderer.class.getResource( - ExtensionClientIntegration.RESOURCES + "/blue-document-number.png")); + ExtensionClientIntegration.getIcon("blue-document-number.png"); private static final ImageIcon FRAGMENT_NOT_VISITED_ICON = - new ImageIcon( - ClientMapTreeCellRenderer.class.getResource( - ExtensionClientIntegration.RESOURCES - + "/blue-document-number-minus.png")); + ExtensionClientIntegration.getIcon("blue-document-number-minus.png"); private static final ImageIcon FOLDER_OPEN_ICON = - new ImageIcon( - ClientMapTreeCellRenderer.class.getResource( - ExtensionClientIntegration.RESOURCES - + "/blue-folder-horizontal-open.png")); + ExtensionClientIntegration.getIcon("blue-folder-horizontal-open.png"); private static final ImageIcon FOLDER_CLOSED_ICON = - new ImageIcon( - ClientMapTreeCellRenderer.class.getResource( - ExtensionClientIntegration.RESOURCES + "/blue-folder-horizontal.png")); + ExtensionClientIntegration.getIcon("blue-folder-horizontal.png"); private static final ImageIcon DATABASE_ICON = - new ImageIcon( - ClientMapTreeCellRenderer.class.getResource( - ExtensionClientIntegration.RESOURCES + "/database.png")); + ExtensionClientIntegration.getIcon("database.png"); private static final long serialVersionUID = 1L; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientNodeDetailsPanel.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientNodeDetailsPanel.java similarity index 90% rename from addOns/client/src/main/java/org/zaproxy/addon/client/ClientNodeDetailsPanel.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientNodeDetailsPanel.java index 732b2e9d167..37b202ea998 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/ClientNodeDetailsPanel.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientNodeDetailsPanel.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.BorderLayout; import java.awt.Component; @@ -25,7 +25,6 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; @@ -33,6 +32,10 @@ import org.parosproxy.paros.Constant; import org.parosproxy.paros.extension.AbstractPanel; import org.parosproxy.paros.view.View; +import org.zaproxy.addon.client.ComponentTableModel; +import org.zaproxy.addon.client.ExtensionClientIntegration; +import org.zaproxy.addon.client.internal.ClientNode; +import org.zaproxy.addon.client.internal.ClientSideComponent; import org.zaproxy.zap.view.ZapTable; public class ClientNodeDetailsPanel extends AbstractPanel { @@ -51,11 +54,7 @@ public ClientNodeDetailsPanel() { this.setLayout(new BorderLayout()); setName(Constant.messages.getString(ExtensionClientIntegration.PREFIX + ".details.title")); - setIcon( - new ImageIcon( - ExtensionClientIntegration.class.getResource( - ExtensionClientIntegration.RESOURCES - + "/application-browser.png"))); + setIcon(ExtensionClientIntegration.getIcon("application-browser.png")); add(urlLabel, BorderLayout.NORTH); diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientAttack.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientAttack.java similarity index 96% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientAttack.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientAttack.java index 513f5d4fa61..2ce87ecc498 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientAttack.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientAttack.java @@ -17,13 +17,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.Component; import java.util.List; import javax.swing.JTree; import org.parosproxy.paros.Constant; import org.parosproxy.paros.extension.ExtensionPopupMenuItem; +import org.zaproxy.addon.client.internal.ClientNode; import org.zaproxy.zap.extension.ExtensionPopupMenu; public class PopupMenuClientAttack extends ExtensionPopupMenu { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientCopyUrls.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientCopyUrls.java similarity index 92% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientCopyUrls.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientCopyUrls.java index c7fac220169..fead24cb5e8 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientCopyUrls.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientCopyUrls.java @@ -17,10 +17,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.event.ActionEvent; import org.parosproxy.paros.Constant; +import org.zaproxy.addon.client.ClientUtils; +import org.zaproxy.addon.client.internal.ClientNode; public class PopupMenuClientCopyUrls extends PopupMenuItemClient { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientDelete.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientDelete.java similarity index 97% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientDelete.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientDelete.java index 0d7f23be9b0..9e6abe76555 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientDelete.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientDelete.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.event.ActionEvent; import javax.swing.JOptionPane; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientDetailsCopy.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientDetailsCopy.java similarity index 92% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientDetailsCopy.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientDetailsCopy.java index b5da062b9ab..e0d620a21cf 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientDetailsCopy.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientDetailsCopy.java @@ -17,10 +17,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.event.ActionEvent; import java.util.function.Function; +import org.zaproxy.addon.client.ClientUtils; +import org.zaproxy.addon.client.internal.ClientSideComponent; @SuppressWarnings("serial") public class PopupMenuClientDetailsCopy extends PopupMenuItemClientDetails { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientHistoryCopy.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientHistoryCopy.java similarity index 92% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientHistoryCopy.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientHistoryCopy.java index ad7b42bcfe4..c87f4638e21 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientHistoryCopy.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientHistoryCopy.java @@ -17,10 +17,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.event.ActionEvent; import java.util.function.Function; +import org.zaproxy.addon.client.ClientUtils; +import org.zaproxy.addon.client.internal.ReportedObject; @SuppressWarnings("serial") public class PopupMenuClientHistoryCopy extends PopupMenuItemClientHistory { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientOpenInBrowser.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientOpenInBrowser.java similarity index 97% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientOpenInBrowser.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientOpenInBrowser.java index 001220f86a5..ce5a1a084c9 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientOpenInBrowser.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientOpenInBrowser.java @@ -17,13 +17,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.Component; import java.util.List; import javax.swing.JTree; import org.parosproxy.paros.Constant; import org.parosproxy.paros.control.Control; +import org.zaproxy.addon.client.internal.ClientNode; import org.zaproxy.zap.extension.ExtensionPopupMenu; import org.zaproxy.zap.extension.selenium.Browser; import org.zaproxy.zap.extension.selenium.ExtensionSelenium; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientShowInSites.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientShowInSites.java similarity index 96% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientShowInSites.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientShowInSites.java index 1f99a90cb7f..bccc757c467 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientShowInSites.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuClientShowInSites.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.Component; import java.awt.event.ActionEvent; @@ -29,6 +29,7 @@ import org.parosproxy.paros.model.Model; import org.parosproxy.paros.model.SiteNode; import org.parosproxy.paros.view.View; +import org.zaproxy.addon.client.internal.ClientNode; public class PopupMenuClientShowInSites extends PopupMenuItemClient { diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClient.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClient.java similarity index 97% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClient.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClient.java index f72d00dd5f8..ba17c63ef35 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClient.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClient.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.Component; import java.awt.event.ActionEvent; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClientDetails.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClientDetails.java similarity index 98% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClientDetails.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClientDetails.java index 436d84d566a..363a2262e4a 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClientDetails.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClientDetails.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.Component; import java.awt.event.ActionEvent; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClientHistory.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClientHistory.java similarity index 97% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClientHistory.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClientHistory.java index 0bba56baa61..fff8d520754 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClientHistory.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClientHistory.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import java.awt.Component; import java.awt.event.ActionEvent; diff --git a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClientOpenInBrowser.java b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClientOpenInBrowser.java similarity index 98% rename from addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClientOpenInBrowser.java rename to addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClientOpenInBrowser.java index 50d8855bd61..9b035506856 100644 --- a/addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuItemClientOpenInBrowser.java +++ b/addOns/client/src/main/java/org/zaproxy/addon/client/ui/PopupMenuItemClientOpenInBrowser.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.ui; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/addOns/client/src/test/java/org/zaproxy/addon/client/MissingUrlsThreadUnitTest.java b/addOns/client/src/test/java/org/zaproxy/addon/client/MissingUrlsThreadUnitTest.java index d528db397a7..e2198becec7 100644 --- a/addOns/client/src/test/java/org/zaproxy/addon/client/MissingUrlsThreadUnitTest.java +++ b/addOns/client/src/test/java/org/zaproxy/addon/client/MissingUrlsThreadUnitTest.java @@ -34,6 +34,9 @@ import org.parosproxy.paros.model.SiteMap; import org.parosproxy.paros.model.SiteNode; import org.parosproxy.paros.network.HttpSender; +import org.zaproxy.addon.client.internal.ClientMap; +import org.zaproxy.addon.client.internal.ClientNode; +import org.zaproxy.addon.client.internal.ClientSideDetails; import org.zaproxy.zap.ZAP; import org.zaproxy.zap.eventBus.Event; import org.zaproxy.zap.eventBus.EventPublisher; diff --git a/addOns/client/src/test/java/org/zaproxy/addon/client/ClientMapUnitTest.java b/addOns/client/src/test/java/org/zaproxy/addon/client/internal/ClientMapUnitTest.java similarity index 99% rename from addOns/client/src/test/java/org/zaproxy/addon/client/ClientMapUnitTest.java rename to addOns/client/src/test/java/org/zaproxy/addon/client/internal/ClientMapUnitTest.java index 75663a1af2f..b69ec433b31 100644 --- a/addOns/client/src/test/java/org/zaproxy/addon/client/ClientMapUnitTest.java +++ b/addOns/client/src/test/java/org/zaproxy/addon/client/internal/ClientMapUnitTest.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.internal; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; diff --git a/addOns/client/src/test/java/org/zaproxy/addon/client/ClientNodeUnitTest.java b/addOns/client/src/test/java/org/zaproxy/addon/client/internal/ClientNodeUnitTest.java similarity index 99% rename from addOns/client/src/test/java/org/zaproxy/addon/client/ClientNodeUnitTest.java rename to addOns/client/src/test/java/org/zaproxy/addon/client/internal/ClientNodeUnitTest.java index 8f0c95a81db..b8deb81ae67 100644 --- a/addOns/client/src/test/java/org/zaproxy/addon/client/ClientNodeUnitTest.java +++ b/addOns/client/src/test/java/org/zaproxy/addon/client/internal/ClientNodeUnitTest.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.zaproxy.addon.client; +package org.zaproxy.addon.client.internal; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; diff --git a/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/InformationInStorageScanRuleUnitTest.java b/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/InformationInStorageScanRuleUnitTest.java index e34eec0a2f5..b8acaddf827 100644 --- a/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/InformationInStorageScanRuleUnitTest.java +++ b/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/InformationInStorageScanRuleUnitTest.java @@ -38,7 +38,7 @@ import org.mockito.ArgumentCaptor; import org.parosproxy.paros.core.scanner.Alert; import org.zaproxy.addon.client.ExtensionClientIntegration; -import org.zaproxy.addon.client.ReportedEvent; +import org.zaproxy.addon.client.internal.ReportedEvent; import org.zaproxy.zap.testutils.TestUtils; /** Unit test for {@link InformationInStorageScanRule}. */ diff --git a/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/JwtInStorageScanRuleUnitTest.java b/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/JwtInStorageScanRuleUnitTest.java index b13282e8082..386099dfbe8 100644 --- a/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/JwtInStorageScanRuleUnitTest.java +++ b/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/JwtInStorageScanRuleUnitTest.java @@ -35,7 +35,7 @@ import org.junit.jupiter.params.provider.ValueSource; import org.parosproxy.paros.core.scanner.Alert; import org.zaproxy.addon.client.ExtensionClientIntegration; -import org.zaproxy.addon.client.ReportedEvent; +import org.zaproxy.addon.client.internal.ReportedEvent; import org.zaproxy.zap.testutils.TestUtils; /** Unit test for {@link JwtInStorageScanRule}. */ diff --git a/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/SensitiveInfoInStorageScanRuleUnitTest.java b/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/SensitiveInfoInStorageScanRuleUnitTest.java index 05e4050f73c..b1d4cd74375 100644 --- a/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/SensitiveInfoInStorageScanRuleUnitTest.java +++ b/addOns/client/src/test/java/org/zaproxy/addon/client/pscan/SensitiveInfoInStorageScanRuleUnitTest.java @@ -39,7 +39,7 @@ import org.mockito.ArgumentCaptor; import org.parosproxy.paros.core.scanner.Alert; import org.zaproxy.addon.client.ExtensionClientIntegration; -import org.zaproxy.addon.client.ReportedEvent; +import org.zaproxy.addon.client.internal.ReportedEvent; import org.zaproxy.zap.testutils.TestUtils; /** Unit test for {@link SensitiveInfoInStorageScanRule}. */ diff --git a/addOns/client/src/test/java/org/zaproxy/addon/client/spider/ClientSpiderUnitTest.java b/addOns/client/src/test/java/org/zaproxy/addon/client/spider/ClientSpiderUnitTest.java index 4bdc1ef759f..a47e71ba587 100644 --- a/addOns/client/src/test/java/org/zaproxy/addon/client/spider/ClientSpiderUnitTest.java +++ b/addOns/client/src/test/java/org/zaproxy/addon/client/spider/ClientSpiderUnitTest.java @@ -44,11 +44,11 @@ import org.parosproxy.paros.extension.ExtensionLoader; import org.parosproxy.paros.model.Model; import org.parosproxy.paros.model.Session; -import org.zaproxy.addon.client.ClientMap; -import org.zaproxy.addon.client.ClientNode; import org.zaproxy.addon.client.ClientOptions; -import org.zaproxy.addon.client.ClientSideDetails; import org.zaproxy.addon.client.ExtensionClientIntegration; +import org.zaproxy.addon.client.internal.ClientMap; +import org.zaproxy.addon.client.internal.ClientNode; +import org.zaproxy.addon.client.internal.ClientSideDetails; import org.zaproxy.zap.ZAP; import org.zaproxy.zap.extension.selenium.ExtensionSelenium; import org.zaproxy.zap.utils.ZapXmlConfiguration; @@ -277,12 +277,11 @@ void shouldVisitKnownUnvisitedUrls() { when(options.timeouts()).thenReturn(timeouts); ArgumentCaptor argument = ArgumentCaptor.forClass(String.class); - ClientNode exampleTopNode = getClientNode("https://www.example.com"); - ClientNode exampleSlashNode = getClientNode("https://www.example.com/"); - ClientNode exampleTest1Node = getClientNode("https://www.example.com/test#1"); - ClientNode exampleTest2Node = getClientNode("https://www.example.com/test#2"); - ClientNode exampleVisitedNode = getClientNode("https://www.example.com/visited"); - exampleVisitedNode.getUserObject().setVisited(true); + ClientNode exampleTopNode = getClientNode("https://www.example.com", false); + ClientNode exampleSlashNode = getClientNode("https://www.example.com/", false); + ClientNode exampleTest1Node = getClientNode("https://www.example.com/test#1", false); + ClientNode exampleTest2Node = getClientNode("https://www.example.com/test#2", false); + ClientNode exampleVisitedNode = getClientNode("https://www.example.com/visited", true); exampleTopNode.add(exampleSlashNode); exampleTopNode.add(exampleTest1Node); exampleTopNode.add(exampleTest2Node); @@ -312,8 +311,8 @@ void shouldVisitKnownUnvisitedUrls() { "https://www.example.com/test#2")); } - private ClientNode getClientNode(String url) { - return new ClientNode(new ClientSideDetails(url, url, false, false), false); + private ClientNode getClientNode(String url, boolean visited) { + return new ClientNode(new ClientSideDetails(url, url, visited, false), false); } class SpiderStatus {