Search in sources :

Example 51 with ZapXmlConfiguration

use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.

the class VariantFactoryUnitTest method shouldReturnNoVariantsWhenUnset.

@Test
void shouldReturnNoVariantsWhenUnset() {
    // Given
    ScannerParam scanOptions = Mockito.mock(ScannerParam.class, withSettings().lenient());
    Mockito.when(scanOptions.getConfig()).thenReturn(new ZapXmlConfiguration());
    HttpMessage message = new HttpMessage();
    scanOptions.setTargetParamsInjectable(0);
    // When
    List<Variant> variants = factory.createVariants(scanOptions, message);
    // Then
    assertThat(variants.size(), is(equalTo(0)));
}
Also used : Variant(org.parosproxy.paros.core.scanner.Variant) ScannerParam(org.parosproxy.paros.core.scanner.ScannerParam) ZapXmlConfiguration(org.zaproxy.zap.utils.ZapXmlConfiguration) HttpMessage(org.parosproxy.paros.network.HttpMessage) Test(org.junit.jupiter.api.Test) WithConfigsTest(org.zaproxy.zap.WithConfigsTest) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 52 with ZapXmlConfiguration

use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.

the class AddOnUnitTest method shouldNotDependOnItSelf.

@Test
void shouldNotDependOnItSelf() throws Exception {
    // Given
    ZapXmlConfiguration zapVersionsXml = createZapVersionsXml();
    AddOn addOn = createAddOn("AddOn1", zapVersionsXml);
    AddOn sameAddOn = createAddOn("AddOn1", zapVersionsXml);
    // When
    boolean depends = addOn.dependsOn(sameAddOn);
    // Then
    assertThat(depends, is(equalTo(false)));
}
Also used : ZapXmlConfiguration(org.zaproxy.zap.utils.ZapXmlConfiguration) Test(org.junit.jupiter.api.Test)

Example 53 with ZapXmlConfiguration

use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.

the class AddOnUnitTest method shouldDependOnDependency.

@Test
void shouldDependOnDependency() throws Exception {
    // Given
    ZapXmlConfiguration zapVersionsXml = createZapVersionsXml();
    AddOn addOn = createAddOn("AddOn1", zapVersionsXml);
    AddOn dependency = createAddOn("AddOn3", zapVersionsXml);
    // When
    boolean depends = addOn.dependsOn(dependency);
    // Then
    assertThat(depends, is(equalTo(true)));
}
Also used : ZapXmlConfiguration(org.zaproxy.zap.utils.ZapXmlConfiguration) Test(org.junit.jupiter.api.Test)

Example 54 with ZapXmlConfiguration

use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.

the class AddOnUnitTest method shouldNotDirectlyDependOnNonDirectDependency.

@Test
void shouldNotDirectlyDependOnNonDirectDependency() throws Exception {
    // Given
    ZapXmlConfiguration zapVersionsXml = createZapVersionsXml();
    AddOn addOn = createAddOn("AddOn1", zapVersionsXml);
    AddOn nonDirectDependency = createAddOn("AddOn8", zapVersionsXml);
    // When
    boolean depends = addOn.dependsOn(nonDirectDependency);
    // Then
    assertThat(depends, is(equalTo(false)));
}
Also used : ZapXmlConfiguration(org.zaproxy.zap.utils.ZapXmlConfiguration) Test(org.junit.jupiter.api.Test)

Example 55 with ZapXmlConfiguration

use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.

the class AddOnUnitTest method shouldDependOnDependencies.

@Test
void shouldDependOnDependencies() throws Exception {
    // Given
    ZapXmlConfiguration zapVersionsXml = createZapVersionsXml();
    AddOn addOn = createAddOn("AddOn1", zapVersionsXml);
    AddOn nonDependency = createAddOn("AddOn9", zapVersionsXml);
    AddOn dependency = createAddOn("AddOn3", zapVersionsXml);
    Collection<AddOn> addOns = Arrays.asList(new AddOn[] { nonDependency, dependency });
    // When
    boolean depends = addOn.dependsOn(addOns);
    // Then
    assertThat(depends, is(equalTo(true)));
}
Also used : ZapXmlConfiguration(org.zaproxy.zap.utils.ZapXmlConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

ZapXmlConfiguration (org.zaproxy.zap.utils.ZapXmlConfiguration)82 Test (org.junit.jupiter.api.Test)37 Configuration (org.apache.commons.configuration.Configuration)19 WithConfigsTest (org.zaproxy.zap.WithConfigsTest)18 Context (org.zaproxy.zap.model.Context)17 ConfigurationException (org.apache.commons.configuration.ConfigurationException)15 File (java.io.File)11 IOException (java.io.IOException)9 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 ConversionException (org.apache.commons.configuration.ConversionException)6 XMLConfiguration (org.apache.commons.configuration.XMLConfiguration)5 InvalidParameterException (java.security.InvalidParameterException)4 HttpMessage (org.parosproxy.paros.network.HttpMessage)4 MalformedURLException (java.net.MalformedURLException)3 Path (java.nio.file.Path)3 ParseException (java.text.ParseException)3 ArrayList (java.util.ArrayList)3 Locale (java.util.Locale)3 NoSuchElementException (java.util.NoSuchElementException)3 URI (org.apache.commons.httpclient.URI)3