-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90242ff
commit 6eab79a
Showing
36 changed files
with
833 additions
and
134 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
83 changes: 83 additions & 0 deletions
83
FlashCards_DTO/src/main/java/org/robbins/flashcards/dto/BulkLoadingReceiptDto.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
|
||
package org.robbins.flashcards.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(value = Include.NON_NULL) | ||
@XmlRootElement(name = "bulkloadingreceipt") | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
public class BulkLoadingReceiptDto extends AbstractAuditableDto implements Serializable { | ||
|
||
private String type; | ||
private int successCount; | ||
private int failureCount; | ||
private Date startTime; | ||
private Date endTime; | ||
|
||
public BulkLoadingReceiptDto() { | ||
} | ||
|
||
public BulkLoadingReceiptDto(final String id) { | ||
setId(id); | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public int getSuccessCount() { | ||
return successCount; | ||
} | ||
|
||
public void setSuccessCount(int successCount) { | ||
this.successCount = successCount; | ||
} | ||
|
||
public int getFailureCount() { | ||
return failureCount; | ||
} | ||
|
||
public void setFailureCount(int failureCount) { | ||
this.failureCount = failureCount; | ||
} | ||
|
||
public Date getStartTime() { | ||
return startTime; | ||
} | ||
|
||
public void setStartTime(Date startTime) { | ||
this.startTime = startTime; | ||
} | ||
|
||
public Date getEndTime() { | ||
return endTime; | ||
} | ||
|
||
public void setEndTime(Date endTime) { | ||
this.endTime = endTime; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "BulkLoadingReceiptDto{" + | ||
"type='" + type + '\'' + | ||
", successCount=" + successCount + | ||
", failureCount=" + failureCount + | ||
", startTime=" + startTime + | ||
", endTime=" + endTime + | ||
'}'; | ||
} | ||
} |
This file contains 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
This file contains 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
57 changes: 57 additions & 0 deletions
57
FlashCards_Load_Tester/src/main/java/org/robbins/load/tester/actor/BatchLoadTester.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.robbins.load.tester.actor; | ||
|
||
import akka.actor.AbstractActor; | ||
import akka.actor.ActorRef; | ||
import akka.actor.Props; | ||
import akka.japi.pf.ReceiveBuilder; | ||
import org.robbins.flashcards.client.TagClient; | ||
import org.robbins.flashcards.dto.BulkLoadingReceiptDto; | ||
import org.robbins.flashcards.dto.TagDto; | ||
import org.robbins.flashcards.exceptions.FlashcardsException; | ||
import org.robbins.load.tester.message.BatchTestResult; | ||
import org.robbins.load.tester.message.BatchTestStart; | ||
import org.robbins.load.tester.message.SingleTestResult; | ||
import org.robbins.load.tester.message.TestStart; | ||
import org.robbins.load.tester.util.LoadingTestingUtil; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.util.StopWatch; | ||
import scala.PartialFunction; | ||
import scala.runtime.BoxedUnit; | ||
|
||
import java.util.UUID; | ||
|
||
public class BatchLoadTester extends AbstractActor { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(BatchLoadTester.class); | ||
|
||
private final TagClient tagClient; | ||
|
||
public BatchLoadTester(final TagClient tagClient) { | ||
LOGGER.debug("Creating BatchLoadTester"); | ||
|
||
this.tagClient = tagClient; | ||
} | ||
|
||
public static Props props(final TagClient tagClient) { | ||
return Props.create(BatchLoadTester.class, () -> new BatchLoadTester(tagClient)); | ||
} | ||
|
||
@Override | ||
public PartialFunction<Object, BoxedUnit> receive() { | ||
return ReceiveBuilder | ||
.match(BatchTestStart.class, startLoadTest -> doLoadTest(startLoadTest, sender())) | ||
.matchAny(o -> LOGGER.error("Received Unknown message")) | ||
.build(); | ||
} | ||
|
||
private void doLoadTest(final BatchTestStart testStartMessage, final ActorRef sender) { | ||
LOGGER.debug("Received BatchTestStart message: {}", testStartMessage.toString()); | ||
|
||
final BulkLoadingReceiptDto receipt = tagClient.save(testStartMessage.getBatch()); | ||
final BatchTestResult testResult = new BatchTestResult(testStartMessage.getEndPointName(), receipt); | ||
|
||
LOGGER.debug("Sending BatchTestResult message: {}", testResult.toString()); | ||
sender.tell(testResult, self()); | ||
} | ||
} |
This file contains 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
Oops, something went wrong.