Skip to content

Commit

Permalink
Change default step names.
Browse files Browse the repository at this point in the history
  • Loading branch information
CoreyD97 committed Aug 13, 2019
1 parent 1f7f5a2 commit 972d720
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
24 changes: 20 additions & 4 deletions src/main/java/com/coreyd97/stepper/Step.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,30 @@ public class Step implements IMessageEditorController, IStepVariableListener {
private byte[] responseBody;

public Step(){
this.title = "Unnamed Step";
this.variables = new Vector<>();
this.variableListeners = new ArrayList<>();
this.requestResponseListeners = new ArrayList<>();
this.httpService = Stepper.callbacks.getHelpers().buildHttpService("MATCHHACK." + Math.random(), 1234, false);
this.requestBody = new byte[0];
this.responseBody = new byte[0];
}

public Step(StepSequence sequence, String title){
this();
this.sequence = sequence;
if(title != null) {
this.title = title;
}else{
this.title = "Step " + (sequence.getSteps().size()+1);
}

this.httpService = Stepper.callbacks.getHelpers().buildHttpService("MATCHHACK." + Math.random() + ".coreyd97.com", 1234, false);
this.hostname = "HOSTNAME";
this.port = 443;
this.isSSL = true;
this.requestBody = new byte[0];
this.responseBody = new byte[0];
}

public Step(StepSequence sequence){
this(sequence, null);
}

public void setSequence(StepSequence sequence) {
Expand Down Expand Up @@ -248,6 +262,8 @@ public boolean isReadyToExecute(){
}

public void setHttpService(IHttpService httpService) {
//Don't actually set the HTTP Service, but store the individual components
//We can then rebuild it once the matchhack has been completed.
this.hostname = httpService.getHost();
this.port = httpService.getPort();
this.isSSL = httpService.getProtocol().equalsIgnoreCase("https");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/coreyd97/stepper/StepSequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void addStep(Step step){
}

public void addStep(){
this.addStep(new Step());
this.addStep(new Step(this));
}

public Vector<Step> getSteps() {
Expand Down Expand Up @@ -145,7 +145,7 @@ public HashMap<String, StepVariable> getRollingVariables(Step uptoStep){
}

public void addStep(IHttpRequestResponse requestResponse) {
Step step = new Step();
Step step = new Step(this);
step.setRequestBody(requestResponse.getRequest());
step.setResponseBody(requestResponse.getResponse());
step.setHttpService(requestResponse.getHttpService());
Expand Down

0 comments on commit 972d720

Please sign in to comment.