This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package simulation | |
import io.gatling.core.Predef.Simulation | |
import io.gatling.core.body.{Body, ByteArrayBody, CompositeByteArrayBody, InputStreamBody, PebbleBody, RawFileBody, ResourceAndCachedBytes, StringBody} | |
import io.gatling.core.config.GatlingConfiguration | |
abstract class ConfigurableSimulation extends Simulation { | |
def processPayload(implicit configuration: GatlingConfiguration) : Body => StringBody = | |
(body: Body) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<String> consumer(String topic) { | |
List<String> events = new ArrayList<>(); | |
List<PartitionInfo> partitionInfos = null; | |
List<TopicPartition> partitions = new ArrayList<>(); | |
partitionInfos = consumer.partitionsFor(topic); | |
if (partitionInfos != null) { | |
for (PartitionInfo partition : partitionInfos) | |
partitions.add(new TopicPartition(partition.topic(), | |
partition.partition())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task uberJar(type: Jar) { | |
manifest { | |
attributes 'Main-Class': 'main.RunTest' | |
} | |
dependsOn configurations.runtimeClasspath | |
from sourceSets.main.output | |
from sourceSets.test.output | |
from sourceSets.main.resources | |
from sourceSets.test.resources | |
from { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void recursiveNode(JsonNode node) { | |
Iterator<Map.Entry<String, JsonNode>> it = node.fields(); | |
if (node.isTextual() & node.toString().contains("sample")) { | |
System.out.println(node.toString()); | |
} | |
while (it.hasNext()) { | |
JsonNode temp = it.next().getValue(); | |
recursiveNode(temp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Calculator { | |
private var a = 0 | |
private var b = 0 | |
fun printResult() { | |
println(a + b) | |
} | |
fun firstNumber(a: Int) { | |
this.a = a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Performs port scan using nmap | |
print_usage() { | |
cat << _EOF_ | |
Utility to scan open ports. Can be used to scan ports for a domain or a list of domains specified in a file. | |
Example Usage: | |
-h, --help Show brief help | |
-d, --domain Domain name or ip to scan | |
-f, --file Spefify a file containing domains/IPs to scan |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach ($i in 1..50) {$create_group = New-ADGroup -Name Group+$i -GroupCategory Security -groupScope Global -Path "OU=<myOU>,DC=<myDC>,DC=<myDC>"} | |
foreach ($i in 1..100) {$create_user = New-ADUser -Name ("User" +$i+ " Test") -GivenName ("User" + $i) -Surname Test -AccountPassword (ConvertTo-SecureString -AsPlainText "<password>" -Force) -Path "OU=<myOU>,DC=<myDC>,DC=<myDC>" -PassThru | Enable-ADAccount} | |
foreach($i in 1..50) {Add-ADGroupMember -Identity ("Group-" + $i) -Members ("User" + $i)} | |
foreach ($i in 1..10) {$create_user = New-ADUser -Name ("user" +$i+ " Test") -GivenName ("user" + $i) -Surname Test -AccountPassword (ConvertTo-SecureString -AsPlainText "<password>" -Force) -PasswordNeverExpires $true -EmailAddress ("user" + $i+ "@test.local") -MobilePhone ($i+234) -Path "OU=<myOU>,DC=<myDC>,DC=<myDC>" -PassThru | Enable-ADAccount} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sometime it happens while automating the angular app, view gets loaded entirely but performing any action | |
* on that view fails the test. This could happen because angular $http calls are still pending in backend. | |
* We can have explicit wait in this way to ensure that angular has made all the $http calls. | |
* Wait until angular finishes the $http calls while loading the view | |
*/ | |
public void waitForAngular() { | |
final String javaScriptToLoadAngular = | |
"var injector = window.angular.element('body').injector();" + | |
"var $http = injector.get('$http');" + |