This is an automated email from the ASF dual-hosted git repository. zehnder pushed a commit to branch hotfix-remove-performance-module in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 2d338cfc765f1da4459e9a0ccc17a1ecd1437c27 Author: Philipp Zehnder <[email protected]> AuthorDate: Tue Jan 17 09:42:12 2023 +0100 [hotfix] Remove performance module --- pom.xml | 1 - streampipes-performance-tests/pom.xml | 64 ------------ .../streampipes/performance/PerformanceTest.java | 26 ----- .../performance/PipelinePerformanceTest.java | 57 ----------- .../performance/dataprovider/DataProvider.java | 26 ----- .../performance/dataprovider/JsonDataProvider.java | 110 --------------------- .../dataprovider/SimpleSchemaProvider.java | 53 ---------- .../performance/dataprovider/StreamProvider.java | 26 ----- .../performance/model/PerformanceTestSettings.java | 79 --------------- .../pipeline/PipelineDescriptionFetcher.java | 21 ---- .../pipeline/PipelineDescriptionParser.java | 21 ---- .../performance/producer/DataSimulator.java | 74 -------------- .../simulation/DataReplayStatusNotifier.java | 24 ----- .../performance/simulation/SimulationManager.java | 69 ------------- .../simulation/SimulationStatusNotifier.java | 24 ----- .../tests/serializer/JsonSerializerTest.java | 71 ------------- .../performance/util/ParameterTool.java | 36 ------- 17 files changed, 782 deletions(-) diff --git a/pom.xml b/pom.xml index fcc2beafd..7e8c91621 100644 --- a/pom.xml +++ b/pom.xml @@ -1436,7 +1436,6 @@ <module>streampipes-model</module> <module>streampipes-model-client</module> <module>streampipes-model-shared</module> - <module>streampipes-performance-tests</module> <module>streampipes-platform-services</module> <module>streampipes-pipeline-management</module> <module>streampipes-sources</module> diff --git a/streampipes-performance-tests/pom.xml b/streampipes-performance-tests/pom.xml deleted file mode 100644 index 49c1271c8..000000000 --- a/streampipes-performance-tests/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - ~ - --> - -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>streampipes-parent</artifactId> - <groupId>org.apache.streampipes</groupId> - <version>0.91.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>streampipes-performance-tests</artifactId> - - <dependencies> - <!-- StreamPipes dependencies --> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-messaging-kafka</artifactId> - <version>0.91.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-model</artifactId> - <version>0.91.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-pipeline-management</artifactId> - <version>0.91.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-dataformat-json</artifactId> - <version>0.91.0-SNAPSHOT</version> - </dependency> - - <!-- External dependencies --> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - </plugin> - </plugins> - </build> -</project> diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/PerformanceTest.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/PerformanceTest.java deleted file mode 100644 index 93626cee3..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/PerformanceTest.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.performance; - -public class PerformanceTest { - - public static void main(String[] args) { - - } -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/PipelinePerformanceTest.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/PipelinePerformanceTest.java deleted file mode 100644 index 703b6e299..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/PipelinePerformanceTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.streampipes.performance; - -import org.apache.streampipes.performance.model.PerformanceTestSettings; -import org.apache.streampipes.performance.util.ParameterTool; - -public class PipelinePerformanceTest { - - /** - * configuration parameters: - * - number of timestamp enrichment epas - * - parallelism of enrichment epas - * - parallelism of elastic epas - * - total number of events to be simulated - * - wait time between events in ms - * - number of producer threads - * - backend URL (optional) - */ - - public static void main(String[] args) { - if (args.length < 6) { - System.out.println("Usage: java -jar streampipes-performance-tests.jar [NUMBER OF TIMESTAMP ENRICH EPAS] " - + "[PARALELLISM OF ENRICHMENT EPAS], [PARALELLISM OF ELASTIC EPAs], [TOTAL NUMBER OF EVENTS], [WAIT TIME " - + "BETWEEN EVENTS], [NUMBER OF PRODUCER THREADS]"); - } else { - PerformanceTestSettings settings = ParameterTool.fromArgs(args); - - - } - - } - - // SOURCE - - // EPA - - // SINK - //Kafka Publisher - - -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/DataProvider.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/DataProvider.java deleted file mode 100644 index 52a3ce612..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/DataProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.performance.dataprovider; - -import java.util.List; - -public interface DataProvider<T> { - - List<T> getPreparedItems(); -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/JsonDataProvider.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/JsonDataProvider.java deleted file mode 100644 index 3dbd81111..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/JsonDataProvider.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.performance.dataprovider; - -import org.apache.streampipes.model.schema.EventProperty; -import org.apache.streampipes.model.schema.EventPropertyList; -import org.apache.streampipes.model.schema.EventPropertyPrimitive; -import org.apache.streampipes.model.schema.EventSchema; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import org.apache.commons.lang3.RandomStringUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -public class JsonDataProvider implements DataProvider<String> { - - private EventSchema schema; - private Long numberOfEvents; - private List<String> outputEvents; - private Random random; - - public JsonDataProvider(EventSchema schema, Long numberOfEvents) { - this.schema = schema; - this.numberOfEvents = numberOfEvents; - this.outputEvents = new ArrayList<>(); - this.random = new Random(); - } - - @Override - public List<String> getPreparedItems() { - for (Long i = 0L; i < numberOfEvents; i++) { - outputEvents.add(makeEvent()); - } - - return outputEvents; - } - - private String makeEvent() { - JsonObject jsonObject = new JsonObject(); - for (EventProperty property : schema.getEventProperties()) { - jsonObject.add(property.getRuntimeName(), makeValue(property)); - } - - return jsonObject.toString(); - } - - private JsonElement makeValue(EventProperty property) { - if (property instanceof EventPropertyPrimitive) { -// switch (((EventPropertyPrimitive) property).getRuntimeType()) { -// case XSD._integer.toString(): -// return new JsonPrimitive(getRandomInteger()); -// case XSD._string: -// return new JsonPrimitive(getRandomString()); -// case XSD.LONG: -// return new JsonPrimitive(getRandomLong()); -// case XSD.DOUBLE: -// return new JsonPrimitive(getRandomDouble()); -// case XSD.FLOAT: -// return new JsonPrimitive(getRandomFloat()); -// } - } else if (property instanceof EventPropertyList) { - // TODO - return null; - } - // TODO: nested property - return null; - - } - - - private Float getRandomFloat() { - return random.nextFloat(); - } - - private Double getRandomDouble() { - return random.nextDouble(); - } - - private Long getRandomLong() { - return random.nextLong(); - } - - private String getRandomString() { - return RandomStringUtils.randomAlphabetic(20); - } - - private Integer getRandomInteger() { - return random.nextInt(1000); - } - -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/SimpleSchemaProvider.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/SimpleSchemaProvider.java deleted file mode 100644 index df060d59c..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/SimpleSchemaProvider.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.performance.dataprovider; - -import org.apache.streampipes.model.schema.EventProperty; -import org.apache.streampipes.model.schema.EventPropertyPrimitive; -import org.apache.streampipes.model.schema.EventSchema; - -import org.apache.commons.lang3.RandomStringUtils; - -import java.util.ArrayList; -import java.util.List; - -public class SimpleSchemaProvider { - -// private static final List<String> runtimeTypes = Arrays.asList(XSD.INTEGER, XSD.LONG, XSD.STRING, XSD.FLOAT, XSD -// .DOUBLE); - - public EventSchema getSchema() { - EventSchema schema = new EventSchema(); - List<EventProperty> properties = new ArrayList<>(); - for (int i = 0; i < 5; i++) { - properties.add(makeRandomProperty()); - } - - schema.setEventProperties(properties); - return schema; - } - - private EventProperty makeRandomProperty() { - EventPropertyPrimitive property = new EventPropertyPrimitive(); - property.setRuntimeName(RandomStringUtils.randomAlphabetic(5)); - //property.setRuntimeType(runtimeTypes.get(new Random().nextInt(5))); - - return property; - } -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/StreamProvider.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/StreamProvider.java deleted file mode 100644 index 2a9fc5088..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/dataprovider/StreamProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.performance.dataprovider; - -import org.apache.streampipes.model.SpDataStream; - -public interface StreamProvider { - - SpDataStream getStreamDescription(); -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/model/PerformanceTestSettings.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/model/PerformanceTestSettings.java deleted file mode 100644 index d06836d21..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/model/PerformanceTestSettings.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.streampipes.performance.model; - -/** - * configuration parameters: - * - number of timestamp enrichment epas - * - parallelism of enrichment epas - * - parallelism of elastic epas - * - total number of events to be simulated - * - wait time between events in ms - * - number of producer threads - * - backend URL (optional) - */ -public class PerformanceTestSettings { - - private Integer numberOfTimestampEnrichmentEpas; - private Integer parallelismOfEnrichmentEpas; - private Integer parallelismOfElasticEpas; - private Long totalNumberofEvents; - private Long waitTimeBetweenEventsInMs; - private Integer numProducerThreads; - private String elasticUrl; - - public PerformanceTestSettings(Integer numberOfTimestampEnrichmentEpas, Integer parallelismOfEnrichmentEpas, - Integer parallelismOfElasticEpas, Long totalNumberofEvents, - Long waitTimeBetweenEventsInMs, Integer numProducerThreads, String elasticUrl) { - this.numberOfTimestampEnrichmentEpas = numberOfTimestampEnrichmentEpas; - this.parallelismOfEnrichmentEpas = parallelismOfEnrichmentEpas; - this.parallelismOfElasticEpas = parallelismOfElasticEpas; - this.totalNumberofEvents = totalNumberofEvents; - this.waitTimeBetweenEventsInMs = waitTimeBetweenEventsInMs; - this.numProducerThreads = numProducerThreads; - this.elasticUrl = elasticUrl; - } - - public Integer getNumberOfTimestampEnrichmentEpas() { - return numberOfTimestampEnrichmentEpas; - } - - public Integer getParallelismOfEnrichmentEpas() { - return parallelismOfEnrichmentEpas; - } - - public Integer getParallelismOfElasticEpas() { - return parallelismOfElasticEpas; - } - - public Long getTotalNumberofEvents() { - return totalNumberofEvents; - } - - public Long getWaitTimeBetweenEventsInMs() { - return waitTimeBetweenEventsInMs; - } - - public Integer getNumProducerThreads() { - return numProducerThreads; - } - - public String getElasticUrl() { - return elasticUrl; - } -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/pipeline/PipelineDescriptionFetcher.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/pipeline/PipelineDescriptionFetcher.java deleted file mode 100644 index 15e9e925d..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/pipeline/PipelineDescriptionFetcher.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.streampipes.performance.pipeline; - -public class PipelineDescriptionFetcher { -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/pipeline/PipelineDescriptionParser.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/pipeline/PipelineDescriptionParser.java deleted file mode 100644 index 5dbefa11d..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/pipeline/PipelineDescriptionParser.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.streampipes.performance.pipeline; - -public class PipelineDescriptionParser { -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/producer/DataSimulator.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/producer/DataSimulator.java deleted file mode 100644 index ac0eb3e18..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/producer/DataSimulator.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.streampipes.performance.producer; - -import org.apache.streampipes.messaging.kafka.SpKafkaProducer; -import org.apache.streampipes.performance.simulation.DataReplayStatusNotifier; - -import java.util.Collections; -import java.util.Random; -import java.util.UUID; - -public class DataSimulator implements Runnable { - - private static final String topic = ""; - - private String threadId; - private SpKafkaProducer kafkaProducer; - - private Long totalNumberOfEvents; - private Long waitTimeBetweenEvents; - private Random random; - - private DataReplayStatusNotifier statusNotifier; - - public DataSimulator(String kafkaUrl, Long totalNumberOfEvents, Long waitTimeBetweenEvents, String threadId, - DataReplayStatusNotifier statusNotifier) { - this.kafkaProducer = new SpKafkaProducer(kafkaUrl, topic, Collections.emptyList()); - this.threadId = threadId; - - this.totalNumberOfEvents = totalNumberOfEvents; - this.waitTimeBetweenEvents = waitTimeBetweenEvents; - - this.statusNotifier = statusNotifier; - this.random = new Random(); - } - - @Override - public void run() { - Long eventCount = 0L; - do { - kafkaProducer.publish(nextEvent()); - eventCount++; - } while (eventCount < totalNumberOfEvents); - - this.kafkaProducer.disconnect(); - statusNotifier.onFinished(threadId); - } - - private byte[] nextEvent() { - StringBuilder builder = new StringBuilder(); - builder.append("{"); - builder.append("\"timestamp\" : ").append(System.currentTimeMillis()).append(","); - builder.append("\"sensorId\" : \"").append(UUID.randomUUID().toString()).append("\","); - builder.append("\"pressure\" : ").append(random.nextDouble()); - builder.append("}"); - - return builder.toString().getBytes(); - } -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/simulation/DataReplayStatusNotifier.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/simulation/DataReplayStatusNotifier.java deleted file mode 100644 index 7c3963586..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/simulation/DataReplayStatusNotifier.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.performance.simulation; - -public interface DataReplayStatusNotifier { - - void onFinished(String threadId); -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/simulation/SimulationManager.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/simulation/SimulationManager.java deleted file mode 100644 index bc68c9942..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/simulation/SimulationManager.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.streampipes.performance.simulation; - -import org.apache.streampipes.performance.model.PerformanceTestSettings; -import org.apache.streampipes.performance.producer.DataSimulator; - -import org.apache.commons.lang3.RandomStringUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class SimulationManager { - - private static final String kafkaUrl = "kafka:9092"; - - private PerformanceTestSettings settings; - private SimulationStatusNotifier notifier; - - private Map<String, Boolean> statusMap; - - public SimulationManager(PerformanceTestSettings settings, SimulationStatusNotifier notifier) { - this.settings = settings; - this.notifier = notifier; - this.statusMap = new HashMap<>(); - } - - public void initSimulation() { - - List<Thread> threads = new ArrayList<>(); - - for (Integer i = 0; i < settings.getNumProducerThreads(); i++) { - String threadId = RandomStringUtils.randomAlphanumeric(6); - statusMap.put(threadId, false); - threads.add(new Thread(new DataSimulator(kafkaUrl, settings.getTotalNumberofEvents(), settings - .getWaitTimeBetweenEventsInMs(), threadId, threadId1 -> { - statusMap.put(threadId1, true); - checkFinished(); - }))); - } - - for (Thread thread : threads) { - thread.start(); - } - } - - private void checkFinished() { - if (statusMap.keySet().stream().allMatch(key -> statusMap.get(key))) { - notifier.onFinished(); - } - } -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/simulation/SimulationStatusNotifier.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/simulation/SimulationStatusNotifier.java deleted file mode 100644 index 9da2e57b1..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/simulation/SimulationStatusNotifier.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.performance.simulation; - -public interface SimulationStatusNotifier { - - void onFinished(); -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/tests/serializer/JsonSerializerTest.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/tests/serializer/JsonSerializerTest.java deleted file mode 100644 index 8f6b67bbe..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/tests/serializer/JsonSerializerTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.streampipes.performance.tests.serializer; - -import org.apache.streampipes.commons.exceptions.SpRuntimeException; -import org.apache.streampipes.dataformat.json.JsonDataFormatDefinition; -import org.apache.streampipes.performance.dataprovider.JsonDataProvider; -import org.apache.streampipes.performance.dataprovider.SimpleSchemaProvider; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class JsonSerializerTest { - - private static final Logger LOG = LoggerFactory.getLogger(JsonSerializerTest.class); - - public static void main(String[] args) { - List<String> data = new JsonDataProvider(new SimpleSchemaProvider().getSchema(), 1000000L).getPreparedItems(); - List<Map<String, Object>> events = new ArrayList<>(); - JsonDataFormatDefinition formatter = new JsonDataFormatDefinition(); - - LOG.info("Total events: " + data.size()); - LOG.info("Starting deserializer test"); - Long startTime = System.currentTimeMillis(); - for (String item : data) { - try { - events.add(formatter.toMap(item.getBytes())); - } catch (SpRuntimeException e) { - e.printStackTrace(); - } - } - Long endTime = System.currentTimeMillis(); - - LOG.info("Total time: " + String.valueOf(endTime - startTime)); - LOG.info("Per event: " + String.valueOf((endTime - startTime) / data.size())); - - LOG.info("Starting serializer test"); - startTime = System.currentTimeMillis(); - for (Map<String, Object> event : events) { - try { - formatter.fromMap(event); - } catch (SpRuntimeException e) { - e.printStackTrace(); - } - } - endTime = System.currentTimeMillis(); - - LOG.info("Total time: " + String.valueOf(endTime - startTime)); - LOG.info("Per event: " + String.valueOf((endTime - startTime) / data.size())); - } -} diff --git a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/util/ParameterTool.java b/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/util/ParameterTool.java deleted file mode 100644 index bca098b63..000000000 --- a/streampipes-performance-tests/src/main/java/org/apache/streampipes/performance/util/ParameterTool.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.streampipes.performance.util; - -import org.apache.streampipes.performance.model.PerformanceTestSettings; - -public class ParameterTool { - - public static PerformanceTestSettings fromArgs(String[] args) { - return new PerformanceTestSettings(toInt(args[0]), toInt(args[1]), toInt(args[2]), toLong(args[3]), toLong - (args[4]), toInt(args[5]), args[6]); - } - - private static Long toLong(String arg) { - return Long.parseLong(arg); - } - - private static Integer toInt(String arg) { - return Integer.parseInt(arg); - } -}
