Skip to content

Instantly share code, notes, and snippets.

@minisu
minisu / gist:9208783
Created February 25, 2014 13:34
Jsoup extracting all links from loadui.org home page.
Fetching http://www.loadui.org...
Media: (82)
* script: <http://www.loadui.org/media/system/js/mootools.js>
* script: <http://www.loadui.org/media/system/js/caption.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shCore.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shBrushGroovy.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shBrushJava.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shBrushPlain.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shBrushSql.js>
Media:
* script: <http://www.loadui.org/media/system/js/mootools.js>
* script: <http://www.loadui.org/media/system/js/caption.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shCore.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shBrushGroovy.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shBrushJava.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shBrushPlain.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shBrushSql.js>
* script: <http://www.loadui.org/plugins/content/syntaxhighlighter/scripts/shBrushXml.js>
* script: <http://www.loadui.org/modules/mod_rokajaxsearch/js/rokajaxsearch.js>
@Test
public void shouldSendRequests() throws Exception
{
Multiset<String> expectedRequests = ImmutableMultiset.of(
"GET http://www.example.org/image1.png",
"GET http://www.example.org/style.css"
);
// WHEN
triggerAndWait();
@Before
public void setup() throws ComponentCreationException, IOException
{
ctu = new ComponentTestUtils();
ctu.getDefaultBeanInjectorMocker();
component = ctu.createComponentItem();
ComponentContext contextSpy = spy( component.getContext() );
ctu.mockStatisticsFor( component, contextSpy );
package com.smartbear.saas.rs.storage;
import com.smartbear.saas.rs.model.TestRun;
import java.util.Optional;
import java.util.Set;
public interface TestRunStorage
{
Optional<TestRun> getTest( String customerId, String testId );
@minisu
minisu / new.java
Last active August 29, 2015 13:58
@GET
@Path( "/{test}/assets" )
@ApiOperation(value = "Returns all assets in a test run")
@ApiResponses(value = {
@ApiResponse(code = 404, message = "No test with given ID"),
})
public String assets( @Auth User user, @PathParam( "test" ) String testId, @QueryParam( "scenario" ) String scenario )
{
TestRun testRun = testRunStorage.getTestRun( testId, user.getId() )
.orElseThrow( () -> new WebApplicationException( NOT_FOUND );
@Test
public void startingAndFetch()
{
ClientResponse response = resources.client().resource( ENDPOINT )
.type( MediaType.APPLICATION_JSON )
.header( HttpHeaders.AUTHORIZATION, "Bearer DUMMYTOKEN" )
.post( ClientResponse.class, dummyJson );
assertThat( response.getStatus(), is( 201 ) );
TestRun testRun = resources.client().resource( response.getLocation() )
@Test
public void accessingNonExistentTest_should_fail()
{
asList( "", "/assets", "/live-tabular-stats" )
.forEach( this::assertPathYields404 );
}
private void assertPathYields404( String path )
{
ClientResponse response = R.client().resource( ENDPOINT + "/"+ nonExistentId + path )
/**
* Manages statistic updates for a Runner in a load test.
*/
public class WebRunnerStatsSender
{
private final Map<String, VariableGroup> resourceToVariableGroup = new HashMap<>();
private final Clock clock;
public WebRunnerStatsSender( Clock clock )
{
/**
* Manages statistic updates for a Runner in a load test.
*/
public class WebRunnerStatsSender
{
private final Map<String, VariableGroup> resourceToVariableGroup = new HashMap<>();
private final Clock clock;
public WebRunnerStatsSender( Clock clock )
{