public abstract class AbstractSampleProgram
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
AbstractSampleProgram.SampleResponseConsumer<T extends Response<?>>
Response consumer for the requests send by the AbstractSampleProgram
|
Constructor and Description |
---|
AbstractSampleProgram()
Constructor takes care of retrieving spring beans
|
Modifier and Type | Method and Description |
---|---|
Payload |
createDefaultPayLoad(UsageRequestBuilder usageRequestBuilder,
java.lang.String version,
java.lang.String productType,
java.lang.String eventType,
Usage requestType,
java.lang.String calledIdStr)
Creates default payload for usage request based on required blocks.
|
BatchRequestService |
getBatchRequestService()
Get the BatchRequestService
|
org.springframework.context.support.ClassPathXmlApplicationContext |
getContext()
Get the Spring context
|
oracle.communication.brm.charging.messages.update.ExternalTopUpUpdateRequestBuilderFactory |
getExternalTopUpUpdateRequestBuilderFactory()
Get the ExternalTopUpUpdateRequestBuilderFactory
|
static Logger |
getLogger() |
ManagementRequestBuilderFactory |
getManagementRequestBuilderFactory()
Get the Management RequestBuilderFactory
|
int |
getNResponsesReceived()
Get the number of responses received so far
|
PolicyRequestBuilderFactory |
getPolicyRequestBuilderFactory()
Get the PolicyRequestBuilderFactory
|
QueryRequestBuilderFactory |
getQueryRequestBuilderFactory()
Get the Query RequestBuilderFactory
|
java.util.List<Response> |
getResponsesReceived()
Get the responses received so far
|
ServiceSpecRepository |
getServiceSpecRepository()
Get the ServiceSpecRepository, needed for building requests
|
static java.lang.String |
getStackTrace(java.lang.Throwable aThrowable)
Stack trace formatting
|
oracle.communication.brm.charging.statemanager.StateManager |
getStateManager()
Get the StateManager
|
oracle.communication.brm.charging.messages.update.UpdateRequestBuilderFactory |
getUpdateRequestBuilderFactory()
Get the Update RequestBuilderFactory
|
UsageRequestBuilderFactory |
getUsageRequestBuilderFactory()
Get the Usage RequestBuilderFactory
|
void |
resetResponsesReceived()
Clear the list of responses received
|
protected void |
run()
Main run method that should be called in the main of all sample programs
|
protected abstract void |
runSample()
To be implemented by each sample program for specific scenario
|
void |
sendAsynchronousRequest(Request request,
boolean resubmit)
Send a single request
|
Response |
sendRequest(Request request,
boolean resubmit)
Send a single request, wait for a response and return this response.
|
protected <T extends Request> |
sendRequests(java.util.List<T> requests,
boolean resubmit,
long delay)
Sends an array of requests, with a delay between them, waits for the responses to arrive
|
UpdateResponse |
sendUpdateRequest(Request request,
boolean resubmit)
Send an update request synchronously
|
java.util.List<UpdateResponse> |
sendUpdateRequests(java.util.List<UpdateRequest> requests,
boolean resubmit)
Submit a batch of update requests synchronously
|
void |
waitForResponses(int nResponses)
Wait until nResponses have been received
|
public AbstractSampleProgram()
public oracle.communication.brm.charging.statemanager.StateManager getStateManager()
public UsageRequestBuilderFactory getUsageRequestBuilderFactory()
public oracle.communication.brm.charging.messages.update.UpdateRequestBuilderFactory getUpdateRequestBuilderFactory()
public oracle.communication.brm.charging.messages.update.ExternalTopUpUpdateRequestBuilderFactory getExternalTopUpUpdateRequestBuilderFactory()
public QueryRequestBuilderFactory getQueryRequestBuilderFactory()
public ManagementRequestBuilderFactory getManagementRequestBuilderFactory()
public PolicyRequestBuilderFactory getPolicyRequestBuilderFactory()
public BatchRequestService getBatchRequestService()
public org.springframework.context.support.ClassPathXmlApplicationContext getContext()
public ServiceSpecRepository getServiceSpecRepository()
public java.util.List<Response> getResponsesReceived()
public int getNResponsesReceived()
public void resetResponsesReceived()
protected <T extends Request> void sendRequests(java.util.List<T> requests, boolean resubmit, long delay) throws MessagesException, SystemHealthException, java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException, UserNotFoundException
T
- request of a specific typerequests
- array of requests to sendresubmit
- to resubmit or notdelay
- delay im ms to wait between 2 asynchronous requestsMessagesUsageException
- if something goes wrongMessagesException
- something wrong with the messageSystemHealthException
- unknown exceptionjava.lang.InterruptedException
- process is interruptedjava.util.concurrent.ExecutionException
- something wrong with the execution of the requestjava.util.concurrent.TimeoutException
- process takes too longUserNotFoundException
public void waitForResponses(int nResponses)
nResponses
- number of responses that must be received before the method returnspublic void sendAsynchronousRequest(Request request, boolean resubmit) throws MessagesException, SystemHealthException, UserNotFoundException
request
- request to send (should be of type UsageRequest, UpdateRequest or QueryRequest)resubmit
- to resubmit or notMessagesException
- something wrong with the messageSystemHealthException
- other exceptionUserNotFoundException
public Response sendRequest(Request request, boolean resubmit) throws MessagesException, SystemHealthException, java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException, UserNotFoundException
request
- request to sendresubmit
- to resubmit or notMessagesException
- something wrong with the messageSystemHealthException
- unknown exceptionjava.lang.InterruptedException
- process is interruptedjava.util.concurrent.ExecutionException
- something wrong with the execution of the requestjava.util.concurrent.TimeoutException
- process takes too longUserNotFoundException
public UpdateResponse sendUpdateRequest(Request request, boolean resubmit) throws MessagesException, java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException, UserNotFoundException
request
- update requestresubmit
- flagMessagesException
- something wrong with the messagejava.lang.InterruptedException
- process is interruptedjava.util.concurrent.ExecutionException
- something wrong with the execution of the requestjava.util.concurrent.TimeoutException
- process takes too longUserNotFoundException
public java.util.List<UpdateResponse> sendUpdateRequests(java.util.List<UpdateRequest> requests, boolean resubmit) throws MessagesException, java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException, UserNotFoundException
requests
- update requestsresubmit
- resubmit flagMessagesException
- if envelope creation goes wrongjava.lang.InterruptedException
- process is interruptedjava.util.concurrent.ExecutionException
- something wrong with the execution of the requestjava.util.concurrent.TimeoutException
- process takes too longUserNotFoundException
protected abstract void runSample() throws java.lang.Exception
java.lang.Exception
- if something goes wrong in the scenario!protected final void run()
public static Logger getLogger()
public Payload createDefaultPayLoad(UsageRequestBuilder usageRequestBuilder, java.lang.String version, java.lang.String productType, java.lang.String eventType, Usage requestType, java.lang.String calledIdStr)
usageRequestBuilder,
- String version, String productType, UsageRequestBuilderpublic static java.lang.String getStackTrace(java.lang.Throwable aThrowable)
aThrowable
- Exception