diff options
author | waynedunican <wayne.dunican@est.tech> | 2024-05-27 16:29:18 +0100 |
---|---|---|
committer | waynedunican <wayne.dunican@est.tech> | 2024-05-27 16:41:01 +0100 |
commit | fbe47369f95b3154c879026a196d5b5259e5f130 (patch) | |
tree | f71521eaf5992dacd870550c57b789aad671eebe /testsuites/performance/performance-benchmark-test/src | |
parent | 6d30b77d61c1a8e34eabb846d9277b87884ff4ea (diff) |
Update to Apex jmx files
Issue-ID: POLICY-4977
Change-Id: If2aad259007ed3cf84aea4f7ad99ea7fbe379a69
Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'testsuites/performance/performance-benchmark-test/src')
-rw-r--r-- | testsuites/performance/performance-benchmark-test/src/main/resources/apexPdpPerformanceTestPlan.jmx | 1784 |
1 files changed, 543 insertions, 1241 deletions
diff --git a/testsuites/performance/performance-benchmark-test/src/main/resources/apexPdpPerformanceTestPlan.jmx b/testsuites/performance/performance-benchmark-test/src/main/resources/apexPdpPerformanceTestPlan.jmx index bb6870d17..681becf1e 100644 --- a/testsuites/performance/performance-benchmark-test/src/main/resources/apexPdpPerformanceTestPlan.jmx +++ b/testsuites/performance/performance-benchmark-test/src/main/resources/apexPdpPerformanceTestPlan.jmx @@ -22,15 +22,13 @@ --> <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3"> <hashTree> - <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="APEX PDP PERFORMANCE TEST PLAN" enabled="true"> - <stringProp name="TestPlan.comments"></stringProp> - <boolProp name="TestPlan.functional_mode">false</boolProp> - <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp> + <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="APEX PDP PERFORMANCE TEST PLAN"> <boolProp name="TestPlan.serialize_threadgroups">true</boolProp> - <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> + <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp> + <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> <collectionProp name="Arguments.arguments"/> </elementProp> - <stringProp name="TestPlan.user_define_classpath"></stringProp> + <boolProp name="TestPlan.functional_mode">false</boolProp> </TestPlan> <hashTree> <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager"> @@ -46,7 +44,7 @@ </collectionProp> </HeaderManager> <hashTree/> - <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="false"> + <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true"> <stringProp name="HTTPSampler.port">23324</stringProp> <stringProp name="HTTPSampler.protocol">http</stringProp> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> @@ -55,7 +53,7 @@ <stringProp name="HTTPSampler.implementation"></stringProp> </ConfigTestElement> <hashTree/> - <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> + <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> <collectionProp name="Arguments.arguments"> <elementProp name="threads" elementType="Argument"> <stringProp name="Argument.name">threads</stringProp> @@ -90,7 +88,7 @@ </elementProp> <elementProp name="KAFKA_PORT" elementType="Argument"> <stringProp name="Argument.name">KAFKA_PORT</stringProp> - <stringProp name="Argument.value">${__P(KAFKA_PORT,29092)}</stringProp> + <stringProp name="Argument.value">${__P(KAFKA_PORT,9092)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="CDS_PORT" elementType="Argument"> @@ -105,7 +103,7 @@ </elementProp> <elementProp name="LOG_PATH" elementType="Argument"> <stringProp name="Argument.name">LOG_PATH</stringProp> - <stringProp name="Argument.value">${__P(LOG_PATH,/jmeter_results/apex_perf)}</stringProp> + <stringProp name="Argument.value">${__P(LOG_PATH,/jmeter_results/apex_stability)}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="KAFKA_HOST" elementType="Argument"> @@ -116,7 +114,7 @@ </collectionProp> </Arguments> <hashTree/> - <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true"> + <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager"> <collectionProp name="AuthManager.auth_list"> <elementProp name="" elementType="Authorization"> <stringProp name="Authorization.url">http://${HOSTNAME}:${API_PORT}</stringProp> @@ -157,7 +155,7 @@ <boolProp name="AuthManager.controlledByThreadGroup">false</boolProp> </AuthManager> <hashTree/> - <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="setUp Thread Group" enabled="true"> + <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="setUp Thread Group"> <intProp name="ThreadGroup.num_threads">1</intProp> <intProp name="ThreadGroup.ramp_time">1</intProp> <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> @@ -168,7 +166,7 @@ </elementProp> </SetupThreadGroup> <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CreatePolicy-ApexExample"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CreatePolicy-ApexExample" enabled="true"> <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp> <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> @@ -3234,146 +3232,42 @@ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.kafka.KafkaCarrierTechnologyParameters",
 "parameters": {
 "bootstrapServers": "kafka:9092",
 - "groupId": "apex-grp2",
 + "groupId": "apex-group",
 "enableAutoCommit": true,
 - "autoCommitTime": 1000,
 - "sessionTimeout": 30000,
 - "consumerPollTime": 100,
 - "consumerTopicList": [
 - "unauthenticated.dcae_cl_output"
 - ],
 - "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
 - "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
 - "kafkaProperties": [
 -
 - ]
 + "autoCommitTime": 1000,
 + "sessionTimeout": 30000,
 + "consumerPollTime": 100,
 + "consumerTopicList": ["unauthenticated.dcae_policy_example_output"],
 + "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
 + "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer"
 }
 },
 "eventProtocolParameters": {
 "eventProtocol": "JSON"
 },
 "eventName": "ApexExample_VesEvent"
 - },
 - "ApexExample_AAIResponseConsumer": {
 - "carrierTechnologyParameters": {
 - "carrierTechnology": "RESTREQUESTOR",
 - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters",
 - "parameters": {
 - "url": "https://aai:8443/aai/v14/network/generic-vnfs/generic-vnf?vnf-name={vnf-name}",
 - "httpMethod": "GET",
 - "httpCodeFilter": "[245][0-9][0-9]",
 - "httpHeaders": [
 - [
 - "Accept",
 - "application/json"
 - ],
 - [
 - "Content-Type",
 - "application/json"
 - ],
 - [
 - "X-FromAppId",
 - "dcae-curl"
 - ],
 - [
 - "x-transactionId",
 - "9998"
 - ],
 - [
 - "Authorization",
 - "Basic QUFJOkFBSQ=="
 - ]
 - ]
 - }
 - },
 - "eventProtocolParameters": {
 - "eventProtocol": "JSON"
 - },
 - "eventName": "ApexExample_AAISuccessResponseEvent|ApexExample_AAIFailureResponseEvent",
 - "requestorMode": true,
 - "requestorPeer": "ApexExample_AAIProducer",
 - "requestorTimeout": 2000
 - },
 - "ApexExample_CDSConfigModifyResponseConsumer": {
 - "carrierTechnologyParameters": {
 - "carrierTechnology": "GRPC",
 - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
 - },
 - "eventProtocolParameters": {
 - "eventProtocol": "JSON"
 - },
 - "eventName": "ApexExample_CDSConfigModifySuccessResponseEvent|ApexExample_CDSConfigModifyFailureResponseEvent",
 - "requestorMode": true,
 - "requestorPeer": "ApexExample_CDSConfigModifyRequestProducer",
 - "requestorTimeout": 500
 - },
 - "ApexExample_CDSRestartResponseConsumer": {
 - "carrierTechnologyParameters": {
 - "carrierTechnology": "GRPC",
 - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
 - },
 - "eventProtocolParameters": {
 - "eventProtocol": "JSON"
 - },
 - "eventName": "ApexExample_CDSRestartSuccessResponseEvent|ApexExample_CDSRestartFailureResponseEvent",
 - "requestorMode": true,
 - "requestorPeer": "ApexExample_CDSRestartRequestProducer",
 - "requestorTimeout": 500
 }
 },
 "eventOutputParameters": {
 "ApexExample_AAIProducer": {
 "carrierTechnologyParameters": {
 - "carrierTechnology": "RESTREQUESTOR",
 - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters"
 - },
 - "eventProtocolParameters": {
 - "eventProtocol": "JSON"
 - },
 - "eventNameFilter": "ApexExample_AAIRequestEvent",
 - "requestorMode": true,
 - "requestorPeer": "ApexExample_AAIResponseConsumer",
 - "requestorTimeout": 2000
 - },
 - "ApexExample_CDSConfigModifyRequestProducer": {
 - "carrierTechnologyParameters": {
 - "carrierTechnology": "GRPC",
 - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
 - "parameters": {
 - "host": "${KAFKA_HOST}",
 - "port": ${CDS_PORT},
 - "username": "ccsdkapps",
 - "password": "ccsdkapps",
 - "timeout": 10
 - }
 - },
 - "eventProtocolParameters": {
 - "eventProtocol": "JSON"
 - },
 - "eventNameFilter": "ApexExample_CDSConfigModifyRequestEvent",
 - "requestorMode": true,
 - "requestorPeer": "ApexExample_CDSConfigModifyResponseConsumer",
 - "requestorTimeout": 500
 - },
 - "ApexExample_CDSRestartRequestProducer": {
 - "carrierTechnologyParameters": {
 - "carrierTechnology": "GRPC",
 - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
 + "carrierTechnology": "KAFKA",
 + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.kafka.KafkaCarrierTechnologyParameters",
 "parameters": {
 - "host": "${KAFKA_HOST}",
 - "port": ${CDS_PORT},
 - "username": "ccsdkapps",
 - "password": "ccsdkapps",
 - "timeout": 10
 + "bootstrapServers": "kafka:9092",
 + "acks": "all",
 + "retries": 0,
 + "batchSize": 16384,
 + "lingerTime": 1,
 + "bufferMemory": 33554432,
 + "producerTopic": "apex-cl-mgt",
 + "keySerializer": "org.apache.kafka.common.serialization.StringSerializer",
 + "valueSerializer": "org.apache.kafka.common.serialization.StringSerializer"
 }
 },
 "eventProtocolParameters": {
 "eventProtocol": "JSON"
 - },
 - "eventNameFilter": "ApexExample_CDSRestartRequestEvent",
 - "requestorMode": true,
 - "requestorPeer": "ApexExample_CDSRestartResponseConsumer",
 - "requestorTimeout": 500
 + }
 }
 }
 }
 @@ -3399,7 +3293,7 @@ </ResponseAssertion> <hashTree/> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CreatePolicy-SimpleCL"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CreatePolicy-SimpleCL" enabled="true"> <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp> <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> @@ -6190,114 +6084,23 @@ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.kafka.KafkaCarrierTechnologyParameters",
 "parameters": {
 "bootstrapServers": "kafka:9092",
 - "groupId": "apex-grp2",
 + "groupId": "apex-group",
 "enableAutoCommit": true,
 - "autoCommitTime": 1000,
 - "sessionTimeout": 30000,
 - "consumerPollTime": 100,
 - "consumerTopicList": [
 - "unauthenticated.dcae_cl_output"
 - ],
 - "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
 - "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
 - "kafkaProperties": [
 -
 - ]
 + "autoCommitTime": 1000,
 + "sessionTimeout": 30000,
 + "consumerPollTime": 100,
 + "consumerTopicList": ["unauthenticated.dcae_cl_output"],
 + "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
 + "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer"
 }
 },
 "eventProtocolParameters": {
 "eventProtocol": "JSON"
 },
 "eventName": "SimpleCL_VesEvent"
 - },
 - "SimpleCL_AAIResponseConsumer": {
 - "carrierTechnologyParameters": {
 - "carrierTechnology": "RESTREQUESTOR",
 - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters",
 - "parameters": {
 - "url": "https://aai:8443/aai/v14/network/pnfs/pnf/{pnfName}",
 - "httpMethod": "GET",
 - "httpCodeFilter": "[2-5][0-1][0-9]",
 - "httpHeaders": [
 - [
 - "Accept",
 - "application/json"
 - ],
 - [
 - "Content-Type",
 - "application/json"
 - ],
 - [
 - "X-FromAppId",
 - "dcae-curl"
 - ],
 - [
 - "x-transactionId",
 - "9998"
 - ],
 - [
 - "Authorization",
 - "Basic QUFJOkFBSQ=="
 - ]
 - ]
 - }
 - },
 - "eventProtocolParameters": {
 - "eventProtocol": "JSON"
 - },
 - "eventName": "SimpleCL_AAISuccessResponseEvent|SimpleCL_AAIFailureResponseEvent",
 - "requestorMode": true,
 - "requestorPeer": "SimpleCL_AAIProducer",
 - "requestorTimeout": 2000
 - },
 - "SimpleCL_CDSConfigModifyResponseConsumer": {
 - "carrierTechnologyParameters": {
 - "carrierTechnology": "GRPC",
 - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
 - },
 - "eventProtocolParameters": {
 - "eventProtocol": "JSON"
 - },
 - "eventName": "SimpleCL_CDSConfigModifySuccessResponseEvent|SimpleCL_CDSConfigModifyFailureResponseEvent",
 - "requestorMode": true,
 - "requestorPeer": "SimpleCL_CDSConfigModifyRequestProducer",
 - "requestorTimeout": 500
 }
 },
 "eventOutputParameters": {
 - "SimpleCL_AAIProducer": {
 - "carrierTechnologyParameters": {
 - "carrierTechnology": "RESTREQUESTOR",
 - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters"
 - },
 - "eventProtocolParameters": {
 - "eventProtocol": "JSON"
 - },
 - "eventNameFilter": "SimpleCL_AAIRequestEvent",
 - "requestorMode": true,
 - "requestorPeer": "SimpleCL_AAIResponseConsumer",
 - "requestorTimeout": 2000
 - },
 - "SimpleCL_CDSConfigModifyRequestProducer": {
 - "carrierTechnologyParameters": {
 - "carrierTechnology": "GRPC",
 - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
 - "parameters": {
 - "host": "${KAFKA_HOST}",
 - "port": ${CDS_PORT},
 - "username": "ccsdkapps",
 - "password": "ccsdkapps",
 - "timeout": 60
 - }
 - },
 - "eventProtocolParameters": {
 - "eventProtocol": "JSON"
 - },
 - "eventNameFilter": "SimpleCL_CDSConfigModifyRequestEvent",
 - "requestorMode": true,
 - "requestorPeer": "SimpleCL_CDSConfigModifyResponseConsumer",
 - "requestorTimeout": 500
 - },
 "SimpleCL_LogEventProducer": {
 "carrierTechnologyParameters": {
 "carrierTechnology": "KAFKA",
 @@ -6309,18 +6112,14 @@ "batchSize": 16384,
 "lingerTime": 1,
 "bufferMemory": 33554432,
 - "producerTopic": "apex-cl-mgt2",
 + "producerTopic": "apex-cl-mgt",
 "keySerializer": "org.apache.kafka.common.serialization.StringSerializer",
 - "valueSerializer": "org.apache.kafka.common.serialization.StringSerializer",
 - "kafkaProperties": [
 -
 - ]
 + "valueSerializer": "org.apache.kafka.common.serialization.StringSerializer"
 }
 },
 "eventProtocolParameters": {
 "eventProtocol": "JSON"
 - },
 - "eventNameFilter": "SimpleCL_LogEvent"
 + }
 }
 }
 }
 @@ -6404,7 +6203,7 @@ </ConstantTimer> <hashTree/> </hashTree> - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true"> + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group"> <stringProp name="ThreadGroup.num_threads">${threads}</stringProp> <intProp name="ThreadGroup.ramp_time">1</intProp> <longProp name="ThreadGroup.duration">7200</longProp> @@ -6417,7 +6216,7 @@ </elementProp> </ThreadGroup> <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Health Check" enabled="true"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Health Check"> <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp> <stringProp name="HTTPSampler.port">${APEX_PORT}</stringProp> @@ -6432,25 +6231,6 @@ </elementProp> </HTTPSamplerProxy> <hashTree> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false"> - <stringProp name="cacheKey">true</stringProp> - <stringProp name="filename"></stringProp> - <stringProp name="parameters"></stringProp> - <stringProp name="script">import groovy.json.JsonSlurper; - -def res = []; -if (prev.getResponseCode() == '200') { - def jsonSlurper = new JsonSlurper(); - res = jsonSlurper.parseText(prev.getResponseDataAsString()); - - assert res instanceof Map; - assert res.healthy == true; - assert res.message == 'alive'; -} -</stringProp> - <stringProp name="scriptLanguage">groovy</stringProp> - </JSR223Assertion> - <hashTree/> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> <collectionProp name="Asserion.test_strings"> <stringProp name="49586">200</stringProp> @@ -6462,7 +6242,7 @@ if (prev.getResponseCode() == '200') { </ResponseAssertion> <hashTree/> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Prometheus Metrics" enabled="true"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Prometheus Metrics"> <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp> <stringProp name="HTTPSampler.port">${APEX_PORT}</stringProp> @@ -6489,662 +6269,527 @@ if (prev.getResponseCode() == '200') { <stringProp name="TestPlan.comments">Assert response coming back from apex-pdp</stringProp> </ResponseAssertion> <hashTree/> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false"> + </hashTree> + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - success" enabled="true"/> + <hashTree> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Send Trigger Event - simple-cl success" enabled="true"> <stringProp name="cacheKey">true</stringProp> <stringProp name="filename"></stringProp> <stringProp name="parameters"></stringProp> - <stringProp name="script">import groovy.json.JsonSlurper; + <stringProp name="script">import org.apache.kafka.clients.producer.Callback +import org.apache.kafka.clients.producer.RecordMetadata +import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.common.serialization.StringSerializer -def res = []; -if (prev.getResponseCode() == '200') { - def jsonSlurper = new JsonSlurper(); - res = jsonSlurper.parseText(prev.getResponseDataAsString()); +def props = new Properties() +props.put("bootstrap.servers", "kafka:9092") +props.put("group.id", "new-group") +props.put("acks", "all") +props.put("retries", 0) +props.put("batch.size", 16384) +props.put("linger.ms", 1) +props.put("buffer.memory", 33554432) +props.put("key.serializer", StringSerializer.class.getName()) +props.put("value.serializer", StringSerializer.class.getName()) - assert res instanceof Map; - assert res.healthy == true; - assert res.message == 'alive'; -} +def producer = new KafkaProducer<>(props) + +def jsonString = '''{ + "event": { + "commonEventHeader": { + "startEpochMicrosec": 1597953057126, + "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}", + "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}", + "lastEpochMicrosec": 1597952499468, + "eventName": "Report hostname & IP", + "sourceName": "PNF101", + "reportingEntityName": "DCAE", + "vesEventListenerVersion": "7.1", + "internalHeaderFields": {}, + "version": "4.0.1", + "priority": "Normal", + "sequence": 1, + "domain": "other" + }, + "otherFields": { + "hashMap": { + "hostname": "UNDEFINED", + "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e", + "pnfName": "PNF101", + "ip": "10.101.200.10" + }, + "otherFieldsVersion": "3.0" + } + } +}''' + +def record = new ProducerRecord<>("unauthenticated.dcae_cl_output", jsonString) + +producer.send(record, new Callback() { + @Override + void onCompletion(RecordMetadata metadata, Exception exception) { + if (exception != null) { + exception.printStackTrace() + } else { + println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}") + } + } +}) + +producer.close() </stringProp> <stringProp name="scriptLanguage">groovy</stringProp> - </JSR223Assertion> + </JSR223Sampler> <hashTree/> - </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/> - <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true"> - <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?limit=300&timeout=500</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - success" enabled="true"/> - <hashTree> - <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true"> - <stringProp name="groupSize">${threads}</stringProp> - <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp> - </SyncTimer> - <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - simplecl success" enabled="true"> - <stringProp name="TestPlan.comments">Send Trigger Event - simplecl success</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/unauthenticated.dcae_cl_output</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "event": {
 - "commonEventHeader": {
 - "startEpochMicrosec": 1597953057126,
 - "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
 - "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
 - "lastEpochMicrosec": 1597952499468,
 - "eventName": "Report hostname & IP",
 - "sourceName": "PNF101",
 - "reportingEntityName": "DCAE",
 - "vesEventListenerVersion": "7.1",
 - "internalHeaderFields": {},
 - "version": "4.0.1",
 - "priority": "Normal",
 - "sequence": 1,
 - "domain": "other"
 - },
 - "otherFields": {
 - "hashMap": {
 - "hostname": "UNDEFINED",
 - "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
 - "pnfName": "PNF101",
 - "ip": "10.101.200.10"
 - },
 - "otherFieldsVersion": "3.0"
 - }
 - }
 -}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true"> - <stringProp name="ConstantTimer.delay">${wait}</stringProp> - </ConstantTimer> - <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - simplecl success" enabled="true"> - <stringProp name="TestPlan.comments">Read notification events - simplecl success</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?limit=100&timeout=30000</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false"> - <stringProp name="cacheKey">true</stringProp> - <stringProp name="filename"></stringProp> - <stringProp name="parameters"></stringProp> - <stringProp name="script">import groovy.json.JsonSlurper; + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl success" enabled="true"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.consumer.ConsumerRecords +import org.apache.kafka.clients.consumer.ConsumerRecord +import org.apache.kafka.common.serialization.StringDeserializer +import groovy.json.JsonSlurper + +// Consumer properties +def props = new Properties() +props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server +props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group") +props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + +// Create the Kafka consumer +def consumer = new KafkaConsumer<>(props) + +// Subscribe to the topic +consumer.subscribe(["apex-cl-mgt"]) -def res = []; -if (prev.getResponseCode() == '200') { - def jsonSlurper = new JsonSlurper(); - def responseString = prev.getResponseDataAsString(); - res = jsonSlurper.parseText(responseString); - def expectedNumberOfNotifications = ${threads} * 3; - assert res instanceof List; - assert res.size() == expectedNumberOfNotifications; - assert responseString.contains("ACTIVE") - assert responseString.contains("SUCCESS") - assert responseString.contains("FINAL_SUCCESS") - assert !responseString.contains("FAILURE") +// Poll for messages and assert the value +def found = false +def timeout = 10000 // timeout in milliseconds +def startTime = System.currentTimeMillis() + +while (!found && (System.currentTimeMillis() - startTime) < timeout) { + println("Inside while loop") + ConsumerRecords<String, String> records = consumer.poll(1000) + for (ConsumerRecord<String, String> record : records) { + println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}") + + // Parse the JSON value + def jsonSlurper = new JsonSlurper() + def message = jsonSlurper.parseText(record.value()) + + // Perform assertion on specific fields in the JSON + if ((message?.source == "APEX") || (message?.component?.status == "ACTIVE")) { + found = true + println("Assertion passed: source is 'APEX' or status is 'ACTIVE'") + break + } + } } + +// Close the consumer +consumer.close() </stringProp> - <stringProp name="scriptLanguage">groovy</stringProp> - </JSR223Assertion> - <hashTree/> - </hashTree> - </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/> - <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true"> - <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?limit=300&timeout=500</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - </hashTree> + </JSR223Sampler> + <hashTree/> </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - failure" enabled="true"/> + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - success" enabled="true"/> <hashTree> - <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true"> - <stringProp name="groupSize">${threads}</stringProp> - <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp> - </SyncTimer> - <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - simplecl failure" enabled="true"> - <stringProp name="TestPlan.comments">Send Trigger Event - simplecl failure</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/unauthenticated.dcae_cl_output</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "event": {
 - "commonEventHeader": {
 - "startEpochMicrosec": 1597953057126,
 - "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
 - "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
 - "lastEpochMicrosec": 1597952499468,
 - "eventName": "Report hostname & IP",
 - "sourceName": "PNF101",
 - "reportingEntityName": "DCAE",
 - "vesEventListenerVersion": "7.1",
 - "internalHeaderFields": {},
 - "version": "4.0.1",
 - "priority": "Normal",
 - "sequence": 1,
 - "domain": "other"
 - },
 - "otherFields": {
 - "hashMap": {
 - "hostname": "UNDEFINED",
 - "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
 - "pnfName": "PNF_INVALID",
 - "ip": "10.101.200.10"
 - },
 - "otherFieldsVersion": "3.0"
 - }
 - }
 -}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true"> - <stringProp name="ConstantTimer.delay">${wait}</stringProp> - </ConstantTimer> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler" enabled="true"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.producer.Callback +import org.apache.kafka.clients.producer.RecordMetadata +import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.common.serialization.StringSerializer + +def props = new Properties() +props.put("bootstrap.servers", "kafka:9092") +props.put("group.id", "new-group") +props.put("acks", "all") +props.put("retries", 0) +props.put("batch.size", 16384) +props.put("linger.ms", 1) +props.put("buffer.memory", 33554432) +props.put("key.serializer", StringSerializer.class.getName()) +props.put("value.serializer", StringSerializer.class.getName()) + +def producer = new KafkaProducer<>(props) + +def jsonString = '''{ + "event": { + "commonEventHeader": { + "domain": "fault", + "eventId": "fault0000245", + "eventName": "Fault_Vscf:PilotNumberPoolExhaustion", + "lastEpochMicrosec": 1413378172000000, + "priority": "High", + "reportingEntityName": "ibcx0001vm002oam001", + "sequence": 1, + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014${__threadNum}", + "sourceName": "vfw-cnf-cds-test-1-vnf", + "startEpochMicrosec": 1413378172000000, + "timeZoneOffset": "UTC-05:30", + "version": "4.0.1", + "vesEventListenerVersion": "7.0.1" + }, + "faultFields": { + "alarmAdditionalInformation": { + "PilotNumberPoolSize": "1000" + }, + "alarmCondition": "PilotNumberPoolExhaustion", + "eventSeverity": "CRITICAL", + "eventSourceType": "other", + "faultFieldsVersion": 4, + "specificProblem": "Calls cannot complete - pilot numbers are unavailable", + "vfStatus": "Active" + } + } +}''' + +def record = new ProducerRecord<>("unauthenticated.dcae_policy_example_output", jsonString) + +producer.send(record, new Callback() { + @Override + void onCompletion(RecordMetadata metadata, Exception exception) { + if (exception != null) { + exception.printStackTrace() + } else { + println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}") + } + } +}) + +producer.close() +</stringProp> + </JSR223Sampler> <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - simplecl failure" enabled="true"> - <stringProp name="TestPlan.comments">Read notification events - simplecl failure</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?limit=100&timeout=30000</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false"> - <stringProp name="cacheKey">true</stringProp> - <stringProp name="filename"></stringProp> - <stringProp name="parameters"></stringProp> - <stringProp name="script">import groovy.json.JsonSlurper; + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl success" enabled="true"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.consumer.ConsumerRecords +import org.apache.kafka.clients.consumer.ConsumerRecord +import org.apache.kafka.common.serialization.StringDeserializer +import groovy.json.JsonSlurper + +// Consumer properties +def props = new Properties() +props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server +props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group") +props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + +// Create the Kafka consumer +def consumer = new KafkaConsumer<>(props) -def res = []; -if (prev.getResponseCode() == '200') { - def jsonSlurper = new JsonSlurper(); - def responseString = prev.getResponseDataAsString(); - res = jsonSlurper.parseText(responseString); - def expectedNumberOfNotifications = ${threads} * 2; - assert res instanceof List; - assert res.size() == expectedNumberOfNotifications; - assert responseString.contains("ACTIVE") - assert responseString.contains("FINAL_FAILURE") - assert !responseString.contains("FINAL_SUCCESS") +// Subscribe to the topic +consumer.subscribe(["apex-cl-mgt"]) + +// Poll for messages and assert the value +def found = false +def timeout = 10000 // timeout in milliseconds +def startTime = System.currentTimeMillis() + +while (!found && (System.currentTimeMillis() - startTime) < timeout) { + println("Inside while loop") + ConsumerRecords<String, String> records = consumer.poll(1000) + for (ConsumerRecord<String, String> record : records) { + println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}") + + // Parse the JSON value + def jsonSlurper = new JsonSlurper() + def message = jsonSlurper.parseText(record.value()) + + // Perform assertion on specific fields in the JSON + if ((message?.source == "APEX") || (message?.component?.status == "ACTIVE")) { + found = true + println("Assertion passed: source is 'APEX' or status is 'ACTIVE'") + break + } + } } + +// Close the consumer +consumer.close() </stringProp> - <stringProp name="scriptLanguage">groovy</stringProp> - </JSR223Assertion> - <hashTree/> - </hashTree> - </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/> - <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true"> - <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?limit=300&timeout=500</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - </hashTree> + </JSR223Sampler> + <hashTree/> </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - success" enabled="true"/> + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - failure" enabled="true"/> <hashTree> - <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true"> - <stringProp name="groupSize">${threads}</stringProp> - <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp> - </SyncTimer> - <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - example success" enabled="true"> - <stringProp name="TestPlan.comments">Send Trigger Event - example success</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/unauthenticated.dcae_policy_example_output</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "event": {
 - "commonEventHeader": {
 - "domain": "fault",
 - "eventId": "fault0000245",
 - "eventName": "Fault_Vscf:PilotNumberPoolExhaustion",
 - "lastEpochMicrosec": 1413378172000000,
 - "priority": "High",
 - "reportingEntityName": "ibcx0001vm002oam001",
 - "sequence": 1,
 - "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014${__threadNum}",
 - "sourceName": "vfw-cnf-cds-test-1-vnf",
 - "startEpochMicrosec": 1413378172000000,
 - "timeZoneOffset": "UTC-05:30",
 - "version": "4.0.1",
 - "vesEventListenerVersion": "7.0.1"
 - },
 - "faultFields": {
 - "alarmAdditionalInformation": {
 - "PilotNumberPoolSize": "1000"
 - },
 - "alarmCondition": "PilotNumberPoolExhaustion",
 - "eventSeverity": "CRITICAL",
 - "eventSourceType": "other",
 - "faultFieldsVersion": 4,
 - "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
 - "vfStatus": "Active"
 - }
 - }
 -}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true"> - <stringProp name="ConstantTimer.delay">${wait}</stringProp> - </ConstantTimer> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Send Trigger Event - simple-cl failure" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">import org.apache.kafka.clients.producer.Callback +import org.apache.kafka.clients.producer.RecordMetadata +import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.common.serialization.StringSerializer + +def props = new Properties() +props.put("bootstrap.servers", "kafka:9092") +props.put("group.id", "new-group") +props.put("acks", "all") +props.put("retries", 0) +props.put("batch.size", 16384) +props.put("linger.ms", 1) +props.put("buffer.memory", 33554432) +props.put("key.serializer", StringSerializer.class.getName()) +props.put("value.serializer", StringSerializer.class.getName()) + +def producer = new KafkaProducer<>(props) + +def jsonString = '''{ + "event": { + "commonEventHeader": { + "startEpochMicrosec": 1597953057126, + "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}", + "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}", + "lastEpochMicrosec": 1597952499468, + "eventName": "Report hostname & IP", + "sourceName": "PNF101", + "reportingEntityName": "DCAE", + "vesEventListenerVersion": "7.1", + "internalHeaderFields": {}, + "version": "4.0.1", + "priority": "Normal", + "sequence": 1, + "domain": "other" + }, + "otherFields": { + "hashMap": { + "hostname": "UNDEFINED", + "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e", + "pnfName": "PNF_INVALID", + "ip": "10.101.200.10" + }, + "otherFieldsVersion": "3.0" + } + } +}''' + +def record = new ProducerRecord<>("unauthenticated.dcae_cl_output", jsonString) + +producer.send(record, new Callback() { + @Override + void onCompletion(RecordMetadata metadata, Exception exception) { + if (exception != null) { + exception.printStackTrace() + } else { + println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}") + } + } +}) + +producer.close() +</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223Sampler> <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - example success" enabled="true"> - <stringProp name="TestPlan.comments">Read notification events - example success</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?limit=100&timeout=30000</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false"> - <stringProp name="cacheKey">true</stringProp> - <stringProp name="filename"></stringProp> - <stringProp name="parameters"></stringProp> - <stringProp name="script">import groovy.json.JsonSlurper; + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl success"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.consumer.ConsumerRecords +import org.apache.kafka.clients.consumer.ConsumerRecord +import org.apache.kafka.common.serialization.StringDeserializer +import groovy.json.JsonSlurper + +// Consumer properties +def props = new Properties() +props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server +props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group") +props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + +// Create the Kafka consumer +def consumer = new KafkaConsumer<>(props) -def res = []; -if (prev.getResponseCode() == '200') { - def jsonSlurper = new JsonSlurper(); - def responseString = prev.getResponseDataAsString(); - res = jsonSlurper.parseText(responseString); - def expectedNumberOfNotifications = ${threads} * 4; - assert res instanceof List; - assert res.size() == expectedNumberOfNotifications; - assert responseString.contains("ACTIVE") - assert responseString.contains("SUCCESS") - assert responseString.contains("FINAL_SUCCESS") - assert !responseString.contains("FAILURE") +// Subscribe to the topic +consumer.subscribe(["apex-cl-mgt"]) + +// Poll for messages and assert the value +def found = false +def timeout = 10000 // timeout in milliseconds +def startTime = System.currentTimeMillis() + +while (!found && (System.currentTimeMillis() - startTime) < timeout) { + println("Inside while loop") + ConsumerRecords<String, String> records = consumer.poll(1000) + for (ConsumerRecord<String, String> record : records) { + println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}") + + // Parse the JSON value + def jsonSlurper = new JsonSlurper() + def message = jsonSlurper.parseText(record.value()) + + // Perform assertion on specific fields in the JSON + if (!(message?.name != "SUCCESS")) { + found = true + println("Assertion passed") + break + } + } } + +// Close the consumer +consumer.close() </stringProp> - <stringProp name="scriptLanguage">groovy</stringProp> - </JSR223Assertion> - <hashTree/> - </hashTree> - </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/> - <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true"> - <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?limit=300&timeout=500</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - </hashTree> + </JSR223Sampler> + <hashTree/> </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - failure" enabled="true"/> + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - failure"/> <hashTree> - <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true"> - <stringProp name="groupSize">${threads}</stringProp> - <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp> - </SyncTimer> - <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - example failure" enabled="true"> - <stringProp name="TestPlan.comments">Send Trigger Event - example failure</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/unauthenticated.dcae_policy_example_output</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "event": {
 - "commonEventHeader": {
 - "domain": "fault",
 - "eventId": "fault0000245",
 - "eventName": "Fault_Vscf:PilotNumberPoolExhaustion",
 - "lastEpochMicrosec": 1413378172000000,
 - "priority": "High",
 - "reportingEntityName": "ibcx0001vm002oam001",
 - "sequence": 1,
 - "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014${__threadNum}",
 - "sourceName": "vfw-cnf-cds-test-2-vnf",
 - "startEpochMicrosec": 1413378172000000,
 - "timeZoneOffset": "UTC-05:30",
 - "version": "4.0.1",
 - "vesEventListenerVersion": "7.0.1"
 - },
 - "faultFields": {
 - "alarmAdditionalInformation": {
 - "PilotNumberPoolSize": "1000"
 - },
 - "alarmCondition": "PilotNumberPoolExhaustion",
 - "eventSeverity": "CRITICAL",
 - "eventSourceType": "other",
 - "faultFieldsVersion": 4,
 - "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
 - "vfStatus": "InActive"
 - }
 - }
 -}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true"> - <stringProp name="ConstantTimer.delay">${wait}</stringProp> - </ConstantTimer> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Send Trigger Event - example failure" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">import org.apache.kafka.clients.producer.Callback +import org.apache.kafka.clients.producer.RecordMetadata +import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.common.serialization.StringSerializer + +def props = new Properties() +props.put("bootstrap.servers", "kafka:9092") +props.put("group.id", "new-group") +props.put("acks", "all") +props.put("retries", 0) +props.put("batch.size", 16384) +props.put("linger.ms", 1) +props.put("buffer.memory", 33554432) +props.put("key.serializer", StringSerializer.class.getName()) +props.put("value.serializer", StringSerializer.class.getName()) + +def producer = new KafkaProducer<>(props) + +def jsonString = '''{ + "event": { + "commonEventHeader": { + "startEpochMicrosec": 1597953057126, + "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}", + "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}", + "lastEpochMicrosec": 1597952499468, + "eventName": "Report hostname & IP", + "sourceName": "PNF101", + "reportingEntityName": "DCAE", + "vesEventListenerVersion": "7.1", + "internalHeaderFields": {}, + "version": "4.0.1", + "priority": "Normal", + "sequence": 1, + "domain": "other" + }, + "otherFields": { + "hashMap": { + "hostname": "UNDEFINED", + "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e", + "pnfName": "PNF101", + "ip": "10.101.200.10" + }, + "otherFieldsVersion": "3.0" + } + } +}''' + +def record = new ProducerRecord<>("unauthenticated.dcae_policy_example_output", jsonString) + +producer.send(record, new Callback() { + @Override + void onCompletion(RecordMetadata metadata, Exception exception) { + if (exception != null) { + exception.printStackTrace() + } else { + println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}") + } + } +}) + +producer.close() +</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223Sampler> <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - example failure" enabled="true"> - <stringProp name="TestPlan.comments">Read notification events - example failure</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?limit=100&timeout=30000</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false"> - <stringProp name="cacheKey">true</stringProp> - <stringProp name="filename"></stringProp> - <stringProp name="parameters"></stringProp> - <stringProp name="script">import groovy.json.JsonSlurper; + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl success"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.consumer.ConsumerRecords +import org.apache.kafka.clients.consumer.ConsumerRecord +import org.apache.kafka.common.serialization.StringDeserializer +import groovy.json.JsonSlurper + +// Consumer properties +def props = new Properties() +props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server +props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group") +props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + +// Create the Kafka consumer +def consumer = new KafkaConsumer<>(props) + +// Subscribe to the topic +consumer.subscribe(["apex-cl-mgt"]) -def res = []; -if (prev.getResponseCode() == '200') { - def jsonSlurper = new JsonSlurper(); - def responseString = prev.getResponseDataAsString(); - res = jsonSlurper.parseText(responseString); - def expectedNumberOfNotifications = ${threads} * 2; - assert res instanceof List; - assert res.size() == expectedNumberOfNotifications; - assert responseString.contains("ACTIVE") - assert responseString.contains("FINAL_FAILURE") - assert !responseString.contains("FINAL_SUCCESS") +// Poll for messages and assert the value +def found = false +def timeout = 10000 // timeout in milliseconds +def startTime = System.currentTimeMillis() + +while (!found && (System.currentTimeMillis() - startTime) < timeout) { + println("Inside while loop") + ConsumerRecords<String, String> records = consumer.poll(1000) + for (ConsumerRecord<String, String> record : records) { + println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}") + + // Parse the JSON value + def jsonSlurper = new JsonSlurper() + def message = jsonSlurper.parseText(record.value()) + + // Perform assertion on specific fields in the JSON + if (!(message?.name == "SUCCESS")) { + found = true + println("Assertion passed: source is 'APEX' or status is 'ACTIVE'") + break + } + } } + +// Close the consumer +consumer.close() </stringProp> - <stringProp name="scriptLanguage">groovy</stringProp> - </JSR223Assertion> - <hashTree/> - </hashTree> + </JSR223Sampler> + <hashTree/> </hashTree> </hashTree> - <PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="tearDown Thread Group" enabled="true"> + <PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="tearDown Thread Group"> <intProp name="ThreadGroup.num_threads">1</intProp> <intProp name="ThreadGroup.ramp_time">1</intProp> <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> @@ -7159,7 +6804,7 @@ if (prev.getResponseCode() == '200') { <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp> <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">https</stringProp> + <stringProp name="HTTPSampler.protocol">http</stringProp> <stringProp name="HTTPSampler.path">/policy/pap/v1/pdps/deployments/batch</stringProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp> <stringProp name="HTTPSampler.method">POST</stringProp> @@ -7197,7 +6842,7 @@ if (prev.getResponseCode() == '200') { </elementProp> </HTTPSamplerProxy> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="false"> <collectionProp name="Asserion.test_strings"> <stringProp name="49588">202</stringProp> </collectionProp> @@ -7212,7 +6857,7 @@ if (prev.getResponseCode() == '200') { <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp> <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">https</stringProp> + <stringProp name="HTTPSampler.protocol">http</stringProp> <stringProp name="HTTPSampler.path">/policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies/onap.policies.apex.Simplecontrolloop/versions/1.0.0</stringProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp> <stringProp name="HTTPSampler.method">DELETE</stringProp> @@ -7223,7 +6868,7 @@ if (prev.getResponseCode() == '200') { </elementProp> </HTTPSamplerProxy> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="false"> <collectionProp name="Asserion.test_strings"> <stringProp name="49586">200</stringProp> </collectionProp> @@ -7238,7 +6883,7 @@ if (prev.getResponseCode() == '200') { <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp> <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">https</stringProp> + <stringProp name="HTTPSampler.protocol">http</stringProp> <stringProp name="HTTPSampler.path">/policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies/onap.policies.apex.Example/versions/1.0.0</stringProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp> <stringProp name="HTTPSampler.method">DELETE</stringProp> @@ -7249,7 +6894,7 @@ if (prev.getResponseCode() == '200') { </elementProp> </HTTPSamplerProxy> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="false"> <collectionProp name="Asserion.test_strings"> <stringProp name="49586">200</stringProp> </collectionProp> @@ -7261,349 +6906,6 @@ if (prev.getResponseCode() == '200') { <hashTree/> </hashTree> </hashTree> - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Clear DMaaP" enabled="false"> - <stringProp name="ThreadGroup.num_threads">${threads}</stringProp> - <intProp name="ThreadGroup.ramp_time">1</intProp> - <longProp name="ThreadGroup.duration">259200</longProp> - <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> - <boolProp name="ThreadGroup.scheduler">true</boolProp> - <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> - <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller"> - <intProp name="LoopController.loops">-1</intProp> - <boolProp name="LoopController.continue_forever">false</boolProp> - </elementProp> - </ThreadGroup> - <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Health Check" enabled="false"> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp> - <stringProp name="HTTPSampler.port">${APEX_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">https</stringProp> - <stringProp name="HTTPSampler.path">/policy/apex-pdp/v1/healthcheck</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true"> - <stringProp name="cacheKey">true</stringProp> - <stringProp name="filename"></stringProp> - <stringProp name="parameters"></stringProp> - <stringProp name="script">import groovy.json.JsonSlurper; - -def res = []; -if (prev.getResponseCode() == '200') { - def jsonSlurper = new JsonSlurper(); - res = jsonSlurper.parseText(prev.getResponseDataAsString()); - - assert res instanceof Map; - assert res.healthy == true; - assert res.message == 'alive'; -} -</stringProp> - <stringProp name="scriptLanguage">groovy</stringProp> - </JSR223Assertion> - <hashTree/> - </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test Controller" enabled="true"/> - <hashTree> - <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="false"> - <stringProp name="groupSize">${threads}</stringProp> - <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp> - </SyncTimer> - <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Input Event" enabled="false"> - <stringProp name="TestPlan.comments">Send input event to apex-pdp</stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/unauthenticated.dcae_cl_output</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "event": {
 - "commonEventHeader": {
 - "startEpochMicrosec": 1597953057126,
 - "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
 - "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
 - "lastEpochMicrosec": 1597952499468,
 - "eventName": "Report hostname & IP",
 - "sourceName": "PNF101",
 - "reportingEntityName": "DCAE",
 - "vesEventListenerVersion": "7.1",
 - "internalHeaderFields": {},
 - "version": "4.0.1",
 - "priority": "Normal",
 - "sequence": 1,
 - "domain": "other"
 - },
 - "otherFields": {
 - "hashMap": {
 - "hostname": "UNDEFINED",
 - "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
 - "pnfName": "PNF101",
 - "ip": "10.101.200.10"
 - },
 - "otherFieldsVersion": "3.0"
 - }
 - }
 -}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false"> - <stringProp name="ConstantTimer.delay">1000</stringProp> - </ConstantTimer> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="true"> - <stringProp name="TestPlan.comments">Check output event </stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?timeout=30000</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false"> - <stringProp name="ConstantTimer.delay">1000</stringProp> - </ConstantTimer> - <hashTree/> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="1925346054">ACTIVE</stringProp> - <stringProp name="-310150889">VES event has been received. Going to fetch details from AAI.</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">2</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false"> - <stringProp name="ConstantTimer.delay">${wait}</stringProp> - </ConstantTimer> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="false"> - <stringProp name="TestPlan.comments">Check output event </stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?limit=1&timeout=30000</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false"> - <stringProp name="ConstantTimer.delay">1000</stringProp> - </ConstantTimer> - <hashTree/> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="-1149187101">SUCCESS</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">2</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false"> - <stringProp name="ConstantTimer.delay">${wait}</stringProp> - </ConstantTimer> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="false"> - <stringProp name="TestPlan.comments">Check output event </stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?limit=1&timeout=30000</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false"> - <stringProp name="ConstantTimer.delay">1000</stringProp> - </ConstantTimer> - <hashTree/> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="439453178">FINAL_SUCCESS</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">2</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false"> - <stringProp name="ConstantTimer.delay">${wait}</stringProp> - </ConstantTimer> - <hashTree/> - </hashTree> - <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="While Controller" enabled="false"> - <stringProp name="WhileController.condition">${__javaScript(("${response}".indexOf("VES event has been received. Going to fetch details from AAI") == -1 && ${counter} < 5),)}</stringProp> - </WhileController> - <hashTree> - <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> - <stringProp name="CounterConfig.start">0</stringProp> - <stringProp name="CounterConfig.end">1</stringProp> - <stringProp name="CounterConfig.incr">1</stringProp> - <stringProp name="CounterConfig.name"></stringProp> - <stringProp name="CounterConfig.format"></stringProp> - <boolProp name="CounterConfig.per_user">false</boolProp> - </CounterConfig> - <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="true"> - <stringProp name="TestPlan.comments">Check output event </stringProp> - <intProp name="HTTPSampler.concurrentPool">6</intProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.path">/events/apex-cl-mgt/cg${__threadNum}/c1?timeout=30000</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - </HTTPSamplerProxy> - <hashTree> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false"> - <stringProp name="ConstantTimer.delay">1000</stringProp> - </ConstantTimer> - <hashTree/> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="false"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="1925346054">ACTIVE</stringProp> - <stringProp name="-310150889">VES event has been received. Going to fetch details from AAI.</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">2</intProp> - <stringProp name="Scope.variable">Response code</stringProp> - <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp> - </ResponseAssertion> - <hashTree/> - <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false"> - <stringProp name="ConstantTimer.delay">${wait}</stringProp> - </ConstantTimer> - <hashTree/> - <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSR223 PostProcessor" enabled="true"> - <stringProp name="cacheKey">true</stringProp> - <stringProp name="filename"></stringProp> - <stringProp name="parameters"></stringProp> - <stringProp name="script">vars.put("response", prev.getResponseDataAsString());</stringProp> - <stringProp name="scriptLanguage">groovy</stringProp> - </JSR223PostProcessor> - <hashTree/> - </hashTree> - </hashTree> - </hashTree> - </hashTree> <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true"> <boolProp name="ResultCollector.error_logging">false</boolProp> <objProp> @@ -7638,7 +6940,7 @@ if (prev.getResponseCode() == '200') { <connectTime>true</connectTime> </value> </objProp> - <stringProp name="filename">/home/dhanrahan/jmeter_results/apex_perf/summary.log</stringProp> + <stringProp name="filename">/home/wayne/dev/s3ps/apex-pdp/testsuites/apex-pdp-stability/src/main/resources/s3pTestResults.jtl</stringProp> </ResultCollector> <hashTree/> <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true"> @@ -7675,7 +6977,7 @@ if (prev.getResponseCode() == '200') { <connectTime>true</connectTime> </value> </objProp> - <stringProp name="filename">/home/dhanrahan/jmeter_results/apex_perf/resultTree.log</stringProp> + <stringProp name="filename">/home/wayne/dev/s3ps/apex-pdp/testsuites/apex-pdp-stability/src/main/resources/s3pTestResults.jtl</stringProp> </ResultCollector> <hashTree/> <ResultCollector guiclass="TableVisualizer" testclass="ResultCollector" testname="View Results in Table" enabled="true"> @@ -7712,7 +7014,7 @@ if (prev.getResponseCode() == '200') { <connectTime>true</connectTime> </value> </objProp> - <stringProp name="filename">/home/dhanrahan/jmeter_results/apex_perf/resultTable.log</stringProp> + <stringProp name="filename">/home/wayne/dev/s3ps/apex-pdp/testsuites/apex-pdp-stability/src/main/resources/s3pTestResults.jtl</stringProp> </ResultCollector> <hashTree/> </hashTree> |