diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4267500242993eb3a99c53356b0f99731644ee76..711445cd99e41ab2ef18926e8ec3d3c458ba7d80 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -275,7 +275,7 @@ spotbugs-benchmarks: - changes: - theodolite-benchmarks/* - theodolite-benchmarks/$JAVA_PROJECT_NAME/**/* - - theodolite-benchmarks/{$JAVA_PROJECT_DEPS}/**/* + - theodolite-benchmarks/{commons,$JAVA_PROJECT_DEPS}/**/* if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME && $JAVA_PROJECT_DEPS" - if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME" when: manual diff --git a/theodolite-benchmarks/beam-commons/build.gradle b/theodolite-benchmarks/beam-commons/build.gradle index 64ac2bb51ae1e6d741749a81e5c6c9e296d14d68..34a98212cdca9b347027c8e1c915044d55514b9c 100644 --- a/theodolite-benchmarks/beam-commons/build.gradle +++ b/theodolite-benchmarks/beam-commons/build.gradle @@ -13,8 +13,7 @@ repositories { } dependencies { - implementation('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } - implementation('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } + implementation project(':commons') implementation group: 'org.apache.beam', name: 'beam-sdks-java-core', version: '2.35.0' implementation('org.apache.beam:beam-sdks-java-io-kafka:2.35.0'){ diff --git a/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/BeamService.java b/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/BeamService.java index 0165fa644e1853353e73caeaf0b9d2df0f8e9aea..4897f4171f96dea72d1c5c002c5f817a5f3e2ba2 100644 --- a/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/BeamService.java +++ b/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/BeamService.java @@ -10,7 +10,7 @@ import org.apache.beam.sdk.options.PipelineOptionsFactory; import org.apache.commons.configuration2.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import titan.ccp.common.configuration.ServiceConfigurations; +import rocks.theodolite.benchmarks.commons.commons.configuration.ServiceConfigurations; /** * A general Apache Beam-based microservice. It is configured by Beam pipeline, a Beam runner and diff --git a/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/ActivePowerRecordDeserializer.java b/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/ActivePowerRecordDeserializer.java index 0c8d3a4a847cf9422c4e364a31024fb3d0c3f87a..8ab579d0cb2be846c715d5f16430371eb5952d2d 100644 --- a/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/ActivePowerRecordDeserializer.java +++ b/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/ActivePowerRecordDeserializer.java @@ -2,7 +2,8 @@ package rocks.theodolite.benchmarks.commons.beam.kafka; import io.confluent.kafka.streams.serdes.avro.SpecificAvroDeserializer; import org.apache.kafka.common.serialization.Deserializer; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; + /** * A Kafka {@link Deserializer} for typed Schema Registry {@link ActivePowerRecord}. diff --git a/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/EventTimePolicy.java b/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/EventTimePolicy.java index 62e56341518839b96ad059e1c496ea1babb4674d..a63b5f4939566134a0aeec765fe084ea5bcc41ff 100644 --- a/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/EventTimePolicy.java +++ b/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/EventTimePolicy.java @@ -5,7 +5,7 @@ import org.apache.beam.sdk.io.kafka.KafkaRecord; import org.apache.beam.sdk.io.kafka.TimestampPolicy; import org.apache.beam.sdk.transforms.windowing.BoundedWindow; import org.joda.time.Instant; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * TimeStampPolicy to use event time based on the timestamp of the record value. diff --git a/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/KafkaActivePowerTimestampReader.java b/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/KafkaActivePowerTimestampReader.java index e22d5c8eedcd545364511a1461208f30bcb0a75c..31cd3e6be851bc0f0711cc17a591df6620951dc7 100644 --- a/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/KafkaActivePowerTimestampReader.java +++ b/theodolite-benchmarks/beam-commons/src/main/java/rocks/theodolite/benchmarks/commons/beam/kafka/KafkaActivePowerTimestampReader.java @@ -8,7 +8,7 @@ import org.apache.beam.sdk.values.KV; import org.apache.beam.sdk.values.PBegin; import org.apache.beam.sdk.values.PCollection; import org.apache.kafka.common.serialization.StringDeserializer; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Simple {@link PTransform} that reads from Kafka using {@link KafkaIO} with event time. diff --git a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.beam.gradle b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.beam.gradle index 5849bd93221794d135f1c6cb3bcb62d2174724b5..7783baaa215a12bba79f26e70d8ac8073252a780 100644 --- a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.beam.gradle +++ b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.beam.gradle @@ -22,8 +22,7 @@ def apacheBeamVersion = '2.35.0' dependencies { // These dependencies are used internally, and not exposed to consumers on their own compile classpath. - implementation('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } - implementation('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } + implementation project(':commons') implementation 'com.google.guava:guava:24.1-jre' implementation 'org.slf4j:slf4j-simple:1.7.25' implementation project(':beam-commons') diff --git a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.flink.gradle b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.flink.gradle index 7671e602211b6d9e923a3b2a4c87f40fff84c6ec..5665de9d8ea42b88ef915189234ead634c66215c 100644 --- a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.flink.gradle +++ b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.flink.gradle @@ -35,9 +35,7 @@ repositories { } dependencies { - // Special version required because of https://issues.apache.org/jira/browse/FLINK-13703 - implementation('org.industrial-devops:titan-ccp-common:0.1.0-flink-ready-SNAPSHOT') { changing = true } - implementation('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } + implementation project(':commons') implementation 'org.apache.kafka:kafka-clients:2.2.0' implementation 'com.google.guava:guava:30.1-jre' diff --git a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.hazelcastjet.gradle b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.hazelcastjet.gradle index b092c97cf0e79895d4d6aafc594979b8f48dd167..0bade8fddc045f19b13074966d29996e26a72e77 100644 --- a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.hazelcastjet.gradle +++ b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.hazelcastjet.gradle @@ -17,13 +17,12 @@ repositories { } dependencies { - implementation('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } - implementation('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } + implementation project(':commons') + implementation 'com.google.guava:guava:24.1-jre' implementation 'org.slf4j:slf4j-api:1.7.30' implementation 'org.slf4j:slf4j-simple:1.7.30' - implementation 'io.confluent:kafka-avro-serializer:5.3.0' implementation 'com.hazelcast.jet:hazelcast-jet:4.5' diff --git a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.kstreams.gradle b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.kstreams.gradle index bf533915a8fdf4a712754857702373264a30f80a..f43b9bafe3b8135cb4606f109648fc1acb4fe024 100644 --- a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.kstreams.gradle +++ b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.kstreams.gradle @@ -20,8 +20,7 @@ repositories { dependencies { // These dependencies are used internally, and not exposed to consumers on their own compile classpath. - implementation('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } - implementation('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } + implementation project(':commons') implementation 'org.apache.kafka:kafka-streams:3.1.0' implementation 'com.google.guava:guava:24.1-jre' implementation 'org.slf4j:slf4j-simple:1.7.25' diff --git a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.load-generator.gradle b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.load-generator.gradle index fb4fd89d1fe8a6d625a3ba7b459e9b0961befdbc..b4927d53d0ed976a0f0dcecd6d096e3d6c7d9273 100644 --- a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.load-generator.gradle +++ b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.load-generator.gradle @@ -20,8 +20,7 @@ repositories { dependencies { // These dependencies are used internally, and not exposed to consumers on their own compile classpath. - implementation('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } - implementation('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } + implementation project(':commons') implementation 'org.slf4j:slf4j-simple:1.7.25' // These dependencies are used for the workload-generator-commmon diff --git a/theodolite-benchmarks/commons/.settings/org.eclipse.jdt.ui.prefs b/theodolite-benchmarks/commons/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000000000000000000000000000000000000..b2a15f439cf1844efe56f1ac0d82a2884e66cb9d --- /dev/null +++ b/theodolite-benchmarks/commons/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,286 @@ +cleanup.add_all=false +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=true +cleanup.always_use_this_for_non_static_method_access=true +cleanup.array_with_curly=false +cleanup.arrays_fill=false +cleanup.bitwise_conditional_expression=false +cleanup.boolean_literal=false +cleanup.boolean_value_rather_than_comparison=true +cleanup.break_loop=false +cleanup.collection_cloning=false +cleanup.comparing_on_criteria=false +cleanup.comparison_statement=false +cleanup.controlflow_merge=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=true +cleanup.convert_to_enhanced_for_loop_if_loop_var_used=true +cleanup.convert_to_switch_expressions=false +cleanup.correct_indentation=true +cleanup.do_while_rather_than_while=true +cleanup.double_negation=false +cleanup.else_if=false +cleanup.embedded_if=false +cleanup.evaluate_nullable=false +cleanup.extract_increment=false +cleanup.format_source_code=true +cleanup.format_source_code_changes_only=false +cleanup.hash=false +cleanup.if_condition=false +cleanup.insert_inferred_type_arguments=false +cleanup.instanceof=false +cleanup.instanceof_keyword=false +cleanup.invert_equals=false +cleanup.join=false +cleanup.lazy_logical_operator=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=true +cleanup.map_cloning=false +cleanup.merge_conditional_blocks=false +cleanup.multi_catch=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.no_string_creation=false +cleanup.no_super=false +cleanup.number_suffix=false +cleanup.objects_equals=false +cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=true +cleanup.operand_factorization=false +cleanup.organize_imports=true +cleanup.overridden_assignment=false +cleanup.plain_replacement=false +cleanup.precompile_regex=false +cleanup.primitive_comparison=false +cleanup.primitive_parsing=false +cleanup.primitive_rather_than_wrapper=true +cleanup.primitive_serialization=false +cleanup.pull_out_if_from_if_else=false +cleanup.pull_up_assignment=false +cleanup.push_down_negation=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.reduce_indentation=false +cleanup.redundant_comparator=false +cleanup.redundant_falling_through_block_end=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_modifiers=false +cleanup.remove_redundant_semicolons=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_array_creation=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.return_expression=false +cleanup.simplify_lambda_expression_and_method_ref=false +cleanup.single_used_field=false +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.standard_comparison=false +cleanup.static_inner_class=false +cleanup.strictly_equal_or_different=false +cleanup.stringbuffer_to_stringbuilder=false +cleanup.stringbuilder=false +cleanup.stringbuilder_for_local_vars=true +cleanup.stringconcat_to_textblock=false +cleanup.substring=false +cleanup.switch=false +cleanup.system_property=false +cleanup.system_property_boolean=false +cleanup.system_property_file_encoding=false +cleanup.system_property_file_separator=false +cleanup.system_property_line_separator=false +cleanup.system_property_path_separator=false +cleanup.ternary_operator=false +cleanup.try_with_resource=false +cleanup.unlooped_while=false +cleanup.unreachable_block=false +cleanup.use_anonymous_class_creation=false +cleanup.use_autoboxing=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_directly_map_method=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=true +cleanup.use_string_is_blank=false +cleanup.use_this_for_non_static_field_access=true +cleanup.use_this_for_non_static_field_access_only_if_necessary=false +cleanup.use_this_for_non_static_method_access=true +cleanup.use_this_for_non_static_method_access_only_if_necessary=false +cleanup.use_unboxing=false +cleanup.use_var=false +cleanup.useless_continue=false +cleanup.useless_return=false +cleanup.valueof_rather_than_instantiation=false +cleanup_profile=_CAU-SE-Style +cleanup_settings_version=2 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_CAU-SE-Style +formatter_settings_version=21 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder= +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_all=false +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=true +sp_cleanup.always_use_this_for_non_static_method_access=true +sp_cleanup.array_with_curly=false +sp_cleanup.arrays_fill=false +sp_cleanup.bitwise_conditional_expression=false +sp_cleanup.boolean_literal=false +sp_cleanup.boolean_value_rather_than_comparison=false +sp_cleanup.break_loop=false +sp_cleanup.collection_cloning=false +sp_cleanup.comparing_on_criteria=true +sp_cleanup.comparison_statement=false +sp_cleanup.controlflow_merge=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=true +sp_cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false +sp_cleanup.convert_to_switch_expressions=false +sp_cleanup.correct_indentation=true +sp_cleanup.do_while_rather_than_while=false +sp_cleanup.double_negation=false +sp_cleanup.else_if=false +sp_cleanup.embedded_if=false +sp_cleanup.evaluate_nullable=false +sp_cleanup.extract_increment=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.hash=false +sp_cleanup.if_condition=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.instanceof=false +sp_cleanup.instanceof_keyword=false +sp_cleanup.invert_equals=false +sp_cleanup.join=false +sp_cleanup.lazy_logical_operator=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=true +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.map_cloning=false +sp_cleanup.merge_conditional_blocks=false +sp_cleanup.multi_catch=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.no_string_creation=false +sp_cleanup.no_super=false +sp_cleanup.number_suffix=false +sp_cleanup.objects_equals=false +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=false +sp_cleanup.operand_factorization=false +sp_cleanup.organize_imports=true +sp_cleanup.overridden_assignment=false +sp_cleanup.plain_replacement=false +sp_cleanup.precompile_regex=false +sp_cleanup.primitive_comparison=false +sp_cleanup.primitive_parsing=false +sp_cleanup.primitive_rather_than_wrapper=false +sp_cleanup.primitive_serialization=false +sp_cleanup.pull_out_if_from_if_else=false +sp_cleanup.pull_up_assignment=false +sp_cleanup.push_down_negation=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.reduce_indentation=false +sp_cleanup.redundant_comparator=false +sp_cleanup.redundant_falling_through_block_end=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_modifiers=false +sp_cleanup.remove_redundant_semicolons=false +sp_cleanup.remove_redundant_type_arguments=false +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_array_creation=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.return_expression=false +sp_cleanup.simplify_lambda_expression_and_method_ref=false +sp_cleanup.single_used_field=false +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.standard_comparison=false +sp_cleanup.static_inner_class=false +sp_cleanup.strictly_equal_or_different=false +sp_cleanup.stringbuffer_to_stringbuilder=false +sp_cleanup.stringbuilder=false +sp_cleanup.stringbuilder_for_local_vars=false +sp_cleanup.stringconcat_to_textblock=false +sp_cleanup.substring=false +sp_cleanup.switch=false +sp_cleanup.system_property=false +sp_cleanup.system_property_boolean=false +sp_cleanup.system_property_file_encoding=false +sp_cleanup.system_property_file_separator=false +sp_cleanup.system_property_line_separator=false +sp_cleanup.system_property_path_separator=false +sp_cleanup.ternary_operator=false +sp_cleanup.try_with_resource=false +sp_cleanup.unlooped_while=false +sp_cleanup.unreachable_block=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_autoboxing=false +sp_cleanup.use_blocks=true +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_directly_map_method=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=true +sp_cleanup.use_string_is_blank=false +sp_cleanup.use_this_for_non_static_field_access=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false +sp_cleanup.use_this_for_non_static_method_access=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=false +sp_cleanup.use_unboxing=false +sp_cleanup.use_var=false +sp_cleanup.useless_continue=true +sp_cleanup.useless_return=true +sp_cleanup.valueof_rather_than_instantiation=false diff --git a/theodolite-benchmarks/commons/.settings/qa.eclipse.plugin.checkstyle.prefs b/theodolite-benchmarks/commons/.settings/qa.eclipse.plugin.checkstyle.prefs new file mode 100644 index 0000000000000000000000000000000000000000..4fa4266c755f4ff8da465ab7341cd70ffb24ecf7 --- /dev/null +++ b/theodolite-benchmarks/commons/.settings/qa.eclipse.plugin.checkstyle.prefs @@ -0,0 +1,4 @@ +configFilePath=../config/checkstyle.xml +customModulesJarPaths= +eclipse.preferences.version=1 +enabled=false diff --git a/theodolite-benchmarks/commons/.settings/qa.eclipse.plugin.pmd.prefs b/theodolite-benchmarks/commons/.settings/qa.eclipse.plugin.pmd.prefs new file mode 100644 index 0000000000000000000000000000000000000000..40bfd0ecdbbe324bb54e4b9f9f32ba95cf5b0c2a --- /dev/null +++ b/theodolite-benchmarks/commons/.settings/qa.eclipse.plugin.pmd.prefs @@ -0,0 +1,4 @@ +customRulesJars= +eclipse.preferences.version=1 +enabled=false +ruleSetFilePath=../config/pmd.xml diff --git a/theodolite-benchmarks/commons/build.gradle b/theodolite-benchmarks/commons/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..2b00b6619f813ec83031585b86e51a0f1a0e43ed --- /dev/null +++ b/theodolite-benchmarks/commons/build.gradle @@ -0,0 +1,93 @@ +plugins { + // common java conventions + id 'theodolite.java-commons' + // avro plugin + id "com.github.davidmc24.gradle.plugin.avro-base" version "1.3.0" +} + + + +repositories { + mavenCentral() + maven { + url "https://oss.sonatype.org/content/repositories/snapshots/" + } + maven { + url 'https://packages.confluent.io/maven/' + } +} + +dependencies { + // These dependencies is exported to consumers, that is to say found on their compile classpath. + api 'org.apache.commons:commons-configuration2:2.0' + api "org.apache.avro:avro:1.11.0" + api 'org.apache.kafka:kafka-streams:2.4.0' // needed in flink uc3 + + // These dependencies are used internally, and not exposed to consumers on their own compile classpath. + implementation 'commons-beanutils:commons-beanutils:1.9.2' // necessary for commons-configuration2 + implementation 'com.google.code.gson:gson:2.8.2' + implementation 'com.google.guava:guava:24.1-jre' + implementation 'org.slf4j:slf4j-api:1.7.25' + implementation 'org.apache.kafka:kafka-clients:2.4.0' + implementation ('io.confluent:kafka-streams-avro-serde:5.3.2') { + // Kafka client is already included from Kafka Streams in version 2.4.0 + exclude group: 'org.apache.kafka', module: 'kafka-clients' + } + + // Use JUnit test framework + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1' + testImplementation 'com.github.stefanbirkner:system-rules:1.17.0' +} + + +// Local sources +sourceSets { + main { + java { + srcDir 'src/main/java' + srcDir 'src-gen/main/java' + } + } +} + + +// Local avro creation +avro { + fieldVisibility = "PRIVATE" + // Setters required for flink because of https://issues.apache.org/jira/browse/FLINK-13703 + createSetters = true +} + +task("generateAvroProtocol", type: com.github.davidmc24.gradle.plugin.avro.GenerateAvroProtocolTask) { + group 'Generate Sources' + source file("src/main/avro") + include("**/*.avdl") + outputDir = file("build/generated-avro-main-avpr") +} + +task("generateAvroSchema", type: com.github.davidmc24.gradle.plugin.avro.GenerateAvroSchemaTask) { + group 'Generate Sources' + dependsOn generateAvroProtocol + source file("src/main/avro") + source file("build/generated-avro-main-avpr") + include("**/*.avpr") + outputDir = file("src-gen/main/avro") +} + +task ("generateAvroJava", type: com.github.davidmc24.gradle.plugin.avro.GenerateAvroJavaTask) { + group 'Generate Sources' + dependsOn generateAvroSchema + source file("src-gen/main/avro") + outputDir = file("src-gen/main/java") +} + +tasks.withType(Checkstyle) { + source = fileTree('src/main/java') +} + +tasks.withType(Pmd) { + exclude '**/commons/src-gen/.*' +} + + + diff --git a/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/ActivePowerRecord.avsc b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/ActivePowerRecord.avsc new file mode 100644 index 0000000000000000000000000000000000000000..91f1168632267b6d69f1b22aed658897d95958b1 --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/ActivePowerRecord.avsc @@ -0,0 +1,18 @@ +{ + "type" : "record", + "name" : "ActivePowerRecord", + "namespace" : "rocks.theodolite.benchmarks.commons.model.records", + "fields" : [ { + "name" : "identifier", + "type" : "string", + "doc" : "*" + }, { + "name" : "timestamp", + "type" : "long", + "doc" : "*" + }, { + "name" : "valueInW", + "type" : "double", + "doc" : "*" + } ] +} \ No newline at end of file diff --git a/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/AggregatedActivePowerRecord.avsc b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/AggregatedActivePowerRecord.avsc new file mode 100644 index 0000000000000000000000000000000000000000..336476e8417a5b7245eea1a1c6b2b454fcc11001 --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/AggregatedActivePowerRecord.avsc @@ -0,0 +1,26 @@ +{ + "type" : "record", + "name" : "AggregatedActivePowerRecord", + "namespace" : "rocks.theodolite.benchmarks.commons.model.records", + "fields" : [ { + "name" : "identifier", + "type" : "string", + "doc" : "*" + }, { + "name" : "timestamp", + "type" : "long", + "doc" : "*" + }, { + "name" : "count", + "type" : "long", + "doc" : "*" + }, { + "name" : "sumInW", + "type" : "double", + "doc" : "*" + }, { + "name" : "averageInW", + "type" : "double", + "doc" : "*" + } ] +} \ No newline at end of file diff --git a/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/DayOfWeekActivePowerRecord.avsc b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/DayOfWeekActivePowerRecord.avsc new file mode 100644 index 0000000000000000000000000000000000000000..c029937dd0d17e0a14bb613a59dff6f72635f009 --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/DayOfWeekActivePowerRecord.avsc @@ -0,0 +1,33 @@ +{ + "type" : "record", + "name" : "DayOfWeekActivePowerRecord", + "namespace" : "rocks.theodolite.benchmarks.commons.model.records", + "fields" : [ { + "name" : "identifier", + "type" : "string" + }, { + "name" : "dayOfWeek", + "type" : "int" + }, { + "name" : "periodStart", + "type" : "long" + }, { + "name" : "periodEnd", + "type" : "long" + }, { + "name" : "count", + "type" : "long" + }, { + "name" : "mean", + "type" : "double" + }, { + "name" : "populationVariance", + "type" : "double" + }, { + "name" : "min", + "type" : "double" + }, { + "name" : "max", + "type" : "double" + } ] +} \ No newline at end of file diff --git a/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/HourOfDayActivePowerRecord.avsc b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/HourOfDayActivePowerRecord.avsc new file mode 100644 index 0000000000000000000000000000000000000000..3ad6d6ade5d2f29718db04e066565a11f2db412d --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/HourOfDayActivePowerRecord.avsc @@ -0,0 +1,33 @@ +{ + "type" : "record", + "name" : "HourOfDayActivePowerRecord", + "namespace" : "rocks.theodolite.benchmarks.commons.model.records", + "fields" : [ { + "name" : "identifier", + "type" : "string" + }, { + "name" : "hourOfDay", + "type" : "int" + }, { + "name" : "periodStart", + "type" : "long" + }, { + "name" : "periodEnd", + "type" : "long" + }, { + "name" : "count", + "type" : "long" + }, { + "name" : "mean", + "type" : "double" + }, { + "name" : "populationVariance", + "type" : "double" + }, { + "name" : "min", + "type" : "double" + }, { + "name" : "max", + "type" : "double" + } ] +} \ No newline at end of file diff --git a/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/HourOfWeekActivePowerRecord.avsc b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/HourOfWeekActivePowerRecord.avsc new file mode 100644 index 0000000000000000000000000000000000000000..74739f5bd074ba330cee631c433ea4ab1c1fa8d9 --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/HourOfWeekActivePowerRecord.avsc @@ -0,0 +1,36 @@ +{ + "type" : "record", + "name" : "HourOfWeekActivePowerRecord", + "namespace" : "rocks.theodolite.benchmarks.commons.model.records", + "fields" : [ { + "name" : "identifier", + "type" : "string" + }, { + "name" : "dayOfWeek", + "type" : "int" + }, { + "name" : "hourOfDay", + "type" : "int" + }, { + "name" : "periodStart", + "type" : "long" + }, { + "name" : "periodEnd", + "type" : "long" + }, { + "name" : "count", + "type" : "long" + }, { + "name" : "mean", + "type" : "double" + }, { + "name" : "populationVariance", + "type" : "double" + }, { + "name" : "min", + "type" : "double" + }, { + "name" : "max", + "type" : "double" + } ] +} \ No newline at end of file diff --git a/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/MonthOfYearActivePowerRecord.avsc b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/MonthOfYearActivePowerRecord.avsc new file mode 100644 index 0000000000000000000000000000000000000000..70dd7eda5b5aaa6bb27b2ebca4ac7f4b251c630f --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/MonthOfYearActivePowerRecord.avsc @@ -0,0 +1,33 @@ +{ + "type" : "record", + "name" : "MonthOfYearActivePowerRecord", + "namespace" : "rocks.theodolite.benchmarks.commons.model.records", + "fields" : [ { + "name" : "identifier", + "type" : "string" + }, { + "name" : "monthOfYear", + "type" : "int" + }, { + "name" : "periodStart", + "type" : "long" + }, { + "name" : "periodEnd", + "type" : "long" + }, { + "name" : "count", + "type" : "long" + }, { + "name" : "mean", + "type" : "double" + }, { + "name" : "populationVariance", + "type" : "double" + }, { + "name" : "min", + "type" : "double" + }, { + "name" : "max", + "type" : "double" + } ] +} \ No newline at end of file diff --git a/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/YearActivePowerRecord.avsc b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/YearActivePowerRecord.avsc new file mode 100644 index 0000000000000000000000000000000000000000..2bfc06b6649630fbde85f068e5b3a9d0312f5424 --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/avro/rocks/theodolite/benchmarks/commons/model/records/YearActivePowerRecord.avsc @@ -0,0 +1,33 @@ +{ + "type" : "record", + "name" : "YearActivePowerRecord", + "namespace" : "rocks.theodolite.benchmarks.commons.model.records", + "fields" : [ { + "name" : "identifier", + "type" : "string" + }, { + "name" : "year", + "type" : "int" + }, { + "name" : "periodStart", + "type" : "long" + }, { + "name" : "periodEnd", + "type" : "long" + }, { + "name" : "count", + "type" : "long" + }, { + "name" : "mean", + "type" : "double" + }, { + "name" : "populationVariance", + "type" : "double" + }, { + "name" : "min", + "type" : "double" + }, { + "name" : "max", + "type" : "double" + } ] +} \ No newline at end of file diff --git a/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/ActivePowerRecord.java b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/ActivePowerRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..27e0f39076e5384a89e3d8a91e4b08808244aa2a --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/ActivePowerRecord.java @@ -0,0 +1,492 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package rocks.theodolite.benchmarks.commons.model.records; + +import org.apache.avro.generic.GenericArray; +import org.apache.avro.specific.SpecificData; +import org.apache.avro.util.Utf8; +import org.apache.avro.message.BinaryMessageEncoder; +import org.apache.avro.message.BinaryMessageDecoder; +import org.apache.avro.message.SchemaStore; + +@org.apache.avro.specific.AvroGenerated +public class ActivePowerRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = -5809432381123606133L; + + + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ActivePowerRecord\",\"namespace\":\"rocks.theodolite.benchmarks.commons.model.records\",\"fields\":[{\"name\":\"identifier\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"*\"},{\"name\":\"timestamp\",\"type\":\"long\",\"doc\":\"*\"},{\"name\":\"valueInW\",\"type\":\"double\",\"doc\":\"*\"}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + + private static final SpecificData MODEL$ = new SpecificData(); + + private static final BinaryMessageEncoder<ActivePowerRecord> ENCODER = + new BinaryMessageEncoder<ActivePowerRecord>(MODEL$, SCHEMA$); + + private static final BinaryMessageDecoder<ActivePowerRecord> DECODER = + new BinaryMessageDecoder<ActivePowerRecord>(MODEL$, SCHEMA$); + + /** + * Return the BinaryMessageEncoder instance used by this class. + * @return the message encoder used by this class + */ + public static BinaryMessageEncoder<ActivePowerRecord> getEncoder() { + return ENCODER; + } + + /** + * Return the BinaryMessageDecoder instance used by this class. + * @return the message decoder used by this class + */ + public static BinaryMessageDecoder<ActivePowerRecord> getDecoder() { + return DECODER; + } + + /** + * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}. + * @param resolver a {@link SchemaStore} used to find schemas by fingerprint + * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore + */ + public static BinaryMessageDecoder<ActivePowerRecord> createDecoder(SchemaStore resolver) { + return new BinaryMessageDecoder<ActivePowerRecord>(MODEL$, SCHEMA$, resolver); + } + + /** + * Serializes this ActivePowerRecord to a ByteBuffer. + * @return a buffer holding the serialized data for this instance + * @throws java.io.IOException if this instance could not be serialized + */ + public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException { + return ENCODER.encode(this); + } + + /** + * Deserializes a ActivePowerRecord from a ByteBuffer. + * @param b a byte buffer holding serialized data for an instance of this class + * @return a ActivePowerRecord instance decoded from the given buffer + * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class + */ + public static ActivePowerRecord fromByteBuffer( + java.nio.ByteBuffer b) throws java.io.IOException { + return DECODER.decode(b); + } + + /** * */ + private java.lang.String identifier; + /** * */ + private long timestamp; + /** * */ + private double valueInW; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use <code>newBuilder()</code>. + */ + public ActivePowerRecord() {} + + /** + * All-args constructor. + * @param identifier * + * @param timestamp * + * @param valueInW * + */ + public ActivePowerRecord(java.lang.String identifier, java.lang.Long timestamp, java.lang.Double valueInW) { + this.identifier = identifier; + this.timestamp = timestamp; + this.valueInW = valueInW; + } + + public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return identifier; + case 1: return timestamp; + case 2: return valueInW; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: identifier = value$ != null ? value$.toString() : null; break; + case 1: timestamp = (java.lang.Long)value$; break; + case 2: valueInW = (java.lang.Double)value$; break; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + /** + * Gets the value of the 'identifier' field. + * @return * + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * * + * @param value the value to set. + */ + public void setIdentifier(java.lang.String value) { + this.identifier = value; + } + + /** + * Gets the value of the 'timestamp' field. + * @return * + */ + public long getTimestamp() { + return timestamp; + } + + + /** + * Sets the value of the 'timestamp' field. + * * + * @param value the value to set. + */ + public void setTimestamp(long value) { + this.timestamp = value; + } + + /** + * Gets the value of the 'valueInW' field. + * @return * + */ + public double getValueInW() { + return valueInW; + } + + + /** + * Sets the value of the 'valueInW' field. + * * + * @param value the value to set. + */ + public void setValueInW(double value) { + this.valueInW = value; + } + + /** + * Creates a new ActivePowerRecord RecordBuilder. + * @return A new ActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder newBuilder() { + return new rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder(); + } + + /** + * Creates a new ActivePowerRecord RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new ActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder(other); + } + } + + /** + * Creates a new ActivePowerRecord RecordBuilder by copying an existing ActivePowerRecord instance. + * @param other The existing instance to copy. + * @return A new ActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder(other); + } + } + + /** + * RecordBuilder for ActivePowerRecord instances. + */ + @org.apache.avro.specific.AvroGenerated + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ActivePowerRecord> + implements org.apache.avro.data.RecordBuilder<ActivePowerRecord> { + + /** * */ + private java.lang.String identifier; + /** * */ + private long timestamp; + /** * */ + private double valueInW; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$, MODEL$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder other) { + super(other); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = other.fieldSetFlags()[0]; + } + if (isValidValue(fields()[1], other.timestamp)) { + this.timestamp = data().deepCopy(fields()[1].schema(), other.timestamp); + fieldSetFlags()[1] = other.fieldSetFlags()[1]; + } + if (isValidValue(fields()[2], other.valueInW)) { + this.valueInW = data().deepCopy(fields()[2].schema(), other.valueInW); + fieldSetFlags()[2] = other.fieldSetFlags()[2]; + } + } + + /** + * Creates a Builder by copying an existing ActivePowerRecord instance + * @param other The existing instance to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord other) { + super(SCHEMA$, MODEL$); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.timestamp)) { + this.timestamp = data().deepCopy(fields()[1].schema(), other.timestamp); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.valueInW)) { + this.valueInW = data().deepCopy(fields()[2].schema(), other.valueInW); + fieldSetFlags()[2] = true; + } + } + + /** + * Gets the value of the 'identifier' field. + * * + * @return The value. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * * + * @param value The value of 'identifier'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder setIdentifier(java.lang.String value) { + validate(fields()[0], value); + this.identifier = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'identifier' field has been set. + * * + * @return True if the 'identifier' field has been set, false otherwise. + */ + public boolean hasIdentifier() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'identifier' field. + * * + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder clearIdentifier() { + identifier = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'timestamp' field. + * * + * @return The value. + */ + public long getTimestamp() { + return timestamp; + } + + + /** + * Sets the value of the 'timestamp' field. + * * + * @param value The value of 'timestamp'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder setTimestamp(long value) { + validate(fields()[1], value); + this.timestamp = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'timestamp' field has been set. + * * + * @return True if the 'timestamp' field has been set, false otherwise. + */ + public boolean hasTimestamp() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'timestamp' field. + * * + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder clearTimestamp() { + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'valueInW' field. + * * + * @return The value. + */ + public double getValueInW() { + return valueInW; + } + + + /** + * Sets the value of the 'valueInW' field. + * * + * @param value The value of 'valueInW'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder setValueInW(double value) { + validate(fields()[2], value); + this.valueInW = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'valueInW' field has been set. + * * + * @return True if the 'valueInW' field has been set, false otherwise. + */ + public boolean hasValueInW() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'valueInW' field. + * * + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord.Builder clearValueInW() { + fieldSetFlags()[2] = false; + return this; + } + + @Override + @SuppressWarnings("unchecked") + public ActivePowerRecord build() { + try { + ActivePowerRecord record = new ActivePowerRecord(); + record.identifier = fieldSetFlags()[0] ? this.identifier : (java.lang.String) defaultValue(fields()[0]); + record.timestamp = fieldSetFlags()[1] ? this.timestamp : (java.lang.Long) defaultValue(fields()[1]); + record.valueInW = fieldSetFlags()[2] ? this.valueInW : (java.lang.Double) defaultValue(fields()[2]); + return record; + } catch (org.apache.avro.AvroMissingFieldException e) { + throw e; + } catch (java.lang.Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumWriter<ActivePowerRecord> + WRITER$ = (org.apache.avro.io.DatumWriter<ActivePowerRecord>)MODEL$.createDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumReader<ActivePowerRecord> + READER$ = (org.apache.avro.io.DatumReader<ActivePowerRecord>)MODEL$.createDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + + @Override protected boolean hasCustomCoders() { return true; } + + @Override public void customEncode(org.apache.avro.io.Encoder out) + throws java.io.IOException + { + out.writeString(this.identifier); + + out.writeLong(this.timestamp); + + out.writeDouble(this.valueInW); + + } + + @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) + throws java.io.IOException + { + org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); + if (fieldOrder == null) { + this.identifier = in.readString(); + + this.timestamp = in.readLong(); + + this.valueInW = in.readDouble(); + + } else { + for (int i = 0; i < 3; i++) { + switch (fieldOrder[i].pos()) { + case 0: + this.identifier = in.readString(); + break; + + case 1: + this.timestamp = in.readLong(); + break; + + case 2: + this.valueInW = in.readDouble(); + break; + + default: + throw new java.io.IOException("Corrupt ResolvingDecoder."); + } + } + } + } +} + + + + + + + + + + diff --git a/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/AggregatedActivePowerRecord.java b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/AggregatedActivePowerRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..7aa6e0b5f988bae1f63d8a2817a1fed2b4880b6a --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/AggregatedActivePowerRecord.java @@ -0,0 +1,664 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package rocks.theodolite.benchmarks.commons.model.records; + +import org.apache.avro.generic.GenericArray; +import org.apache.avro.specific.SpecificData; +import org.apache.avro.util.Utf8; +import org.apache.avro.message.BinaryMessageEncoder; +import org.apache.avro.message.BinaryMessageDecoder; +import org.apache.avro.message.SchemaStore; + +@org.apache.avro.specific.AvroGenerated +public class AggregatedActivePowerRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = 334342381382209426L; + + + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AggregatedActivePowerRecord\",\"namespace\":\"rocks.theodolite.benchmarks.commons.model.records\",\"fields\":[{\"name\":\"identifier\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"*\"},{\"name\":\"timestamp\",\"type\":\"long\",\"doc\":\"*\"},{\"name\":\"count\",\"type\":\"long\",\"doc\":\"*\"},{\"name\":\"sumInW\",\"type\":\"double\",\"doc\":\"*\"},{\"name\":\"averageInW\",\"type\":\"double\",\"doc\":\"*\"}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + + private static final SpecificData MODEL$ = new SpecificData(); + + private static final BinaryMessageEncoder<AggregatedActivePowerRecord> ENCODER = + new BinaryMessageEncoder<AggregatedActivePowerRecord>(MODEL$, SCHEMA$); + + private static final BinaryMessageDecoder<AggregatedActivePowerRecord> DECODER = + new BinaryMessageDecoder<AggregatedActivePowerRecord>(MODEL$, SCHEMA$); + + /** + * Return the BinaryMessageEncoder instance used by this class. + * @return the message encoder used by this class + */ + public static BinaryMessageEncoder<AggregatedActivePowerRecord> getEncoder() { + return ENCODER; + } + + /** + * Return the BinaryMessageDecoder instance used by this class. + * @return the message decoder used by this class + */ + public static BinaryMessageDecoder<AggregatedActivePowerRecord> getDecoder() { + return DECODER; + } + + /** + * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}. + * @param resolver a {@link SchemaStore} used to find schemas by fingerprint + * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore + */ + public static BinaryMessageDecoder<AggregatedActivePowerRecord> createDecoder(SchemaStore resolver) { + return new BinaryMessageDecoder<AggregatedActivePowerRecord>(MODEL$, SCHEMA$, resolver); + } + + /** + * Serializes this AggregatedActivePowerRecord to a ByteBuffer. + * @return a buffer holding the serialized data for this instance + * @throws java.io.IOException if this instance could not be serialized + */ + public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException { + return ENCODER.encode(this); + } + + /** + * Deserializes a AggregatedActivePowerRecord from a ByteBuffer. + * @param b a byte buffer holding serialized data for an instance of this class + * @return a AggregatedActivePowerRecord instance decoded from the given buffer + * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class + */ + public static AggregatedActivePowerRecord fromByteBuffer( + java.nio.ByteBuffer b) throws java.io.IOException { + return DECODER.decode(b); + } + + /** * */ + private java.lang.String identifier; + /** * */ + private long timestamp; + /** * */ + private long count; + /** * */ + private double sumInW; + /** * */ + private double averageInW; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use <code>newBuilder()</code>. + */ + public AggregatedActivePowerRecord() {} + + /** + * All-args constructor. + * @param identifier * + * @param timestamp * + * @param count * + * @param sumInW * + * @param averageInW * + */ + public AggregatedActivePowerRecord(java.lang.String identifier, java.lang.Long timestamp, java.lang.Long count, java.lang.Double sumInW, java.lang.Double averageInW) { + this.identifier = identifier; + this.timestamp = timestamp; + this.count = count; + this.sumInW = sumInW; + this.averageInW = averageInW; + } + + public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return identifier; + case 1: return timestamp; + case 2: return count; + case 3: return sumInW; + case 4: return averageInW; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: identifier = value$ != null ? value$.toString() : null; break; + case 1: timestamp = (java.lang.Long)value$; break; + case 2: count = (java.lang.Long)value$; break; + case 3: sumInW = (java.lang.Double)value$; break; + case 4: averageInW = (java.lang.Double)value$; break; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + /** + * Gets the value of the 'identifier' field. + * @return * + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * * + * @param value the value to set. + */ + public void setIdentifier(java.lang.String value) { + this.identifier = value; + } + + /** + * Gets the value of the 'timestamp' field. + * @return * + */ + public long getTimestamp() { + return timestamp; + } + + + /** + * Sets the value of the 'timestamp' field. + * * + * @param value the value to set. + */ + public void setTimestamp(long value) { + this.timestamp = value; + } + + /** + * Gets the value of the 'count' field. + * @return * + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * * + * @param value the value to set. + */ + public void setCount(long value) { + this.count = value; + } + + /** + * Gets the value of the 'sumInW' field. + * @return * + */ + public double getSumInW() { + return sumInW; + } + + + /** + * Sets the value of the 'sumInW' field. + * * + * @param value the value to set. + */ + public void setSumInW(double value) { + this.sumInW = value; + } + + /** + * Gets the value of the 'averageInW' field. + * @return * + */ + public double getAverageInW() { + return averageInW; + } + + + /** + * Sets the value of the 'averageInW' field. + * * + * @param value the value to set. + */ + public void setAverageInW(double value) { + this.averageInW = value; + } + + /** + * Creates a new AggregatedActivePowerRecord RecordBuilder. + * @return A new AggregatedActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder newBuilder() { + return new rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder(); + } + + /** + * Creates a new AggregatedActivePowerRecord RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new AggregatedActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder(other); + } + } + + /** + * Creates a new AggregatedActivePowerRecord RecordBuilder by copying an existing AggregatedActivePowerRecord instance. + * @param other The existing instance to copy. + * @return A new AggregatedActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder(other); + } + } + + /** + * RecordBuilder for AggregatedActivePowerRecord instances. + */ + @org.apache.avro.specific.AvroGenerated + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AggregatedActivePowerRecord> + implements org.apache.avro.data.RecordBuilder<AggregatedActivePowerRecord> { + + /** * */ + private java.lang.String identifier; + /** * */ + private long timestamp; + /** * */ + private long count; + /** * */ + private double sumInW; + /** * */ + private double averageInW; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$, MODEL$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder other) { + super(other); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = other.fieldSetFlags()[0]; + } + if (isValidValue(fields()[1], other.timestamp)) { + this.timestamp = data().deepCopy(fields()[1].schema(), other.timestamp); + fieldSetFlags()[1] = other.fieldSetFlags()[1]; + } + if (isValidValue(fields()[2], other.count)) { + this.count = data().deepCopy(fields()[2].schema(), other.count); + fieldSetFlags()[2] = other.fieldSetFlags()[2]; + } + if (isValidValue(fields()[3], other.sumInW)) { + this.sumInW = data().deepCopy(fields()[3].schema(), other.sumInW); + fieldSetFlags()[3] = other.fieldSetFlags()[3]; + } + if (isValidValue(fields()[4], other.averageInW)) { + this.averageInW = data().deepCopy(fields()[4].schema(), other.averageInW); + fieldSetFlags()[4] = other.fieldSetFlags()[4]; + } + } + + /** + * Creates a Builder by copying an existing AggregatedActivePowerRecord instance + * @param other The existing instance to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord other) { + super(SCHEMA$, MODEL$); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.timestamp)) { + this.timestamp = data().deepCopy(fields()[1].schema(), other.timestamp); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.count)) { + this.count = data().deepCopy(fields()[2].schema(), other.count); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.sumInW)) { + this.sumInW = data().deepCopy(fields()[3].schema(), other.sumInW); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.averageInW)) { + this.averageInW = data().deepCopy(fields()[4].schema(), other.averageInW); + fieldSetFlags()[4] = true; + } + } + + /** + * Gets the value of the 'identifier' field. + * * + * @return The value. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * * + * @param value The value of 'identifier'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder setIdentifier(java.lang.String value) { + validate(fields()[0], value); + this.identifier = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'identifier' field has been set. + * * + * @return True if the 'identifier' field has been set, false otherwise. + */ + public boolean hasIdentifier() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'identifier' field. + * * + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder clearIdentifier() { + identifier = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'timestamp' field. + * * + * @return The value. + */ + public long getTimestamp() { + return timestamp; + } + + + /** + * Sets the value of the 'timestamp' field. + * * + * @param value The value of 'timestamp'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder setTimestamp(long value) { + validate(fields()[1], value); + this.timestamp = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'timestamp' field has been set. + * * + * @return True if the 'timestamp' field has been set, false otherwise. + */ + public boolean hasTimestamp() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'timestamp' field. + * * + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder clearTimestamp() { + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'count' field. + * * + * @return The value. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * * + * @param value The value of 'count'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder setCount(long value) { + validate(fields()[2], value); + this.count = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'count' field has been set. + * * + * @return True if the 'count' field has been set, false otherwise. + */ + public boolean hasCount() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'count' field. + * * + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder clearCount() { + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'sumInW' field. + * * + * @return The value. + */ + public double getSumInW() { + return sumInW; + } + + + /** + * Sets the value of the 'sumInW' field. + * * + * @param value The value of 'sumInW'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder setSumInW(double value) { + validate(fields()[3], value); + this.sumInW = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'sumInW' field has been set. + * * + * @return True if the 'sumInW' field has been set, false otherwise. + */ + public boolean hasSumInW() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'sumInW' field. + * * + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder clearSumInW() { + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'averageInW' field. + * * + * @return The value. + */ + public double getAverageInW() { + return averageInW; + } + + + /** + * Sets the value of the 'averageInW' field. + * * + * @param value The value of 'averageInW'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder setAverageInW(double value) { + validate(fields()[4], value); + this.averageInW = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'averageInW' field has been set. + * * + * @return True if the 'averageInW' field has been set, false otherwise. + */ + public boolean hasAverageInW() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'averageInW' field. + * * + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord.Builder clearAverageInW() { + fieldSetFlags()[4] = false; + return this; + } + + @Override + @SuppressWarnings("unchecked") + public AggregatedActivePowerRecord build() { + try { + AggregatedActivePowerRecord record = new AggregatedActivePowerRecord(); + record.identifier = fieldSetFlags()[0] ? this.identifier : (java.lang.String) defaultValue(fields()[0]); + record.timestamp = fieldSetFlags()[1] ? this.timestamp : (java.lang.Long) defaultValue(fields()[1]); + record.count = fieldSetFlags()[2] ? this.count : (java.lang.Long) defaultValue(fields()[2]); + record.sumInW = fieldSetFlags()[3] ? this.sumInW : (java.lang.Double) defaultValue(fields()[3]); + record.averageInW = fieldSetFlags()[4] ? this.averageInW : (java.lang.Double) defaultValue(fields()[4]); + return record; + } catch (org.apache.avro.AvroMissingFieldException e) { + throw e; + } catch (java.lang.Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumWriter<AggregatedActivePowerRecord> + WRITER$ = (org.apache.avro.io.DatumWriter<AggregatedActivePowerRecord>)MODEL$.createDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumReader<AggregatedActivePowerRecord> + READER$ = (org.apache.avro.io.DatumReader<AggregatedActivePowerRecord>)MODEL$.createDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + + @Override protected boolean hasCustomCoders() { return true; } + + @Override public void customEncode(org.apache.avro.io.Encoder out) + throws java.io.IOException + { + out.writeString(this.identifier); + + out.writeLong(this.timestamp); + + out.writeLong(this.count); + + out.writeDouble(this.sumInW); + + out.writeDouble(this.averageInW); + + } + + @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) + throws java.io.IOException + { + org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); + if (fieldOrder == null) { + this.identifier = in.readString(); + + this.timestamp = in.readLong(); + + this.count = in.readLong(); + + this.sumInW = in.readDouble(); + + this.averageInW = in.readDouble(); + + } else { + for (int i = 0; i < 5; i++) { + switch (fieldOrder[i].pos()) { + case 0: + this.identifier = in.readString(); + break; + + case 1: + this.timestamp = in.readLong(); + break; + + case 2: + this.count = in.readLong(); + break; + + case 3: + this.sumInW = in.readDouble(); + break; + + case 4: + this.averageInW = in.readDouble(); + break; + + default: + throw new java.io.IOException("Corrupt ResolvingDecoder."); + } + } + } + } +} + + + + + + + + + + diff --git a/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/DayOfWeekActivePowerRecord.java b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/DayOfWeekActivePowerRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..6e6917a6393f6b7deea3237384f08094a9cfc200 --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/DayOfWeekActivePowerRecord.java @@ -0,0 +1,945 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package rocks.theodolite.benchmarks.commons.model.records; + +import org.apache.avro.generic.GenericArray; +import org.apache.avro.specific.SpecificData; +import org.apache.avro.util.Utf8; +import org.apache.avro.message.BinaryMessageEncoder; +import org.apache.avro.message.BinaryMessageDecoder; +import org.apache.avro.message.SchemaStore; + +@org.apache.avro.specific.AvroGenerated +public class DayOfWeekActivePowerRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = 874988617222069934L; + + + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"DayOfWeekActivePowerRecord\",\"namespace\":\"rocks.theodolite.benchmarks.commons.model.records\",\"fields\":[{\"name\":\"identifier\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"dayOfWeek\",\"type\":\"int\"},{\"name\":\"periodStart\",\"type\":\"long\"},{\"name\":\"periodEnd\",\"type\":\"long\"},{\"name\":\"count\",\"type\":\"long\"},{\"name\":\"mean\",\"type\":\"double\"},{\"name\":\"populationVariance\",\"type\":\"double\"},{\"name\":\"min\",\"type\":\"double\"},{\"name\":\"max\",\"type\":\"double\"}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + + private static final SpecificData MODEL$ = new SpecificData(); + + private static final BinaryMessageEncoder<DayOfWeekActivePowerRecord> ENCODER = + new BinaryMessageEncoder<DayOfWeekActivePowerRecord>(MODEL$, SCHEMA$); + + private static final BinaryMessageDecoder<DayOfWeekActivePowerRecord> DECODER = + new BinaryMessageDecoder<DayOfWeekActivePowerRecord>(MODEL$, SCHEMA$); + + /** + * Return the BinaryMessageEncoder instance used by this class. + * @return the message encoder used by this class + */ + public static BinaryMessageEncoder<DayOfWeekActivePowerRecord> getEncoder() { + return ENCODER; + } + + /** + * Return the BinaryMessageDecoder instance used by this class. + * @return the message decoder used by this class + */ + public static BinaryMessageDecoder<DayOfWeekActivePowerRecord> getDecoder() { + return DECODER; + } + + /** + * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}. + * @param resolver a {@link SchemaStore} used to find schemas by fingerprint + * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore + */ + public static BinaryMessageDecoder<DayOfWeekActivePowerRecord> createDecoder(SchemaStore resolver) { + return new BinaryMessageDecoder<DayOfWeekActivePowerRecord>(MODEL$, SCHEMA$, resolver); + } + + /** + * Serializes this DayOfWeekActivePowerRecord to a ByteBuffer. + * @return a buffer holding the serialized data for this instance + * @throws java.io.IOException if this instance could not be serialized + */ + public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException { + return ENCODER.encode(this); + } + + /** + * Deserializes a DayOfWeekActivePowerRecord from a ByteBuffer. + * @param b a byte buffer holding serialized data for an instance of this class + * @return a DayOfWeekActivePowerRecord instance decoded from the given buffer + * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class + */ + public static DayOfWeekActivePowerRecord fromByteBuffer( + java.nio.ByteBuffer b) throws java.io.IOException { + return DECODER.decode(b); + } + + private java.lang.String identifier; + private int dayOfWeek; + private long periodStart; + private long periodEnd; + private long count; + private double mean; + private double populationVariance; + private double min; + private double max; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use <code>newBuilder()</code>. + */ + public DayOfWeekActivePowerRecord() {} + + /** + * All-args constructor. + * @param identifier The new value for identifier + * @param dayOfWeek The new value for dayOfWeek + * @param periodStart The new value for periodStart + * @param periodEnd The new value for periodEnd + * @param count The new value for count + * @param mean The new value for mean + * @param populationVariance The new value for populationVariance + * @param min The new value for min + * @param max The new value for max + */ + public DayOfWeekActivePowerRecord(java.lang.String identifier, java.lang.Integer dayOfWeek, java.lang.Long periodStart, java.lang.Long periodEnd, java.lang.Long count, java.lang.Double mean, java.lang.Double populationVariance, java.lang.Double min, java.lang.Double max) { + this.identifier = identifier; + this.dayOfWeek = dayOfWeek; + this.periodStart = periodStart; + this.periodEnd = periodEnd; + this.count = count; + this.mean = mean; + this.populationVariance = populationVariance; + this.min = min; + this.max = max; + } + + public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return identifier; + case 1: return dayOfWeek; + case 2: return periodStart; + case 3: return periodEnd; + case 4: return count; + case 5: return mean; + case 6: return populationVariance; + case 7: return min; + case 8: return max; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: identifier = value$ != null ? value$.toString() : null; break; + case 1: dayOfWeek = (java.lang.Integer)value$; break; + case 2: periodStart = (java.lang.Long)value$; break; + case 3: periodEnd = (java.lang.Long)value$; break; + case 4: count = (java.lang.Long)value$; break; + case 5: mean = (java.lang.Double)value$; break; + case 6: populationVariance = (java.lang.Double)value$; break; + case 7: min = (java.lang.Double)value$; break; + case 8: max = (java.lang.Double)value$; break; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + /** + * Gets the value of the 'identifier' field. + * @return The value of the 'identifier' field. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * @param value the value to set. + */ + public void setIdentifier(java.lang.String value) { + this.identifier = value; + } + + /** + * Gets the value of the 'dayOfWeek' field. + * @return The value of the 'dayOfWeek' field. + */ + public int getDayOfWeek() { + return dayOfWeek; + } + + + /** + * Sets the value of the 'dayOfWeek' field. + * @param value the value to set. + */ + public void setDayOfWeek(int value) { + this.dayOfWeek = value; + } + + /** + * Gets the value of the 'periodStart' field. + * @return The value of the 'periodStart' field. + */ + public long getPeriodStart() { + return periodStart; + } + + + /** + * Sets the value of the 'periodStart' field. + * @param value the value to set. + */ + public void setPeriodStart(long value) { + this.periodStart = value; + } + + /** + * Gets the value of the 'periodEnd' field. + * @return The value of the 'periodEnd' field. + */ + public long getPeriodEnd() { + return periodEnd; + } + + + /** + * Sets the value of the 'periodEnd' field. + * @param value the value to set. + */ + public void setPeriodEnd(long value) { + this.periodEnd = value; + } + + /** + * Gets the value of the 'count' field. + * @return The value of the 'count' field. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * @param value the value to set. + */ + public void setCount(long value) { + this.count = value; + } + + /** + * Gets the value of the 'mean' field. + * @return The value of the 'mean' field. + */ + public double getMean() { + return mean; + } + + + /** + * Sets the value of the 'mean' field. + * @param value the value to set. + */ + public void setMean(double value) { + this.mean = value; + } + + /** + * Gets the value of the 'populationVariance' field. + * @return The value of the 'populationVariance' field. + */ + public double getPopulationVariance() { + return populationVariance; + } + + + /** + * Sets the value of the 'populationVariance' field. + * @param value the value to set. + */ + public void setPopulationVariance(double value) { + this.populationVariance = value; + } + + /** + * Gets the value of the 'min' field. + * @return The value of the 'min' field. + */ + public double getMin() { + return min; + } + + + /** + * Sets the value of the 'min' field. + * @param value the value to set. + */ + public void setMin(double value) { + this.min = value; + } + + /** + * Gets the value of the 'max' field. + * @return The value of the 'max' field. + */ + public double getMax() { + return max; + } + + + /** + * Sets the value of the 'max' field. + * @param value the value to set. + */ + public void setMax(double value) { + this.max = value; + } + + /** + * Creates a new DayOfWeekActivePowerRecord RecordBuilder. + * @return A new DayOfWeekActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder newBuilder() { + return new rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder(); + } + + /** + * Creates a new DayOfWeekActivePowerRecord RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new DayOfWeekActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder(other); + } + } + + /** + * Creates a new DayOfWeekActivePowerRecord RecordBuilder by copying an existing DayOfWeekActivePowerRecord instance. + * @param other The existing instance to copy. + * @return A new DayOfWeekActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder(other); + } + } + + /** + * RecordBuilder for DayOfWeekActivePowerRecord instances. + */ + @org.apache.avro.specific.AvroGenerated + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<DayOfWeekActivePowerRecord> + implements org.apache.avro.data.RecordBuilder<DayOfWeekActivePowerRecord> { + + private java.lang.String identifier; + private int dayOfWeek; + private long periodStart; + private long periodEnd; + private long count; + private double mean; + private double populationVariance; + private double min; + private double max; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$, MODEL$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder other) { + super(other); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = other.fieldSetFlags()[0]; + } + if (isValidValue(fields()[1], other.dayOfWeek)) { + this.dayOfWeek = data().deepCopy(fields()[1].schema(), other.dayOfWeek); + fieldSetFlags()[1] = other.fieldSetFlags()[1]; + } + if (isValidValue(fields()[2], other.periodStart)) { + this.periodStart = data().deepCopy(fields()[2].schema(), other.periodStart); + fieldSetFlags()[2] = other.fieldSetFlags()[2]; + } + if (isValidValue(fields()[3], other.periodEnd)) { + this.periodEnd = data().deepCopy(fields()[3].schema(), other.periodEnd); + fieldSetFlags()[3] = other.fieldSetFlags()[3]; + } + if (isValidValue(fields()[4], other.count)) { + this.count = data().deepCopy(fields()[4].schema(), other.count); + fieldSetFlags()[4] = other.fieldSetFlags()[4]; + } + if (isValidValue(fields()[5], other.mean)) { + this.mean = data().deepCopy(fields()[5].schema(), other.mean); + fieldSetFlags()[5] = other.fieldSetFlags()[5]; + } + if (isValidValue(fields()[6], other.populationVariance)) { + this.populationVariance = data().deepCopy(fields()[6].schema(), other.populationVariance); + fieldSetFlags()[6] = other.fieldSetFlags()[6]; + } + if (isValidValue(fields()[7], other.min)) { + this.min = data().deepCopy(fields()[7].schema(), other.min); + fieldSetFlags()[7] = other.fieldSetFlags()[7]; + } + if (isValidValue(fields()[8], other.max)) { + this.max = data().deepCopy(fields()[8].schema(), other.max); + fieldSetFlags()[8] = other.fieldSetFlags()[8]; + } + } + + /** + * Creates a Builder by copying an existing DayOfWeekActivePowerRecord instance + * @param other The existing instance to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord other) { + super(SCHEMA$, MODEL$); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.dayOfWeek)) { + this.dayOfWeek = data().deepCopy(fields()[1].schema(), other.dayOfWeek); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.periodStart)) { + this.periodStart = data().deepCopy(fields()[2].schema(), other.periodStart); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.periodEnd)) { + this.periodEnd = data().deepCopy(fields()[3].schema(), other.periodEnd); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.count)) { + this.count = data().deepCopy(fields()[4].schema(), other.count); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.mean)) { + this.mean = data().deepCopy(fields()[5].schema(), other.mean); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.populationVariance)) { + this.populationVariance = data().deepCopy(fields()[6].schema(), other.populationVariance); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.min)) { + this.min = data().deepCopy(fields()[7].schema(), other.min); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.max)) { + this.max = data().deepCopy(fields()[8].schema(), other.max); + fieldSetFlags()[8] = true; + } + } + + /** + * Gets the value of the 'identifier' field. + * @return The value. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * @param value The value of 'identifier'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder setIdentifier(java.lang.String value) { + validate(fields()[0], value); + this.identifier = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'identifier' field has been set. + * @return True if the 'identifier' field has been set, false otherwise. + */ + public boolean hasIdentifier() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'identifier' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder clearIdentifier() { + identifier = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'dayOfWeek' field. + * @return The value. + */ + public int getDayOfWeek() { + return dayOfWeek; + } + + + /** + * Sets the value of the 'dayOfWeek' field. + * @param value The value of 'dayOfWeek'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder setDayOfWeek(int value) { + validate(fields()[1], value); + this.dayOfWeek = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'dayOfWeek' field has been set. + * @return True if the 'dayOfWeek' field has been set, false otherwise. + */ + public boolean hasDayOfWeek() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'dayOfWeek' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder clearDayOfWeek() { + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'periodStart' field. + * @return The value. + */ + public long getPeriodStart() { + return periodStart; + } + + + /** + * Sets the value of the 'periodStart' field. + * @param value The value of 'periodStart'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder setPeriodStart(long value) { + validate(fields()[2], value); + this.periodStart = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'periodStart' field has been set. + * @return True if the 'periodStart' field has been set, false otherwise. + */ + public boolean hasPeriodStart() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'periodStart' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder clearPeriodStart() { + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'periodEnd' field. + * @return The value. + */ + public long getPeriodEnd() { + return periodEnd; + } + + + /** + * Sets the value of the 'periodEnd' field. + * @param value The value of 'periodEnd'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder setPeriodEnd(long value) { + validate(fields()[3], value); + this.periodEnd = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'periodEnd' field has been set. + * @return True if the 'periodEnd' field has been set, false otherwise. + */ + public boolean hasPeriodEnd() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'periodEnd' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder clearPeriodEnd() { + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'count' field. + * @return The value. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * @param value The value of 'count'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder setCount(long value) { + validate(fields()[4], value); + this.count = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'count' field has been set. + * @return True if the 'count' field has been set, false otherwise. + */ + public boolean hasCount() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'count' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder clearCount() { + fieldSetFlags()[4] = false; + return this; + } + + /** + * Gets the value of the 'mean' field. + * @return The value. + */ + public double getMean() { + return mean; + } + + + /** + * Sets the value of the 'mean' field. + * @param value The value of 'mean'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder setMean(double value) { + validate(fields()[5], value); + this.mean = value; + fieldSetFlags()[5] = true; + return this; + } + + /** + * Checks whether the 'mean' field has been set. + * @return True if the 'mean' field has been set, false otherwise. + */ + public boolean hasMean() { + return fieldSetFlags()[5]; + } + + + /** + * Clears the value of the 'mean' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder clearMean() { + fieldSetFlags()[5] = false; + return this; + } + + /** + * Gets the value of the 'populationVariance' field. + * @return The value. + */ + public double getPopulationVariance() { + return populationVariance; + } + + + /** + * Sets the value of the 'populationVariance' field. + * @param value The value of 'populationVariance'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder setPopulationVariance(double value) { + validate(fields()[6], value); + this.populationVariance = value; + fieldSetFlags()[6] = true; + return this; + } + + /** + * Checks whether the 'populationVariance' field has been set. + * @return True if the 'populationVariance' field has been set, false otherwise. + */ + public boolean hasPopulationVariance() { + return fieldSetFlags()[6]; + } + + + /** + * Clears the value of the 'populationVariance' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder clearPopulationVariance() { + fieldSetFlags()[6] = false; + return this; + } + + /** + * Gets the value of the 'min' field. + * @return The value. + */ + public double getMin() { + return min; + } + + + /** + * Sets the value of the 'min' field. + * @param value The value of 'min'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder setMin(double value) { + validate(fields()[7], value); + this.min = value; + fieldSetFlags()[7] = true; + return this; + } + + /** + * Checks whether the 'min' field has been set. + * @return True if the 'min' field has been set, false otherwise. + */ + public boolean hasMin() { + return fieldSetFlags()[7]; + } + + + /** + * Clears the value of the 'min' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder clearMin() { + fieldSetFlags()[7] = false; + return this; + } + + /** + * Gets the value of the 'max' field. + * @return The value. + */ + public double getMax() { + return max; + } + + + /** + * Sets the value of the 'max' field. + * @param value The value of 'max'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder setMax(double value) { + validate(fields()[8], value); + this.max = value; + fieldSetFlags()[8] = true; + return this; + } + + /** + * Checks whether the 'max' field has been set. + * @return True if the 'max' field has been set, false otherwise. + */ + public boolean hasMax() { + return fieldSetFlags()[8]; + } + + + /** + * Clears the value of the 'max' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.DayOfWeekActivePowerRecord.Builder clearMax() { + fieldSetFlags()[8] = false; + return this; + } + + @Override + @SuppressWarnings("unchecked") + public DayOfWeekActivePowerRecord build() { + try { + DayOfWeekActivePowerRecord record = new DayOfWeekActivePowerRecord(); + record.identifier = fieldSetFlags()[0] ? this.identifier : (java.lang.String) defaultValue(fields()[0]); + record.dayOfWeek = fieldSetFlags()[1] ? this.dayOfWeek : (java.lang.Integer) defaultValue(fields()[1]); + record.periodStart = fieldSetFlags()[2] ? this.periodStart : (java.lang.Long) defaultValue(fields()[2]); + record.periodEnd = fieldSetFlags()[3] ? this.periodEnd : (java.lang.Long) defaultValue(fields()[3]); + record.count = fieldSetFlags()[4] ? this.count : (java.lang.Long) defaultValue(fields()[4]); + record.mean = fieldSetFlags()[5] ? this.mean : (java.lang.Double) defaultValue(fields()[5]); + record.populationVariance = fieldSetFlags()[6] ? this.populationVariance : (java.lang.Double) defaultValue(fields()[6]); + record.min = fieldSetFlags()[7] ? this.min : (java.lang.Double) defaultValue(fields()[7]); + record.max = fieldSetFlags()[8] ? this.max : (java.lang.Double) defaultValue(fields()[8]); + return record; + } catch (org.apache.avro.AvroMissingFieldException e) { + throw e; + } catch (java.lang.Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumWriter<DayOfWeekActivePowerRecord> + WRITER$ = (org.apache.avro.io.DatumWriter<DayOfWeekActivePowerRecord>)MODEL$.createDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumReader<DayOfWeekActivePowerRecord> + READER$ = (org.apache.avro.io.DatumReader<DayOfWeekActivePowerRecord>)MODEL$.createDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + + @Override protected boolean hasCustomCoders() { return true; } + + @Override public void customEncode(org.apache.avro.io.Encoder out) + throws java.io.IOException + { + out.writeString(this.identifier); + + out.writeInt(this.dayOfWeek); + + out.writeLong(this.periodStart); + + out.writeLong(this.periodEnd); + + out.writeLong(this.count); + + out.writeDouble(this.mean); + + out.writeDouble(this.populationVariance); + + out.writeDouble(this.min); + + out.writeDouble(this.max); + + } + + @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) + throws java.io.IOException + { + org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); + if (fieldOrder == null) { + this.identifier = in.readString(); + + this.dayOfWeek = in.readInt(); + + this.periodStart = in.readLong(); + + this.periodEnd = in.readLong(); + + this.count = in.readLong(); + + this.mean = in.readDouble(); + + this.populationVariance = in.readDouble(); + + this.min = in.readDouble(); + + this.max = in.readDouble(); + + } else { + for (int i = 0; i < 9; i++) { + switch (fieldOrder[i].pos()) { + case 0: + this.identifier = in.readString(); + break; + + case 1: + this.dayOfWeek = in.readInt(); + break; + + case 2: + this.periodStart = in.readLong(); + break; + + case 3: + this.periodEnd = in.readLong(); + break; + + case 4: + this.count = in.readLong(); + break; + + case 5: + this.mean = in.readDouble(); + break; + + case 6: + this.populationVariance = in.readDouble(); + break; + + case 7: + this.min = in.readDouble(); + break; + + case 8: + this.max = in.readDouble(); + break; + + default: + throw new java.io.IOException("Corrupt ResolvingDecoder."); + } + } + } + } +} + + + + + + + + + + diff --git a/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/HourOfDayActivePowerRecord.java b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/HourOfDayActivePowerRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..491a91f4dfe5d439d094d66290d82d77001e72c9 --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/HourOfDayActivePowerRecord.java @@ -0,0 +1,945 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package rocks.theodolite.benchmarks.commons.model.records; + +import org.apache.avro.generic.GenericArray; +import org.apache.avro.specific.SpecificData; +import org.apache.avro.util.Utf8; +import org.apache.avro.message.BinaryMessageEncoder; +import org.apache.avro.message.BinaryMessageDecoder; +import org.apache.avro.message.SchemaStore; + +@org.apache.avro.specific.AvroGenerated +public class HourOfDayActivePowerRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = 6460936513507715126L; + + + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"HourOfDayActivePowerRecord\",\"namespace\":\"rocks.theodolite.benchmarks.commons.model.records\",\"fields\":[{\"name\":\"identifier\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"hourOfDay\",\"type\":\"int\"},{\"name\":\"periodStart\",\"type\":\"long\"},{\"name\":\"periodEnd\",\"type\":\"long\"},{\"name\":\"count\",\"type\":\"long\"},{\"name\":\"mean\",\"type\":\"double\"},{\"name\":\"populationVariance\",\"type\":\"double\"},{\"name\":\"min\",\"type\":\"double\"},{\"name\":\"max\",\"type\":\"double\"}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + + private static final SpecificData MODEL$ = new SpecificData(); + + private static final BinaryMessageEncoder<HourOfDayActivePowerRecord> ENCODER = + new BinaryMessageEncoder<HourOfDayActivePowerRecord>(MODEL$, SCHEMA$); + + private static final BinaryMessageDecoder<HourOfDayActivePowerRecord> DECODER = + new BinaryMessageDecoder<HourOfDayActivePowerRecord>(MODEL$, SCHEMA$); + + /** + * Return the BinaryMessageEncoder instance used by this class. + * @return the message encoder used by this class + */ + public static BinaryMessageEncoder<HourOfDayActivePowerRecord> getEncoder() { + return ENCODER; + } + + /** + * Return the BinaryMessageDecoder instance used by this class. + * @return the message decoder used by this class + */ + public static BinaryMessageDecoder<HourOfDayActivePowerRecord> getDecoder() { + return DECODER; + } + + /** + * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}. + * @param resolver a {@link SchemaStore} used to find schemas by fingerprint + * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore + */ + public static BinaryMessageDecoder<HourOfDayActivePowerRecord> createDecoder(SchemaStore resolver) { + return new BinaryMessageDecoder<HourOfDayActivePowerRecord>(MODEL$, SCHEMA$, resolver); + } + + /** + * Serializes this HourOfDayActivePowerRecord to a ByteBuffer. + * @return a buffer holding the serialized data for this instance + * @throws java.io.IOException if this instance could not be serialized + */ + public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException { + return ENCODER.encode(this); + } + + /** + * Deserializes a HourOfDayActivePowerRecord from a ByteBuffer. + * @param b a byte buffer holding serialized data for an instance of this class + * @return a HourOfDayActivePowerRecord instance decoded from the given buffer + * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class + */ + public static HourOfDayActivePowerRecord fromByteBuffer( + java.nio.ByteBuffer b) throws java.io.IOException { + return DECODER.decode(b); + } + + private java.lang.String identifier; + private int hourOfDay; + private long periodStart; + private long periodEnd; + private long count; + private double mean; + private double populationVariance; + private double min; + private double max; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use <code>newBuilder()</code>. + */ + public HourOfDayActivePowerRecord() {} + + /** + * All-args constructor. + * @param identifier The new value for identifier + * @param hourOfDay The new value for hourOfDay + * @param periodStart The new value for periodStart + * @param periodEnd The new value for periodEnd + * @param count The new value for count + * @param mean The new value for mean + * @param populationVariance The new value for populationVariance + * @param min The new value for min + * @param max The new value for max + */ + public HourOfDayActivePowerRecord(java.lang.String identifier, java.lang.Integer hourOfDay, java.lang.Long periodStart, java.lang.Long periodEnd, java.lang.Long count, java.lang.Double mean, java.lang.Double populationVariance, java.lang.Double min, java.lang.Double max) { + this.identifier = identifier; + this.hourOfDay = hourOfDay; + this.periodStart = periodStart; + this.periodEnd = periodEnd; + this.count = count; + this.mean = mean; + this.populationVariance = populationVariance; + this.min = min; + this.max = max; + } + + public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return identifier; + case 1: return hourOfDay; + case 2: return periodStart; + case 3: return periodEnd; + case 4: return count; + case 5: return mean; + case 6: return populationVariance; + case 7: return min; + case 8: return max; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: identifier = value$ != null ? value$.toString() : null; break; + case 1: hourOfDay = (java.lang.Integer)value$; break; + case 2: periodStart = (java.lang.Long)value$; break; + case 3: periodEnd = (java.lang.Long)value$; break; + case 4: count = (java.lang.Long)value$; break; + case 5: mean = (java.lang.Double)value$; break; + case 6: populationVariance = (java.lang.Double)value$; break; + case 7: min = (java.lang.Double)value$; break; + case 8: max = (java.lang.Double)value$; break; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + /** + * Gets the value of the 'identifier' field. + * @return The value of the 'identifier' field. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * @param value the value to set. + */ + public void setIdentifier(java.lang.String value) { + this.identifier = value; + } + + /** + * Gets the value of the 'hourOfDay' field. + * @return The value of the 'hourOfDay' field. + */ + public int getHourOfDay() { + return hourOfDay; + } + + + /** + * Sets the value of the 'hourOfDay' field. + * @param value the value to set. + */ + public void setHourOfDay(int value) { + this.hourOfDay = value; + } + + /** + * Gets the value of the 'periodStart' field. + * @return The value of the 'periodStart' field. + */ + public long getPeriodStart() { + return periodStart; + } + + + /** + * Sets the value of the 'periodStart' field. + * @param value the value to set. + */ + public void setPeriodStart(long value) { + this.periodStart = value; + } + + /** + * Gets the value of the 'periodEnd' field. + * @return The value of the 'periodEnd' field. + */ + public long getPeriodEnd() { + return periodEnd; + } + + + /** + * Sets the value of the 'periodEnd' field. + * @param value the value to set. + */ + public void setPeriodEnd(long value) { + this.periodEnd = value; + } + + /** + * Gets the value of the 'count' field. + * @return The value of the 'count' field. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * @param value the value to set. + */ + public void setCount(long value) { + this.count = value; + } + + /** + * Gets the value of the 'mean' field. + * @return The value of the 'mean' field. + */ + public double getMean() { + return mean; + } + + + /** + * Sets the value of the 'mean' field. + * @param value the value to set. + */ + public void setMean(double value) { + this.mean = value; + } + + /** + * Gets the value of the 'populationVariance' field. + * @return The value of the 'populationVariance' field. + */ + public double getPopulationVariance() { + return populationVariance; + } + + + /** + * Sets the value of the 'populationVariance' field. + * @param value the value to set. + */ + public void setPopulationVariance(double value) { + this.populationVariance = value; + } + + /** + * Gets the value of the 'min' field. + * @return The value of the 'min' field. + */ + public double getMin() { + return min; + } + + + /** + * Sets the value of the 'min' field. + * @param value the value to set. + */ + public void setMin(double value) { + this.min = value; + } + + /** + * Gets the value of the 'max' field. + * @return The value of the 'max' field. + */ + public double getMax() { + return max; + } + + + /** + * Sets the value of the 'max' field. + * @param value the value to set. + */ + public void setMax(double value) { + this.max = value; + } + + /** + * Creates a new HourOfDayActivePowerRecord RecordBuilder. + * @return A new HourOfDayActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder newBuilder() { + return new rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder(); + } + + /** + * Creates a new HourOfDayActivePowerRecord RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new HourOfDayActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder(other); + } + } + + /** + * Creates a new HourOfDayActivePowerRecord RecordBuilder by copying an existing HourOfDayActivePowerRecord instance. + * @param other The existing instance to copy. + * @return A new HourOfDayActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder(other); + } + } + + /** + * RecordBuilder for HourOfDayActivePowerRecord instances. + */ + @org.apache.avro.specific.AvroGenerated + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<HourOfDayActivePowerRecord> + implements org.apache.avro.data.RecordBuilder<HourOfDayActivePowerRecord> { + + private java.lang.String identifier; + private int hourOfDay; + private long periodStart; + private long periodEnd; + private long count; + private double mean; + private double populationVariance; + private double min; + private double max; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$, MODEL$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder other) { + super(other); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = other.fieldSetFlags()[0]; + } + if (isValidValue(fields()[1], other.hourOfDay)) { + this.hourOfDay = data().deepCopy(fields()[1].schema(), other.hourOfDay); + fieldSetFlags()[1] = other.fieldSetFlags()[1]; + } + if (isValidValue(fields()[2], other.periodStart)) { + this.periodStart = data().deepCopy(fields()[2].schema(), other.periodStart); + fieldSetFlags()[2] = other.fieldSetFlags()[2]; + } + if (isValidValue(fields()[3], other.periodEnd)) { + this.periodEnd = data().deepCopy(fields()[3].schema(), other.periodEnd); + fieldSetFlags()[3] = other.fieldSetFlags()[3]; + } + if (isValidValue(fields()[4], other.count)) { + this.count = data().deepCopy(fields()[4].schema(), other.count); + fieldSetFlags()[4] = other.fieldSetFlags()[4]; + } + if (isValidValue(fields()[5], other.mean)) { + this.mean = data().deepCopy(fields()[5].schema(), other.mean); + fieldSetFlags()[5] = other.fieldSetFlags()[5]; + } + if (isValidValue(fields()[6], other.populationVariance)) { + this.populationVariance = data().deepCopy(fields()[6].schema(), other.populationVariance); + fieldSetFlags()[6] = other.fieldSetFlags()[6]; + } + if (isValidValue(fields()[7], other.min)) { + this.min = data().deepCopy(fields()[7].schema(), other.min); + fieldSetFlags()[7] = other.fieldSetFlags()[7]; + } + if (isValidValue(fields()[8], other.max)) { + this.max = data().deepCopy(fields()[8].schema(), other.max); + fieldSetFlags()[8] = other.fieldSetFlags()[8]; + } + } + + /** + * Creates a Builder by copying an existing HourOfDayActivePowerRecord instance + * @param other The existing instance to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord other) { + super(SCHEMA$, MODEL$); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.hourOfDay)) { + this.hourOfDay = data().deepCopy(fields()[1].schema(), other.hourOfDay); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.periodStart)) { + this.periodStart = data().deepCopy(fields()[2].schema(), other.periodStart); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.periodEnd)) { + this.periodEnd = data().deepCopy(fields()[3].schema(), other.periodEnd); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.count)) { + this.count = data().deepCopy(fields()[4].schema(), other.count); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.mean)) { + this.mean = data().deepCopy(fields()[5].schema(), other.mean); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.populationVariance)) { + this.populationVariance = data().deepCopy(fields()[6].schema(), other.populationVariance); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.min)) { + this.min = data().deepCopy(fields()[7].schema(), other.min); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.max)) { + this.max = data().deepCopy(fields()[8].schema(), other.max); + fieldSetFlags()[8] = true; + } + } + + /** + * Gets the value of the 'identifier' field. + * @return The value. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * @param value The value of 'identifier'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder setIdentifier(java.lang.String value) { + validate(fields()[0], value); + this.identifier = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'identifier' field has been set. + * @return True if the 'identifier' field has been set, false otherwise. + */ + public boolean hasIdentifier() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'identifier' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder clearIdentifier() { + identifier = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'hourOfDay' field. + * @return The value. + */ + public int getHourOfDay() { + return hourOfDay; + } + + + /** + * Sets the value of the 'hourOfDay' field. + * @param value The value of 'hourOfDay'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder setHourOfDay(int value) { + validate(fields()[1], value); + this.hourOfDay = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'hourOfDay' field has been set. + * @return True if the 'hourOfDay' field has been set, false otherwise. + */ + public boolean hasHourOfDay() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'hourOfDay' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder clearHourOfDay() { + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'periodStart' field. + * @return The value. + */ + public long getPeriodStart() { + return periodStart; + } + + + /** + * Sets the value of the 'periodStart' field. + * @param value The value of 'periodStart'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder setPeriodStart(long value) { + validate(fields()[2], value); + this.periodStart = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'periodStart' field has been set. + * @return True if the 'periodStart' field has been set, false otherwise. + */ + public boolean hasPeriodStart() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'periodStart' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder clearPeriodStart() { + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'periodEnd' field. + * @return The value. + */ + public long getPeriodEnd() { + return periodEnd; + } + + + /** + * Sets the value of the 'periodEnd' field. + * @param value The value of 'periodEnd'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder setPeriodEnd(long value) { + validate(fields()[3], value); + this.periodEnd = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'periodEnd' field has been set. + * @return True if the 'periodEnd' field has been set, false otherwise. + */ + public boolean hasPeriodEnd() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'periodEnd' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder clearPeriodEnd() { + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'count' field. + * @return The value. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * @param value The value of 'count'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder setCount(long value) { + validate(fields()[4], value); + this.count = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'count' field has been set. + * @return True if the 'count' field has been set, false otherwise. + */ + public boolean hasCount() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'count' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder clearCount() { + fieldSetFlags()[4] = false; + return this; + } + + /** + * Gets the value of the 'mean' field. + * @return The value. + */ + public double getMean() { + return mean; + } + + + /** + * Sets the value of the 'mean' field. + * @param value The value of 'mean'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder setMean(double value) { + validate(fields()[5], value); + this.mean = value; + fieldSetFlags()[5] = true; + return this; + } + + /** + * Checks whether the 'mean' field has been set. + * @return True if the 'mean' field has been set, false otherwise. + */ + public boolean hasMean() { + return fieldSetFlags()[5]; + } + + + /** + * Clears the value of the 'mean' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder clearMean() { + fieldSetFlags()[5] = false; + return this; + } + + /** + * Gets the value of the 'populationVariance' field. + * @return The value. + */ + public double getPopulationVariance() { + return populationVariance; + } + + + /** + * Sets the value of the 'populationVariance' field. + * @param value The value of 'populationVariance'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder setPopulationVariance(double value) { + validate(fields()[6], value); + this.populationVariance = value; + fieldSetFlags()[6] = true; + return this; + } + + /** + * Checks whether the 'populationVariance' field has been set. + * @return True if the 'populationVariance' field has been set, false otherwise. + */ + public boolean hasPopulationVariance() { + return fieldSetFlags()[6]; + } + + + /** + * Clears the value of the 'populationVariance' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder clearPopulationVariance() { + fieldSetFlags()[6] = false; + return this; + } + + /** + * Gets the value of the 'min' field. + * @return The value. + */ + public double getMin() { + return min; + } + + + /** + * Sets the value of the 'min' field. + * @param value The value of 'min'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder setMin(double value) { + validate(fields()[7], value); + this.min = value; + fieldSetFlags()[7] = true; + return this; + } + + /** + * Checks whether the 'min' field has been set. + * @return True if the 'min' field has been set, false otherwise. + */ + public boolean hasMin() { + return fieldSetFlags()[7]; + } + + + /** + * Clears the value of the 'min' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder clearMin() { + fieldSetFlags()[7] = false; + return this; + } + + /** + * Gets the value of the 'max' field. + * @return The value. + */ + public double getMax() { + return max; + } + + + /** + * Sets the value of the 'max' field. + * @param value The value of 'max'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder setMax(double value) { + validate(fields()[8], value); + this.max = value; + fieldSetFlags()[8] = true; + return this; + } + + /** + * Checks whether the 'max' field has been set. + * @return True if the 'max' field has been set, false otherwise. + */ + public boolean hasMax() { + return fieldSetFlags()[8]; + } + + + /** + * Clears the value of the 'max' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord.Builder clearMax() { + fieldSetFlags()[8] = false; + return this; + } + + @Override + @SuppressWarnings("unchecked") + public HourOfDayActivePowerRecord build() { + try { + HourOfDayActivePowerRecord record = new HourOfDayActivePowerRecord(); + record.identifier = fieldSetFlags()[0] ? this.identifier : (java.lang.String) defaultValue(fields()[0]); + record.hourOfDay = fieldSetFlags()[1] ? this.hourOfDay : (java.lang.Integer) defaultValue(fields()[1]); + record.periodStart = fieldSetFlags()[2] ? this.periodStart : (java.lang.Long) defaultValue(fields()[2]); + record.periodEnd = fieldSetFlags()[3] ? this.periodEnd : (java.lang.Long) defaultValue(fields()[3]); + record.count = fieldSetFlags()[4] ? this.count : (java.lang.Long) defaultValue(fields()[4]); + record.mean = fieldSetFlags()[5] ? this.mean : (java.lang.Double) defaultValue(fields()[5]); + record.populationVariance = fieldSetFlags()[6] ? this.populationVariance : (java.lang.Double) defaultValue(fields()[6]); + record.min = fieldSetFlags()[7] ? this.min : (java.lang.Double) defaultValue(fields()[7]); + record.max = fieldSetFlags()[8] ? this.max : (java.lang.Double) defaultValue(fields()[8]); + return record; + } catch (org.apache.avro.AvroMissingFieldException e) { + throw e; + } catch (java.lang.Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumWriter<HourOfDayActivePowerRecord> + WRITER$ = (org.apache.avro.io.DatumWriter<HourOfDayActivePowerRecord>)MODEL$.createDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumReader<HourOfDayActivePowerRecord> + READER$ = (org.apache.avro.io.DatumReader<HourOfDayActivePowerRecord>)MODEL$.createDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + + @Override protected boolean hasCustomCoders() { return true; } + + @Override public void customEncode(org.apache.avro.io.Encoder out) + throws java.io.IOException + { + out.writeString(this.identifier); + + out.writeInt(this.hourOfDay); + + out.writeLong(this.periodStart); + + out.writeLong(this.periodEnd); + + out.writeLong(this.count); + + out.writeDouble(this.mean); + + out.writeDouble(this.populationVariance); + + out.writeDouble(this.min); + + out.writeDouble(this.max); + + } + + @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) + throws java.io.IOException + { + org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); + if (fieldOrder == null) { + this.identifier = in.readString(); + + this.hourOfDay = in.readInt(); + + this.periodStart = in.readLong(); + + this.periodEnd = in.readLong(); + + this.count = in.readLong(); + + this.mean = in.readDouble(); + + this.populationVariance = in.readDouble(); + + this.min = in.readDouble(); + + this.max = in.readDouble(); + + } else { + for (int i = 0; i < 9; i++) { + switch (fieldOrder[i].pos()) { + case 0: + this.identifier = in.readString(); + break; + + case 1: + this.hourOfDay = in.readInt(); + break; + + case 2: + this.periodStart = in.readLong(); + break; + + case 3: + this.periodEnd = in.readLong(); + break; + + case 4: + this.count = in.readLong(); + break; + + case 5: + this.mean = in.readDouble(); + break; + + case 6: + this.populationVariance = in.readDouble(); + break; + + case 7: + this.min = in.readDouble(); + break; + + case 8: + this.max = in.readDouble(); + break; + + default: + throw new java.io.IOException("Corrupt ResolvingDecoder."); + } + } + } + } +} + + + + + + + + + + diff --git a/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/HourOfWeekActivePowerRecord.java b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/HourOfWeekActivePowerRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..112e1f7bc1c180e658367fb42b997405eb31a62c --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/HourOfWeekActivePowerRecord.java @@ -0,0 +1,1024 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package rocks.theodolite.benchmarks.commons.model.records; + +import org.apache.avro.generic.GenericArray; +import org.apache.avro.specific.SpecificData; +import org.apache.avro.util.Utf8; +import org.apache.avro.message.BinaryMessageEncoder; +import org.apache.avro.message.BinaryMessageDecoder; +import org.apache.avro.message.SchemaStore; + +@org.apache.avro.specific.AvroGenerated +public class HourOfWeekActivePowerRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = -2060891996492175489L; + + + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"HourOfWeekActivePowerRecord\",\"namespace\":\"rocks.theodolite.benchmarks.commons.model.records\",\"fields\":[{\"name\":\"identifier\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"dayOfWeek\",\"type\":\"int\"},{\"name\":\"hourOfDay\",\"type\":\"int\"},{\"name\":\"periodStart\",\"type\":\"long\"},{\"name\":\"periodEnd\",\"type\":\"long\"},{\"name\":\"count\",\"type\":\"long\"},{\"name\":\"mean\",\"type\":\"double\"},{\"name\":\"populationVariance\",\"type\":\"double\"},{\"name\":\"min\",\"type\":\"double\"},{\"name\":\"max\",\"type\":\"double\"}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + + private static final SpecificData MODEL$ = new SpecificData(); + + private static final BinaryMessageEncoder<HourOfWeekActivePowerRecord> ENCODER = + new BinaryMessageEncoder<HourOfWeekActivePowerRecord>(MODEL$, SCHEMA$); + + private static final BinaryMessageDecoder<HourOfWeekActivePowerRecord> DECODER = + new BinaryMessageDecoder<HourOfWeekActivePowerRecord>(MODEL$, SCHEMA$); + + /** + * Return the BinaryMessageEncoder instance used by this class. + * @return the message encoder used by this class + */ + public static BinaryMessageEncoder<HourOfWeekActivePowerRecord> getEncoder() { + return ENCODER; + } + + /** + * Return the BinaryMessageDecoder instance used by this class. + * @return the message decoder used by this class + */ + public static BinaryMessageDecoder<HourOfWeekActivePowerRecord> getDecoder() { + return DECODER; + } + + /** + * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}. + * @param resolver a {@link SchemaStore} used to find schemas by fingerprint + * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore + */ + public static BinaryMessageDecoder<HourOfWeekActivePowerRecord> createDecoder(SchemaStore resolver) { + return new BinaryMessageDecoder<HourOfWeekActivePowerRecord>(MODEL$, SCHEMA$, resolver); + } + + /** + * Serializes this HourOfWeekActivePowerRecord to a ByteBuffer. + * @return a buffer holding the serialized data for this instance + * @throws java.io.IOException if this instance could not be serialized + */ + public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException { + return ENCODER.encode(this); + } + + /** + * Deserializes a HourOfWeekActivePowerRecord from a ByteBuffer. + * @param b a byte buffer holding serialized data for an instance of this class + * @return a HourOfWeekActivePowerRecord instance decoded from the given buffer + * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class + */ + public static HourOfWeekActivePowerRecord fromByteBuffer( + java.nio.ByteBuffer b) throws java.io.IOException { + return DECODER.decode(b); + } + + private java.lang.String identifier; + private int dayOfWeek; + private int hourOfDay; + private long periodStart; + private long periodEnd; + private long count; + private double mean; + private double populationVariance; + private double min; + private double max; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use <code>newBuilder()</code>. + */ + public HourOfWeekActivePowerRecord() {} + + /** + * All-args constructor. + * @param identifier The new value for identifier + * @param dayOfWeek The new value for dayOfWeek + * @param hourOfDay The new value for hourOfDay + * @param periodStart The new value for periodStart + * @param periodEnd The new value for periodEnd + * @param count The new value for count + * @param mean The new value for mean + * @param populationVariance The new value for populationVariance + * @param min The new value for min + * @param max The new value for max + */ + public HourOfWeekActivePowerRecord(java.lang.String identifier, java.lang.Integer dayOfWeek, java.lang.Integer hourOfDay, java.lang.Long periodStart, java.lang.Long periodEnd, java.lang.Long count, java.lang.Double mean, java.lang.Double populationVariance, java.lang.Double min, java.lang.Double max) { + this.identifier = identifier; + this.dayOfWeek = dayOfWeek; + this.hourOfDay = hourOfDay; + this.periodStart = periodStart; + this.periodEnd = periodEnd; + this.count = count; + this.mean = mean; + this.populationVariance = populationVariance; + this.min = min; + this.max = max; + } + + public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return identifier; + case 1: return dayOfWeek; + case 2: return hourOfDay; + case 3: return periodStart; + case 4: return periodEnd; + case 5: return count; + case 6: return mean; + case 7: return populationVariance; + case 8: return min; + case 9: return max; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: identifier = value$ != null ? value$.toString() : null; break; + case 1: dayOfWeek = (java.lang.Integer)value$; break; + case 2: hourOfDay = (java.lang.Integer)value$; break; + case 3: periodStart = (java.lang.Long)value$; break; + case 4: periodEnd = (java.lang.Long)value$; break; + case 5: count = (java.lang.Long)value$; break; + case 6: mean = (java.lang.Double)value$; break; + case 7: populationVariance = (java.lang.Double)value$; break; + case 8: min = (java.lang.Double)value$; break; + case 9: max = (java.lang.Double)value$; break; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + /** + * Gets the value of the 'identifier' field. + * @return The value of the 'identifier' field. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * @param value the value to set. + */ + public void setIdentifier(java.lang.String value) { + this.identifier = value; + } + + /** + * Gets the value of the 'dayOfWeek' field. + * @return The value of the 'dayOfWeek' field. + */ + public int getDayOfWeek() { + return dayOfWeek; + } + + + /** + * Sets the value of the 'dayOfWeek' field. + * @param value the value to set. + */ + public void setDayOfWeek(int value) { + this.dayOfWeek = value; + } + + /** + * Gets the value of the 'hourOfDay' field. + * @return The value of the 'hourOfDay' field. + */ + public int getHourOfDay() { + return hourOfDay; + } + + + /** + * Sets the value of the 'hourOfDay' field. + * @param value the value to set. + */ + public void setHourOfDay(int value) { + this.hourOfDay = value; + } + + /** + * Gets the value of the 'periodStart' field. + * @return The value of the 'periodStart' field. + */ + public long getPeriodStart() { + return periodStart; + } + + + /** + * Sets the value of the 'periodStart' field. + * @param value the value to set. + */ + public void setPeriodStart(long value) { + this.periodStart = value; + } + + /** + * Gets the value of the 'periodEnd' field. + * @return The value of the 'periodEnd' field. + */ + public long getPeriodEnd() { + return periodEnd; + } + + + /** + * Sets the value of the 'periodEnd' field. + * @param value the value to set. + */ + public void setPeriodEnd(long value) { + this.periodEnd = value; + } + + /** + * Gets the value of the 'count' field. + * @return The value of the 'count' field. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * @param value the value to set. + */ + public void setCount(long value) { + this.count = value; + } + + /** + * Gets the value of the 'mean' field. + * @return The value of the 'mean' field. + */ + public double getMean() { + return mean; + } + + + /** + * Sets the value of the 'mean' field. + * @param value the value to set. + */ + public void setMean(double value) { + this.mean = value; + } + + /** + * Gets the value of the 'populationVariance' field. + * @return The value of the 'populationVariance' field. + */ + public double getPopulationVariance() { + return populationVariance; + } + + + /** + * Sets the value of the 'populationVariance' field. + * @param value the value to set. + */ + public void setPopulationVariance(double value) { + this.populationVariance = value; + } + + /** + * Gets the value of the 'min' field. + * @return The value of the 'min' field. + */ + public double getMin() { + return min; + } + + + /** + * Sets the value of the 'min' field. + * @param value the value to set. + */ + public void setMin(double value) { + this.min = value; + } + + /** + * Gets the value of the 'max' field. + * @return The value of the 'max' field. + */ + public double getMax() { + return max; + } + + + /** + * Sets the value of the 'max' field. + * @param value the value to set. + */ + public void setMax(double value) { + this.max = value; + } + + /** + * Creates a new HourOfWeekActivePowerRecord RecordBuilder. + * @return A new HourOfWeekActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder newBuilder() { + return new rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder(); + } + + /** + * Creates a new HourOfWeekActivePowerRecord RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new HourOfWeekActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder(other); + } + } + + /** + * Creates a new HourOfWeekActivePowerRecord RecordBuilder by copying an existing HourOfWeekActivePowerRecord instance. + * @param other The existing instance to copy. + * @return A new HourOfWeekActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder(other); + } + } + + /** + * RecordBuilder for HourOfWeekActivePowerRecord instances. + */ + @org.apache.avro.specific.AvroGenerated + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<HourOfWeekActivePowerRecord> + implements org.apache.avro.data.RecordBuilder<HourOfWeekActivePowerRecord> { + + private java.lang.String identifier; + private int dayOfWeek; + private int hourOfDay; + private long periodStart; + private long periodEnd; + private long count; + private double mean; + private double populationVariance; + private double min; + private double max; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$, MODEL$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder other) { + super(other); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = other.fieldSetFlags()[0]; + } + if (isValidValue(fields()[1], other.dayOfWeek)) { + this.dayOfWeek = data().deepCopy(fields()[1].schema(), other.dayOfWeek); + fieldSetFlags()[1] = other.fieldSetFlags()[1]; + } + if (isValidValue(fields()[2], other.hourOfDay)) { + this.hourOfDay = data().deepCopy(fields()[2].schema(), other.hourOfDay); + fieldSetFlags()[2] = other.fieldSetFlags()[2]; + } + if (isValidValue(fields()[3], other.periodStart)) { + this.periodStart = data().deepCopy(fields()[3].schema(), other.periodStart); + fieldSetFlags()[3] = other.fieldSetFlags()[3]; + } + if (isValidValue(fields()[4], other.periodEnd)) { + this.periodEnd = data().deepCopy(fields()[4].schema(), other.periodEnd); + fieldSetFlags()[4] = other.fieldSetFlags()[4]; + } + if (isValidValue(fields()[5], other.count)) { + this.count = data().deepCopy(fields()[5].schema(), other.count); + fieldSetFlags()[5] = other.fieldSetFlags()[5]; + } + if (isValidValue(fields()[6], other.mean)) { + this.mean = data().deepCopy(fields()[6].schema(), other.mean); + fieldSetFlags()[6] = other.fieldSetFlags()[6]; + } + if (isValidValue(fields()[7], other.populationVariance)) { + this.populationVariance = data().deepCopy(fields()[7].schema(), other.populationVariance); + fieldSetFlags()[7] = other.fieldSetFlags()[7]; + } + if (isValidValue(fields()[8], other.min)) { + this.min = data().deepCopy(fields()[8].schema(), other.min); + fieldSetFlags()[8] = other.fieldSetFlags()[8]; + } + if (isValidValue(fields()[9], other.max)) { + this.max = data().deepCopy(fields()[9].schema(), other.max); + fieldSetFlags()[9] = other.fieldSetFlags()[9]; + } + } + + /** + * Creates a Builder by copying an existing HourOfWeekActivePowerRecord instance + * @param other The existing instance to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord other) { + super(SCHEMA$, MODEL$); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.dayOfWeek)) { + this.dayOfWeek = data().deepCopy(fields()[1].schema(), other.dayOfWeek); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.hourOfDay)) { + this.hourOfDay = data().deepCopy(fields()[2].schema(), other.hourOfDay); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.periodStart)) { + this.periodStart = data().deepCopy(fields()[3].schema(), other.periodStart); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.periodEnd)) { + this.periodEnd = data().deepCopy(fields()[4].schema(), other.periodEnd); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.count)) { + this.count = data().deepCopy(fields()[5].schema(), other.count); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.mean)) { + this.mean = data().deepCopy(fields()[6].schema(), other.mean); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.populationVariance)) { + this.populationVariance = data().deepCopy(fields()[7].schema(), other.populationVariance); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.min)) { + this.min = data().deepCopy(fields()[8].schema(), other.min); + fieldSetFlags()[8] = true; + } + if (isValidValue(fields()[9], other.max)) { + this.max = data().deepCopy(fields()[9].schema(), other.max); + fieldSetFlags()[9] = true; + } + } + + /** + * Gets the value of the 'identifier' field. + * @return The value. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * @param value The value of 'identifier'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder setIdentifier(java.lang.String value) { + validate(fields()[0], value); + this.identifier = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'identifier' field has been set. + * @return True if the 'identifier' field has been set, false otherwise. + */ + public boolean hasIdentifier() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'identifier' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder clearIdentifier() { + identifier = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'dayOfWeek' field. + * @return The value. + */ + public int getDayOfWeek() { + return dayOfWeek; + } + + + /** + * Sets the value of the 'dayOfWeek' field. + * @param value The value of 'dayOfWeek'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder setDayOfWeek(int value) { + validate(fields()[1], value); + this.dayOfWeek = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'dayOfWeek' field has been set. + * @return True if the 'dayOfWeek' field has been set, false otherwise. + */ + public boolean hasDayOfWeek() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'dayOfWeek' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder clearDayOfWeek() { + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'hourOfDay' field. + * @return The value. + */ + public int getHourOfDay() { + return hourOfDay; + } + + + /** + * Sets the value of the 'hourOfDay' field. + * @param value The value of 'hourOfDay'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder setHourOfDay(int value) { + validate(fields()[2], value); + this.hourOfDay = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'hourOfDay' field has been set. + * @return True if the 'hourOfDay' field has been set, false otherwise. + */ + public boolean hasHourOfDay() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'hourOfDay' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder clearHourOfDay() { + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'periodStart' field. + * @return The value. + */ + public long getPeriodStart() { + return periodStart; + } + + + /** + * Sets the value of the 'periodStart' field. + * @param value The value of 'periodStart'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder setPeriodStart(long value) { + validate(fields()[3], value); + this.periodStart = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'periodStart' field has been set. + * @return True if the 'periodStart' field has been set, false otherwise. + */ + public boolean hasPeriodStart() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'periodStart' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder clearPeriodStart() { + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'periodEnd' field. + * @return The value. + */ + public long getPeriodEnd() { + return periodEnd; + } + + + /** + * Sets the value of the 'periodEnd' field. + * @param value The value of 'periodEnd'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder setPeriodEnd(long value) { + validate(fields()[4], value); + this.periodEnd = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'periodEnd' field has been set. + * @return True if the 'periodEnd' field has been set, false otherwise. + */ + public boolean hasPeriodEnd() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'periodEnd' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder clearPeriodEnd() { + fieldSetFlags()[4] = false; + return this; + } + + /** + * Gets the value of the 'count' field. + * @return The value. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * @param value The value of 'count'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder setCount(long value) { + validate(fields()[5], value); + this.count = value; + fieldSetFlags()[5] = true; + return this; + } + + /** + * Checks whether the 'count' field has been set. + * @return True if the 'count' field has been set, false otherwise. + */ + public boolean hasCount() { + return fieldSetFlags()[5]; + } + + + /** + * Clears the value of the 'count' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder clearCount() { + fieldSetFlags()[5] = false; + return this; + } + + /** + * Gets the value of the 'mean' field. + * @return The value. + */ + public double getMean() { + return mean; + } + + + /** + * Sets the value of the 'mean' field. + * @param value The value of 'mean'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder setMean(double value) { + validate(fields()[6], value); + this.mean = value; + fieldSetFlags()[6] = true; + return this; + } + + /** + * Checks whether the 'mean' field has been set. + * @return True if the 'mean' field has been set, false otherwise. + */ + public boolean hasMean() { + return fieldSetFlags()[6]; + } + + + /** + * Clears the value of the 'mean' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder clearMean() { + fieldSetFlags()[6] = false; + return this; + } + + /** + * Gets the value of the 'populationVariance' field. + * @return The value. + */ + public double getPopulationVariance() { + return populationVariance; + } + + + /** + * Sets the value of the 'populationVariance' field. + * @param value The value of 'populationVariance'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder setPopulationVariance(double value) { + validate(fields()[7], value); + this.populationVariance = value; + fieldSetFlags()[7] = true; + return this; + } + + /** + * Checks whether the 'populationVariance' field has been set. + * @return True if the 'populationVariance' field has been set, false otherwise. + */ + public boolean hasPopulationVariance() { + return fieldSetFlags()[7]; + } + + + /** + * Clears the value of the 'populationVariance' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder clearPopulationVariance() { + fieldSetFlags()[7] = false; + return this; + } + + /** + * Gets the value of the 'min' field. + * @return The value. + */ + public double getMin() { + return min; + } + + + /** + * Sets the value of the 'min' field. + * @param value The value of 'min'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder setMin(double value) { + validate(fields()[8], value); + this.min = value; + fieldSetFlags()[8] = true; + return this; + } + + /** + * Checks whether the 'min' field has been set. + * @return True if the 'min' field has been set, false otherwise. + */ + public boolean hasMin() { + return fieldSetFlags()[8]; + } + + + /** + * Clears the value of the 'min' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder clearMin() { + fieldSetFlags()[8] = false; + return this; + } + + /** + * Gets the value of the 'max' field. + * @return The value. + */ + public double getMax() { + return max; + } + + + /** + * Sets the value of the 'max' field. + * @param value The value of 'max'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder setMax(double value) { + validate(fields()[9], value); + this.max = value; + fieldSetFlags()[9] = true; + return this; + } + + /** + * Checks whether the 'max' field has been set. + * @return True if the 'max' field has been set, false otherwise. + */ + public boolean hasMax() { + return fieldSetFlags()[9]; + } + + + /** + * Clears the value of the 'max' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.HourOfWeekActivePowerRecord.Builder clearMax() { + fieldSetFlags()[9] = false; + return this; + } + + @Override + @SuppressWarnings("unchecked") + public HourOfWeekActivePowerRecord build() { + try { + HourOfWeekActivePowerRecord record = new HourOfWeekActivePowerRecord(); + record.identifier = fieldSetFlags()[0] ? this.identifier : (java.lang.String) defaultValue(fields()[0]); + record.dayOfWeek = fieldSetFlags()[1] ? this.dayOfWeek : (java.lang.Integer) defaultValue(fields()[1]); + record.hourOfDay = fieldSetFlags()[2] ? this.hourOfDay : (java.lang.Integer) defaultValue(fields()[2]); + record.periodStart = fieldSetFlags()[3] ? this.periodStart : (java.lang.Long) defaultValue(fields()[3]); + record.periodEnd = fieldSetFlags()[4] ? this.periodEnd : (java.lang.Long) defaultValue(fields()[4]); + record.count = fieldSetFlags()[5] ? this.count : (java.lang.Long) defaultValue(fields()[5]); + record.mean = fieldSetFlags()[6] ? this.mean : (java.lang.Double) defaultValue(fields()[6]); + record.populationVariance = fieldSetFlags()[7] ? this.populationVariance : (java.lang.Double) defaultValue(fields()[7]); + record.min = fieldSetFlags()[8] ? this.min : (java.lang.Double) defaultValue(fields()[8]); + record.max = fieldSetFlags()[9] ? this.max : (java.lang.Double) defaultValue(fields()[9]); + return record; + } catch (org.apache.avro.AvroMissingFieldException e) { + throw e; + } catch (java.lang.Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumWriter<HourOfWeekActivePowerRecord> + WRITER$ = (org.apache.avro.io.DatumWriter<HourOfWeekActivePowerRecord>)MODEL$.createDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumReader<HourOfWeekActivePowerRecord> + READER$ = (org.apache.avro.io.DatumReader<HourOfWeekActivePowerRecord>)MODEL$.createDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + + @Override protected boolean hasCustomCoders() { return true; } + + @Override public void customEncode(org.apache.avro.io.Encoder out) + throws java.io.IOException + { + out.writeString(this.identifier); + + out.writeInt(this.dayOfWeek); + + out.writeInt(this.hourOfDay); + + out.writeLong(this.periodStart); + + out.writeLong(this.periodEnd); + + out.writeLong(this.count); + + out.writeDouble(this.mean); + + out.writeDouble(this.populationVariance); + + out.writeDouble(this.min); + + out.writeDouble(this.max); + + } + + @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) + throws java.io.IOException + { + org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); + if (fieldOrder == null) { + this.identifier = in.readString(); + + this.dayOfWeek = in.readInt(); + + this.hourOfDay = in.readInt(); + + this.periodStart = in.readLong(); + + this.periodEnd = in.readLong(); + + this.count = in.readLong(); + + this.mean = in.readDouble(); + + this.populationVariance = in.readDouble(); + + this.min = in.readDouble(); + + this.max = in.readDouble(); + + } else { + for (int i = 0; i < 10; i++) { + switch (fieldOrder[i].pos()) { + case 0: + this.identifier = in.readString(); + break; + + case 1: + this.dayOfWeek = in.readInt(); + break; + + case 2: + this.hourOfDay = in.readInt(); + break; + + case 3: + this.periodStart = in.readLong(); + break; + + case 4: + this.periodEnd = in.readLong(); + break; + + case 5: + this.count = in.readLong(); + break; + + case 6: + this.mean = in.readDouble(); + break; + + case 7: + this.populationVariance = in.readDouble(); + break; + + case 8: + this.min = in.readDouble(); + break; + + case 9: + this.max = in.readDouble(); + break; + + default: + throw new java.io.IOException("Corrupt ResolvingDecoder."); + } + } + } + } +} + + + + + + + + + + diff --git a/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/MonthOfYearActivePowerRecord.java b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/MonthOfYearActivePowerRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..4c1cd52fee2fd703e0f98bfdc0bf08b069321952 --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/MonthOfYearActivePowerRecord.java @@ -0,0 +1,945 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package rocks.theodolite.benchmarks.commons.model.records; + +import org.apache.avro.generic.GenericArray; +import org.apache.avro.specific.SpecificData; +import org.apache.avro.util.Utf8; +import org.apache.avro.message.BinaryMessageEncoder; +import org.apache.avro.message.BinaryMessageDecoder; +import org.apache.avro.message.SchemaStore; + +@org.apache.avro.specific.AvroGenerated +public class MonthOfYearActivePowerRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = -6007754522109150657L; + + + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"MonthOfYearActivePowerRecord\",\"namespace\":\"rocks.theodolite.benchmarks.commons.model.records\",\"fields\":[{\"name\":\"identifier\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"monthOfYear\",\"type\":\"int\"},{\"name\":\"periodStart\",\"type\":\"long\"},{\"name\":\"periodEnd\",\"type\":\"long\"},{\"name\":\"count\",\"type\":\"long\"},{\"name\":\"mean\",\"type\":\"double\"},{\"name\":\"populationVariance\",\"type\":\"double\"},{\"name\":\"min\",\"type\":\"double\"},{\"name\":\"max\",\"type\":\"double\"}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + + private static final SpecificData MODEL$ = new SpecificData(); + + private static final BinaryMessageEncoder<MonthOfYearActivePowerRecord> ENCODER = + new BinaryMessageEncoder<MonthOfYearActivePowerRecord>(MODEL$, SCHEMA$); + + private static final BinaryMessageDecoder<MonthOfYearActivePowerRecord> DECODER = + new BinaryMessageDecoder<MonthOfYearActivePowerRecord>(MODEL$, SCHEMA$); + + /** + * Return the BinaryMessageEncoder instance used by this class. + * @return the message encoder used by this class + */ + public static BinaryMessageEncoder<MonthOfYearActivePowerRecord> getEncoder() { + return ENCODER; + } + + /** + * Return the BinaryMessageDecoder instance used by this class. + * @return the message decoder used by this class + */ + public static BinaryMessageDecoder<MonthOfYearActivePowerRecord> getDecoder() { + return DECODER; + } + + /** + * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}. + * @param resolver a {@link SchemaStore} used to find schemas by fingerprint + * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore + */ + public static BinaryMessageDecoder<MonthOfYearActivePowerRecord> createDecoder(SchemaStore resolver) { + return new BinaryMessageDecoder<MonthOfYearActivePowerRecord>(MODEL$, SCHEMA$, resolver); + } + + /** + * Serializes this MonthOfYearActivePowerRecord to a ByteBuffer. + * @return a buffer holding the serialized data for this instance + * @throws java.io.IOException if this instance could not be serialized + */ + public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException { + return ENCODER.encode(this); + } + + /** + * Deserializes a MonthOfYearActivePowerRecord from a ByteBuffer. + * @param b a byte buffer holding serialized data for an instance of this class + * @return a MonthOfYearActivePowerRecord instance decoded from the given buffer + * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class + */ + public static MonthOfYearActivePowerRecord fromByteBuffer( + java.nio.ByteBuffer b) throws java.io.IOException { + return DECODER.decode(b); + } + + private java.lang.String identifier; + private int monthOfYear; + private long periodStart; + private long periodEnd; + private long count; + private double mean; + private double populationVariance; + private double min; + private double max; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use <code>newBuilder()</code>. + */ + public MonthOfYearActivePowerRecord() {} + + /** + * All-args constructor. + * @param identifier The new value for identifier + * @param monthOfYear The new value for monthOfYear + * @param periodStart The new value for periodStart + * @param periodEnd The new value for periodEnd + * @param count The new value for count + * @param mean The new value for mean + * @param populationVariance The new value for populationVariance + * @param min The new value for min + * @param max The new value for max + */ + public MonthOfYearActivePowerRecord(java.lang.String identifier, java.lang.Integer monthOfYear, java.lang.Long periodStart, java.lang.Long periodEnd, java.lang.Long count, java.lang.Double mean, java.lang.Double populationVariance, java.lang.Double min, java.lang.Double max) { + this.identifier = identifier; + this.monthOfYear = monthOfYear; + this.periodStart = periodStart; + this.periodEnd = periodEnd; + this.count = count; + this.mean = mean; + this.populationVariance = populationVariance; + this.min = min; + this.max = max; + } + + public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return identifier; + case 1: return monthOfYear; + case 2: return periodStart; + case 3: return periodEnd; + case 4: return count; + case 5: return mean; + case 6: return populationVariance; + case 7: return min; + case 8: return max; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: identifier = value$ != null ? value$.toString() : null; break; + case 1: monthOfYear = (java.lang.Integer)value$; break; + case 2: periodStart = (java.lang.Long)value$; break; + case 3: periodEnd = (java.lang.Long)value$; break; + case 4: count = (java.lang.Long)value$; break; + case 5: mean = (java.lang.Double)value$; break; + case 6: populationVariance = (java.lang.Double)value$; break; + case 7: min = (java.lang.Double)value$; break; + case 8: max = (java.lang.Double)value$; break; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + /** + * Gets the value of the 'identifier' field. + * @return The value of the 'identifier' field. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * @param value the value to set. + */ + public void setIdentifier(java.lang.String value) { + this.identifier = value; + } + + /** + * Gets the value of the 'monthOfYear' field. + * @return The value of the 'monthOfYear' field. + */ + public int getMonthOfYear() { + return monthOfYear; + } + + + /** + * Sets the value of the 'monthOfYear' field. + * @param value the value to set. + */ + public void setMonthOfYear(int value) { + this.monthOfYear = value; + } + + /** + * Gets the value of the 'periodStart' field. + * @return The value of the 'periodStart' field. + */ + public long getPeriodStart() { + return periodStart; + } + + + /** + * Sets the value of the 'periodStart' field. + * @param value the value to set. + */ + public void setPeriodStart(long value) { + this.periodStart = value; + } + + /** + * Gets the value of the 'periodEnd' field. + * @return The value of the 'periodEnd' field. + */ + public long getPeriodEnd() { + return periodEnd; + } + + + /** + * Sets the value of the 'periodEnd' field. + * @param value the value to set. + */ + public void setPeriodEnd(long value) { + this.periodEnd = value; + } + + /** + * Gets the value of the 'count' field. + * @return The value of the 'count' field. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * @param value the value to set. + */ + public void setCount(long value) { + this.count = value; + } + + /** + * Gets the value of the 'mean' field. + * @return The value of the 'mean' field. + */ + public double getMean() { + return mean; + } + + + /** + * Sets the value of the 'mean' field. + * @param value the value to set. + */ + public void setMean(double value) { + this.mean = value; + } + + /** + * Gets the value of the 'populationVariance' field. + * @return The value of the 'populationVariance' field. + */ + public double getPopulationVariance() { + return populationVariance; + } + + + /** + * Sets the value of the 'populationVariance' field. + * @param value the value to set. + */ + public void setPopulationVariance(double value) { + this.populationVariance = value; + } + + /** + * Gets the value of the 'min' field. + * @return The value of the 'min' field. + */ + public double getMin() { + return min; + } + + + /** + * Sets the value of the 'min' field. + * @param value the value to set. + */ + public void setMin(double value) { + this.min = value; + } + + /** + * Gets the value of the 'max' field. + * @return The value of the 'max' field. + */ + public double getMax() { + return max; + } + + + /** + * Sets the value of the 'max' field. + * @param value the value to set. + */ + public void setMax(double value) { + this.max = value; + } + + /** + * Creates a new MonthOfYearActivePowerRecord RecordBuilder. + * @return A new MonthOfYearActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder newBuilder() { + return new rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder(); + } + + /** + * Creates a new MonthOfYearActivePowerRecord RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new MonthOfYearActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder(other); + } + } + + /** + * Creates a new MonthOfYearActivePowerRecord RecordBuilder by copying an existing MonthOfYearActivePowerRecord instance. + * @param other The existing instance to copy. + * @return A new MonthOfYearActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder(other); + } + } + + /** + * RecordBuilder for MonthOfYearActivePowerRecord instances. + */ + @org.apache.avro.specific.AvroGenerated + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<MonthOfYearActivePowerRecord> + implements org.apache.avro.data.RecordBuilder<MonthOfYearActivePowerRecord> { + + private java.lang.String identifier; + private int monthOfYear; + private long periodStart; + private long periodEnd; + private long count; + private double mean; + private double populationVariance; + private double min; + private double max; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$, MODEL$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder other) { + super(other); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = other.fieldSetFlags()[0]; + } + if (isValidValue(fields()[1], other.monthOfYear)) { + this.monthOfYear = data().deepCopy(fields()[1].schema(), other.monthOfYear); + fieldSetFlags()[1] = other.fieldSetFlags()[1]; + } + if (isValidValue(fields()[2], other.periodStart)) { + this.periodStart = data().deepCopy(fields()[2].schema(), other.periodStart); + fieldSetFlags()[2] = other.fieldSetFlags()[2]; + } + if (isValidValue(fields()[3], other.periodEnd)) { + this.periodEnd = data().deepCopy(fields()[3].schema(), other.periodEnd); + fieldSetFlags()[3] = other.fieldSetFlags()[3]; + } + if (isValidValue(fields()[4], other.count)) { + this.count = data().deepCopy(fields()[4].schema(), other.count); + fieldSetFlags()[4] = other.fieldSetFlags()[4]; + } + if (isValidValue(fields()[5], other.mean)) { + this.mean = data().deepCopy(fields()[5].schema(), other.mean); + fieldSetFlags()[5] = other.fieldSetFlags()[5]; + } + if (isValidValue(fields()[6], other.populationVariance)) { + this.populationVariance = data().deepCopy(fields()[6].schema(), other.populationVariance); + fieldSetFlags()[6] = other.fieldSetFlags()[6]; + } + if (isValidValue(fields()[7], other.min)) { + this.min = data().deepCopy(fields()[7].schema(), other.min); + fieldSetFlags()[7] = other.fieldSetFlags()[7]; + } + if (isValidValue(fields()[8], other.max)) { + this.max = data().deepCopy(fields()[8].schema(), other.max); + fieldSetFlags()[8] = other.fieldSetFlags()[8]; + } + } + + /** + * Creates a Builder by copying an existing MonthOfYearActivePowerRecord instance + * @param other The existing instance to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord other) { + super(SCHEMA$, MODEL$); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.monthOfYear)) { + this.monthOfYear = data().deepCopy(fields()[1].schema(), other.monthOfYear); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.periodStart)) { + this.periodStart = data().deepCopy(fields()[2].schema(), other.periodStart); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.periodEnd)) { + this.periodEnd = data().deepCopy(fields()[3].schema(), other.periodEnd); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.count)) { + this.count = data().deepCopy(fields()[4].schema(), other.count); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.mean)) { + this.mean = data().deepCopy(fields()[5].schema(), other.mean); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.populationVariance)) { + this.populationVariance = data().deepCopy(fields()[6].schema(), other.populationVariance); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.min)) { + this.min = data().deepCopy(fields()[7].schema(), other.min); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.max)) { + this.max = data().deepCopy(fields()[8].schema(), other.max); + fieldSetFlags()[8] = true; + } + } + + /** + * Gets the value of the 'identifier' field. + * @return The value. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * @param value The value of 'identifier'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder setIdentifier(java.lang.String value) { + validate(fields()[0], value); + this.identifier = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'identifier' field has been set. + * @return True if the 'identifier' field has been set, false otherwise. + */ + public boolean hasIdentifier() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'identifier' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder clearIdentifier() { + identifier = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'monthOfYear' field. + * @return The value. + */ + public int getMonthOfYear() { + return monthOfYear; + } + + + /** + * Sets the value of the 'monthOfYear' field. + * @param value The value of 'monthOfYear'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder setMonthOfYear(int value) { + validate(fields()[1], value); + this.monthOfYear = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'monthOfYear' field has been set. + * @return True if the 'monthOfYear' field has been set, false otherwise. + */ + public boolean hasMonthOfYear() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'monthOfYear' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder clearMonthOfYear() { + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'periodStart' field. + * @return The value. + */ + public long getPeriodStart() { + return periodStart; + } + + + /** + * Sets the value of the 'periodStart' field. + * @param value The value of 'periodStart'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder setPeriodStart(long value) { + validate(fields()[2], value); + this.periodStart = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'periodStart' field has been set. + * @return True if the 'periodStart' field has been set, false otherwise. + */ + public boolean hasPeriodStart() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'periodStart' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder clearPeriodStart() { + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'periodEnd' field. + * @return The value. + */ + public long getPeriodEnd() { + return periodEnd; + } + + + /** + * Sets the value of the 'periodEnd' field. + * @param value The value of 'periodEnd'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder setPeriodEnd(long value) { + validate(fields()[3], value); + this.periodEnd = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'periodEnd' field has been set. + * @return True if the 'periodEnd' field has been set, false otherwise. + */ + public boolean hasPeriodEnd() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'periodEnd' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder clearPeriodEnd() { + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'count' field. + * @return The value. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * @param value The value of 'count'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder setCount(long value) { + validate(fields()[4], value); + this.count = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'count' field has been set. + * @return True if the 'count' field has been set, false otherwise. + */ + public boolean hasCount() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'count' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder clearCount() { + fieldSetFlags()[4] = false; + return this; + } + + /** + * Gets the value of the 'mean' field. + * @return The value. + */ + public double getMean() { + return mean; + } + + + /** + * Sets the value of the 'mean' field. + * @param value The value of 'mean'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder setMean(double value) { + validate(fields()[5], value); + this.mean = value; + fieldSetFlags()[5] = true; + return this; + } + + /** + * Checks whether the 'mean' field has been set. + * @return True if the 'mean' field has been set, false otherwise. + */ + public boolean hasMean() { + return fieldSetFlags()[5]; + } + + + /** + * Clears the value of the 'mean' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder clearMean() { + fieldSetFlags()[5] = false; + return this; + } + + /** + * Gets the value of the 'populationVariance' field. + * @return The value. + */ + public double getPopulationVariance() { + return populationVariance; + } + + + /** + * Sets the value of the 'populationVariance' field. + * @param value The value of 'populationVariance'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder setPopulationVariance(double value) { + validate(fields()[6], value); + this.populationVariance = value; + fieldSetFlags()[6] = true; + return this; + } + + /** + * Checks whether the 'populationVariance' field has been set. + * @return True if the 'populationVariance' field has been set, false otherwise. + */ + public boolean hasPopulationVariance() { + return fieldSetFlags()[6]; + } + + + /** + * Clears the value of the 'populationVariance' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder clearPopulationVariance() { + fieldSetFlags()[6] = false; + return this; + } + + /** + * Gets the value of the 'min' field. + * @return The value. + */ + public double getMin() { + return min; + } + + + /** + * Sets the value of the 'min' field. + * @param value The value of 'min'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder setMin(double value) { + validate(fields()[7], value); + this.min = value; + fieldSetFlags()[7] = true; + return this; + } + + /** + * Checks whether the 'min' field has been set. + * @return True if the 'min' field has been set, false otherwise. + */ + public boolean hasMin() { + return fieldSetFlags()[7]; + } + + + /** + * Clears the value of the 'min' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder clearMin() { + fieldSetFlags()[7] = false; + return this; + } + + /** + * Gets the value of the 'max' field. + * @return The value. + */ + public double getMax() { + return max; + } + + + /** + * Sets the value of the 'max' field. + * @param value The value of 'max'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder setMax(double value) { + validate(fields()[8], value); + this.max = value; + fieldSetFlags()[8] = true; + return this; + } + + /** + * Checks whether the 'max' field has been set. + * @return True if the 'max' field has been set, false otherwise. + */ + public boolean hasMax() { + return fieldSetFlags()[8]; + } + + + /** + * Clears the value of the 'max' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.MonthOfYearActivePowerRecord.Builder clearMax() { + fieldSetFlags()[8] = false; + return this; + } + + @Override + @SuppressWarnings("unchecked") + public MonthOfYearActivePowerRecord build() { + try { + MonthOfYearActivePowerRecord record = new MonthOfYearActivePowerRecord(); + record.identifier = fieldSetFlags()[0] ? this.identifier : (java.lang.String) defaultValue(fields()[0]); + record.monthOfYear = fieldSetFlags()[1] ? this.monthOfYear : (java.lang.Integer) defaultValue(fields()[1]); + record.periodStart = fieldSetFlags()[2] ? this.periodStart : (java.lang.Long) defaultValue(fields()[2]); + record.periodEnd = fieldSetFlags()[3] ? this.periodEnd : (java.lang.Long) defaultValue(fields()[3]); + record.count = fieldSetFlags()[4] ? this.count : (java.lang.Long) defaultValue(fields()[4]); + record.mean = fieldSetFlags()[5] ? this.mean : (java.lang.Double) defaultValue(fields()[5]); + record.populationVariance = fieldSetFlags()[6] ? this.populationVariance : (java.lang.Double) defaultValue(fields()[6]); + record.min = fieldSetFlags()[7] ? this.min : (java.lang.Double) defaultValue(fields()[7]); + record.max = fieldSetFlags()[8] ? this.max : (java.lang.Double) defaultValue(fields()[8]); + return record; + } catch (org.apache.avro.AvroMissingFieldException e) { + throw e; + } catch (java.lang.Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumWriter<MonthOfYearActivePowerRecord> + WRITER$ = (org.apache.avro.io.DatumWriter<MonthOfYearActivePowerRecord>)MODEL$.createDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumReader<MonthOfYearActivePowerRecord> + READER$ = (org.apache.avro.io.DatumReader<MonthOfYearActivePowerRecord>)MODEL$.createDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + + @Override protected boolean hasCustomCoders() { return true; } + + @Override public void customEncode(org.apache.avro.io.Encoder out) + throws java.io.IOException + { + out.writeString(this.identifier); + + out.writeInt(this.monthOfYear); + + out.writeLong(this.periodStart); + + out.writeLong(this.periodEnd); + + out.writeLong(this.count); + + out.writeDouble(this.mean); + + out.writeDouble(this.populationVariance); + + out.writeDouble(this.min); + + out.writeDouble(this.max); + + } + + @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) + throws java.io.IOException + { + org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); + if (fieldOrder == null) { + this.identifier = in.readString(); + + this.monthOfYear = in.readInt(); + + this.periodStart = in.readLong(); + + this.periodEnd = in.readLong(); + + this.count = in.readLong(); + + this.mean = in.readDouble(); + + this.populationVariance = in.readDouble(); + + this.min = in.readDouble(); + + this.max = in.readDouble(); + + } else { + for (int i = 0; i < 9; i++) { + switch (fieldOrder[i].pos()) { + case 0: + this.identifier = in.readString(); + break; + + case 1: + this.monthOfYear = in.readInt(); + break; + + case 2: + this.periodStart = in.readLong(); + break; + + case 3: + this.periodEnd = in.readLong(); + break; + + case 4: + this.count = in.readLong(); + break; + + case 5: + this.mean = in.readDouble(); + break; + + case 6: + this.populationVariance = in.readDouble(); + break; + + case 7: + this.min = in.readDouble(); + break; + + case 8: + this.max = in.readDouble(); + break; + + default: + throw new java.io.IOException("Corrupt ResolvingDecoder."); + } + } + } + } +} + + + + + + + + + + diff --git a/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/YearActivePowerRecord.java b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/YearActivePowerRecord.java new file mode 100644 index 0000000000000000000000000000000000000000..0471c825551cc048e5e553309ddf2751b6e7ba3d --- /dev/null +++ b/theodolite-benchmarks/commons/src-gen/main/java/rocks/theodolite/benchmarks/commons/model/records/YearActivePowerRecord.java @@ -0,0 +1,945 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package rocks.theodolite.benchmarks.commons.model.records; + +import org.apache.avro.generic.GenericArray; +import org.apache.avro.specific.SpecificData; +import org.apache.avro.util.Utf8; +import org.apache.avro.message.BinaryMessageEncoder; +import org.apache.avro.message.BinaryMessageDecoder; +import org.apache.avro.message.SchemaStore; + +@org.apache.avro.specific.AvroGenerated +public class YearActivePowerRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = 1269303032337461873L; + + + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"YearActivePowerRecord\",\"namespace\":\"rocks.theodolite.benchmarks.commons.model.records\",\"fields\":[{\"name\":\"identifier\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"year\",\"type\":\"int\"},{\"name\":\"periodStart\",\"type\":\"long\"},{\"name\":\"periodEnd\",\"type\":\"long\"},{\"name\":\"count\",\"type\":\"long\"},{\"name\":\"mean\",\"type\":\"double\"},{\"name\":\"populationVariance\",\"type\":\"double\"},{\"name\":\"min\",\"type\":\"double\"},{\"name\":\"max\",\"type\":\"double\"}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + + private static final SpecificData MODEL$ = new SpecificData(); + + private static final BinaryMessageEncoder<YearActivePowerRecord> ENCODER = + new BinaryMessageEncoder<YearActivePowerRecord>(MODEL$, SCHEMA$); + + private static final BinaryMessageDecoder<YearActivePowerRecord> DECODER = + new BinaryMessageDecoder<YearActivePowerRecord>(MODEL$, SCHEMA$); + + /** + * Return the BinaryMessageEncoder instance used by this class. + * @return the message encoder used by this class + */ + public static BinaryMessageEncoder<YearActivePowerRecord> getEncoder() { + return ENCODER; + } + + /** + * Return the BinaryMessageDecoder instance used by this class. + * @return the message decoder used by this class + */ + public static BinaryMessageDecoder<YearActivePowerRecord> getDecoder() { + return DECODER; + } + + /** + * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}. + * @param resolver a {@link SchemaStore} used to find schemas by fingerprint + * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore + */ + public static BinaryMessageDecoder<YearActivePowerRecord> createDecoder(SchemaStore resolver) { + return new BinaryMessageDecoder<YearActivePowerRecord>(MODEL$, SCHEMA$, resolver); + } + + /** + * Serializes this YearActivePowerRecord to a ByteBuffer. + * @return a buffer holding the serialized data for this instance + * @throws java.io.IOException if this instance could not be serialized + */ + public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException { + return ENCODER.encode(this); + } + + /** + * Deserializes a YearActivePowerRecord from a ByteBuffer. + * @param b a byte buffer holding serialized data for an instance of this class + * @return a YearActivePowerRecord instance decoded from the given buffer + * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class + */ + public static YearActivePowerRecord fromByteBuffer( + java.nio.ByteBuffer b) throws java.io.IOException { + return DECODER.decode(b); + } + + private java.lang.String identifier; + private int year; + private long periodStart; + private long periodEnd; + private long count; + private double mean; + private double populationVariance; + private double min; + private double max; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use <code>newBuilder()</code>. + */ + public YearActivePowerRecord() {} + + /** + * All-args constructor. + * @param identifier The new value for identifier + * @param year The new value for year + * @param periodStart The new value for periodStart + * @param periodEnd The new value for periodEnd + * @param count The new value for count + * @param mean The new value for mean + * @param populationVariance The new value for populationVariance + * @param min The new value for min + * @param max The new value for max + */ + public YearActivePowerRecord(java.lang.String identifier, java.lang.Integer year, java.lang.Long periodStart, java.lang.Long periodEnd, java.lang.Long count, java.lang.Double mean, java.lang.Double populationVariance, java.lang.Double min, java.lang.Double max) { + this.identifier = identifier; + this.year = year; + this.periodStart = periodStart; + this.periodEnd = periodEnd; + this.count = count; + this.mean = mean; + this.populationVariance = populationVariance; + this.min = min; + this.max = max; + } + + public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return identifier; + case 1: return year; + case 2: return periodStart; + case 3: return periodEnd; + case 4: return count; + case 5: return mean; + case 6: return populationVariance; + case 7: return min; + case 8: return max; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: identifier = value$ != null ? value$.toString() : null; break; + case 1: year = (java.lang.Integer)value$; break; + case 2: periodStart = (java.lang.Long)value$; break; + case 3: periodEnd = (java.lang.Long)value$; break; + case 4: count = (java.lang.Long)value$; break; + case 5: mean = (java.lang.Double)value$; break; + case 6: populationVariance = (java.lang.Double)value$; break; + case 7: min = (java.lang.Double)value$; break; + case 8: max = (java.lang.Double)value$; break; + default: throw new IndexOutOfBoundsException("Invalid index: " + field$); + } + } + + /** + * Gets the value of the 'identifier' field. + * @return The value of the 'identifier' field. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * @param value the value to set. + */ + public void setIdentifier(java.lang.String value) { + this.identifier = value; + } + + /** + * Gets the value of the 'year' field. + * @return The value of the 'year' field. + */ + public int getYear() { + return year; + } + + + /** + * Sets the value of the 'year' field. + * @param value the value to set. + */ + public void setYear(int value) { + this.year = value; + } + + /** + * Gets the value of the 'periodStart' field. + * @return The value of the 'periodStart' field. + */ + public long getPeriodStart() { + return periodStart; + } + + + /** + * Sets the value of the 'periodStart' field. + * @param value the value to set. + */ + public void setPeriodStart(long value) { + this.periodStart = value; + } + + /** + * Gets the value of the 'periodEnd' field. + * @return The value of the 'periodEnd' field. + */ + public long getPeriodEnd() { + return periodEnd; + } + + + /** + * Sets the value of the 'periodEnd' field. + * @param value the value to set. + */ + public void setPeriodEnd(long value) { + this.periodEnd = value; + } + + /** + * Gets the value of the 'count' field. + * @return The value of the 'count' field. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * @param value the value to set. + */ + public void setCount(long value) { + this.count = value; + } + + /** + * Gets the value of the 'mean' field. + * @return The value of the 'mean' field. + */ + public double getMean() { + return mean; + } + + + /** + * Sets the value of the 'mean' field. + * @param value the value to set. + */ + public void setMean(double value) { + this.mean = value; + } + + /** + * Gets the value of the 'populationVariance' field. + * @return The value of the 'populationVariance' field. + */ + public double getPopulationVariance() { + return populationVariance; + } + + + /** + * Sets the value of the 'populationVariance' field. + * @param value the value to set. + */ + public void setPopulationVariance(double value) { + this.populationVariance = value; + } + + /** + * Gets the value of the 'min' field. + * @return The value of the 'min' field. + */ + public double getMin() { + return min; + } + + + /** + * Sets the value of the 'min' field. + * @param value the value to set. + */ + public void setMin(double value) { + this.min = value; + } + + /** + * Gets the value of the 'max' field. + * @return The value of the 'max' field. + */ + public double getMax() { + return max; + } + + + /** + * Sets the value of the 'max' field. + * @param value the value to set. + */ + public void setMax(double value) { + this.max = value; + } + + /** + * Creates a new YearActivePowerRecord RecordBuilder. + * @return A new YearActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder newBuilder() { + return new rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder(); + } + + /** + * Creates a new YearActivePowerRecord RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new YearActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder(other); + } + } + + /** + * Creates a new YearActivePowerRecord RecordBuilder by copying an existing YearActivePowerRecord instance. + * @param other The existing instance to copy. + * @return A new YearActivePowerRecord RecordBuilder + */ + public static rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder newBuilder(rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord other) { + if (other == null) { + return new rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder(); + } else { + return new rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder(other); + } + } + + /** + * RecordBuilder for YearActivePowerRecord instances. + */ + @org.apache.avro.specific.AvroGenerated + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<YearActivePowerRecord> + implements org.apache.avro.data.RecordBuilder<YearActivePowerRecord> { + + private java.lang.String identifier; + private int year; + private long periodStart; + private long periodEnd; + private long count; + private double mean; + private double populationVariance; + private double min; + private double max; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$, MODEL$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder other) { + super(other); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = other.fieldSetFlags()[0]; + } + if (isValidValue(fields()[1], other.year)) { + this.year = data().deepCopy(fields()[1].schema(), other.year); + fieldSetFlags()[1] = other.fieldSetFlags()[1]; + } + if (isValidValue(fields()[2], other.periodStart)) { + this.periodStart = data().deepCopy(fields()[2].schema(), other.periodStart); + fieldSetFlags()[2] = other.fieldSetFlags()[2]; + } + if (isValidValue(fields()[3], other.periodEnd)) { + this.periodEnd = data().deepCopy(fields()[3].schema(), other.periodEnd); + fieldSetFlags()[3] = other.fieldSetFlags()[3]; + } + if (isValidValue(fields()[4], other.count)) { + this.count = data().deepCopy(fields()[4].schema(), other.count); + fieldSetFlags()[4] = other.fieldSetFlags()[4]; + } + if (isValidValue(fields()[5], other.mean)) { + this.mean = data().deepCopy(fields()[5].schema(), other.mean); + fieldSetFlags()[5] = other.fieldSetFlags()[5]; + } + if (isValidValue(fields()[6], other.populationVariance)) { + this.populationVariance = data().deepCopy(fields()[6].schema(), other.populationVariance); + fieldSetFlags()[6] = other.fieldSetFlags()[6]; + } + if (isValidValue(fields()[7], other.min)) { + this.min = data().deepCopy(fields()[7].schema(), other.min); + fieldSetFlags()[7] = other.fieldSetFlags()[7]; + } + if (isValidValue(fields()[8], other.max)) { + this.max = data().deepCopy(fields()[8].schema(), other.max); + fieldSetFlags()[8] = other.fieldSetFlags()[8]; + } + } + + /** + * Creates a Builder by copying an existing YearActivePowerRecord instance + * @param other The existing instance to copy. + */ + private Builder(rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord other) { + super(SCHEMA$, MODEL$); + if (isValidValue(fields()[0], other.identifier)) { + this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.year)) { + this.year = data().deepCopy(fields()[1].schema(), other.year); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.periodStart)) { + this.periodStart = data().deepCopy(fields()[2].schema(), other.periodStart); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.periodEnd)) { + this.periodEnd = data().deepCopy(fields()[3].schema(), other.periodEnd); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.count)) { + this.count = data().deepCopy(fields()[4].schema(), other.count); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.mean)) { + this.mean = data().deepCopy(fields()[5].schema(), other.mean); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.populationVariance)) { + this.populationVariance = data().deepCopy(fields()[6].schema(), other.populationVariance); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.min)) { + this.min = data().deepCopy(fields()[7].schema(), other.min); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.max)) { + this.max = data().deepCopy(fields()[8].schema(), other.max); + fieldSetFlags()[8] = true; + } + } + + /** + * Gets the value of the 'identifier' field. + * @return The value. + */ + public java.lang.String getIdentifier() { + return identifier; + } + + + /** + * Sets the value of the 'identifier' field. + * @param value The value of 'identifier'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder setIdentifier(java.lang.String value) { + validate(fields()[0], value); + this.identifier = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'identifier' field has been set. + * @return True if the 'identifier' field has been set, false otherwise. + */ + public boolean hasIdentifier() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'identifier' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder clearIdentifier() { + identifier = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'year' field. + * @return The value. + */ + public int getYear() { + return year; + } + + + /** + * Sets the value of the 'year' field. + * @param value The value of 'year'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder setYear(int value) { + validate(fields()[1], value); + this.year = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'year' field has been set. + * @return True if the 'year' field has been set, false otherwise. + */ + public boolean hasYear() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'year' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder clearYear() { + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'periodStart' field. + * @return The value. + */ + public long getPeriodStart() { + return periodStart; + } + + + /** + * Sets the value of the 'periodStart' field. + * @param value The value of 'periodStart'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder setPeriodStart(long value) { + validate(fields()[2], value); + this.periodStart = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'periodStart' field has been set. + * @return True if the 'periodStart' field has been set, false otherwise. + */ + public boolean hasPeriodStart() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'periodStart' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder clearPeriodStart() { + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'periodEnd' field. + * @return The value. + */ + public long getPeriodEnd() { + return periodEnd; + } + + + /** + * Sets the value of the 'periodEnd' field. + * @param value The value of 'periodEnd'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder setPeriodEnd(long value) { + validate(fields()[3], value); + this.periodEnd = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'periodEnd' field has been set. + * @return True if the 'periodEnd' field has been set, false otherwise. + */ + public boolean hasPeriodEnd() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'periodEnd' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder clearPeriodEnd() { + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'count' field. + * @return The value. + */ + public long getCount() { + return count; + } + + + /** + * Sets the value of the 'count' field. + * @param value The value of 'count'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder setCount(long value) { + validate(fields()[4], value); + this.count = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'count' field has been set. + * @return True if the 'count' field has been set, false otherwise. + */ + public boolean hasCount() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'count' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder clearCount() { + fieldSetFlags()[4] = false; + return this; + } + + /** + * Gets the value of the 'mean' field. + * @return The value. + */ + public double getMean() { + return mean; + } + + + /** + * Sets the value of the 'mean' field. + * @param value The value of 'mean'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder setMean(double value) { + validate(fields()[5], value); + this.mean = value; + fieldSetFlags()[5] = true; + return this; + } + + /** + * Checks whether the 'mean' field has been set. + * @return True if the 'mean' field has been set, false otherwise. + */ + public boolean hasMean() { + return fieldSetFlags()[5]; + } + + + /** + * Clears the value of the 'mean' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder clearMean() { + fieldSetFlags()[5] = false; + return this; + } + + /** + * Gets the value of the 'populationVariance' field. + * @return The value. + */ + public double getPopulationVariance() { + return populationVariance; + } + + + /** + * Sets the value of the 'populationVariance' field. + * @param value The value of 'populationVariance'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder setPopulationVariance(double value) { + validate(fields()[6], value); + this.populationVariance = value; + fieldSetFlags()[6] = true; + return this; + } + + /** + * Checks whether the 'populationVariance' field has been set. + * @return True if the 'populationVariance' field has been set, false otherwise. + */ + public boolean hasPopulationVariance() { + return fieldSetFlags()[6]; + } + + + /** + * Clears the value of the 'populationVariance' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder clearPopulationVariance() { + fieldSetFlags()[6] = false; + return this; + } + + /** + * Gets the value of the 'min' field. + * @return The value. + */ + public double getMin() { + return min; + } + + + /** + * Sets the value of the 'min' field. + * @param value The value of 'min'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder setMin(double value) { + validate(fields()[7], value); + this.min = value; + fieldSetFlags()[7] = true; + return this; + } + + /** + * Checks whether the 'min' field has been set. + * @return True if the 'min' field has been set, false otherwise. + */ + public boolean hasMin() { + return fieldSetFlags()[7]; + } + + + /** + * Clears the value of the 'min' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder clearMin() { + fieldSetFlags()[7] = false; + return this; + } + + /** + * Gets the value of the 'max' field. + * @return The value. + */ + public double getMax() { + return max; + } + + + /** + * Sets the value of the 'max' field. + * @param value The value of 'max'. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder setMax(double value) { + validate(fields()[8], value); + this.max = value; + fieldSetFlags()[8] = true; + return this; + } + + /** + * Checks whether the 'max' field has been set. + * @return True if the 'max' field has been set, false otherwise. + */ + public boolean hasMax() { + return fieldSetFlags()[8]; + } + + + /** + * Clears the value of the 'max' field. + * @return This builder. + */ + public rocks.theodolite.benchmarks.commons.model.records.YearActivePowerRecord.Builder clearMax() { + fieldSetFlags()[8] = false; + return this; + } + + @Override + @SuppressWarnings("unchecked") + public YearActivePowerRecord build() { + try { + YearActivePowerRecord record = new YearActivePowerRecord(); + record.identifier = fieldSetFlags()[0] ? this.identifier : (java.lang.String) defaultValue(fields()[0]); + record.year = fieldSetFlags()[1] ? this.year : (java.lang.Integer) defaultValue(fields()[1]); + record.periodStart = fieldSetFlags()[2] ? this.periodStart : (java.lang.Long) defaultValue(fields()[2]); + record.periodEnd = fieldSetFlags()[3] ? this.periodEnd : (java.lang.Long) defaultValue(fields()[3]); + record.count = fieldSetFlags()[4] ? this.count : (java.lang.Long) defaultValue(fields()[4]); + record.mean = fieldSetFlags()[5] ? this.mean : (java.lang.Double) defaultValue(fields()[5]); + record.populationVariance = fieldSetFlags()[6] ? this.populationVariance : (java.lang.Double) defaultValue(fields()[6]); + record.min = fieldSetFlags()[7] ? this.min : (java.lang.Double) defaultValue(fields()[7]); + record.max = fieldSetFlags()[8] ? this.max : (java.lang.Double) defaultValue(fields()[8]); + return record; + } catch (org.apache.avro.AvroMissingFieldException e) { + throw e; + } catch (java.lang.Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumWriter<YearActivePowerRecord> + WRITER$ = (org.apache.avro.io.DatumWriter<YearActivePowerRecord>)MODEL$.createDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + @SuppressWarnings("unchecked") + private static final org.apache.avro.io.DatumReader<YearActivePowerRecord> + READER$ = (org.apache.avro.io.DatumReader<YearActivePowerRecord>)MODEL$.createDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + + @Override protected boolean hasCustomCoders() { return true; } + + @Override public void customEncode(org.apache.avro.io.Encoder out) + throws java.io.IOException + { + out.writeString(this.identifier); + + out.writeInt(this.year); + + out.writeLong(this.periodStart); + + out.writeLong(this.periodEnd); + + out.writeLong(this.count); + + out.writeDouble(this.mean); + + out.writeDouble(this.populationVariance); + + out.writeDouble(this.min); + + out.writeDouble(this.max); + + } + + @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) + throws java.io.IOException + { + org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); + if (fieldOrder == null) { + this.identifier = in.readString(); + + this.year = in.readInt(); + + this.periodStart = in.readLong(); + + this.periodEnd = in.readLong(); + + this.count = in.readLong(); + + this.mean = in.readDouble(); + + this.populationVariance = in.readDouble(); + + this.min = in.readDouble(); + + this.max = in.readDouble(); + + } else { + for (int i = 0; i < 9; i++) { + switch (fieldOrder[i].pos()) { + case 0: + this.identifier = in.readString(); + break; + + case 1: + this.year = in.readInt(); + break; + + case 2: + this.periodStart = in.readLong(); + break; + + case 3: + this.periodEnd = in.readLong(); + break; + + case 4: + this.count = in.readLong(); + break; + + case 5: + this.mean = in.readDouble(); + break; + + case 6: + this.populationVariance = in.readDouble(); + break; + + case 7: + this.min = in.readDouble(); + break; + + case 8: + this.max = in.readDouble(); + break; + + default: + throw new java.io.IOException("Corrupt ResolvingDecoder."); + } + } + } + } +} + + + + + + + + + + diff --git a/theodolite-benchmarks/commons/src/main/avro/ActivePower.avdl b/theodolite-benchmarks/commons/src/main/avro/ActivePower.avdl new file mode 100644 index 0000000000000000000000000000000000000000..6ee82d6becc6393617d569de27d0b162f892e192 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/avro/ActivePower.avdl @@ -0,0 +1,19 @@ +@namespace("rocks.theodolite.benchmarks.commons.model.records") +protocol ActivePower { + + record ActivePowerRecord { + /** + * + */ + string identifier; + /** + * + */ + long timestamp; + /** + * + */ + double valueInW; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/avro/AggregatedActivePower.avdl b/theodolite-benchmarks/commons/src/main/avro/AggregatedActivePower.avdl new file mode 100644 index 0000000000000000000000000000000000000000..571f30f3247cae7c829aaa7742a37f8f3c89cfed --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/avro/AggregatedActivePower.avdl @@ -0,0 +1,27 @@ +@namespace("rocks.theodolite.benchmarks.commons.model.records") +protocol AggregatedActivePower { + + record AggregatedActivePowerRecord { + /** + * + */ + string identifier; + /** + * + */ + long timestamp; + /** + * + */ + long count; + /** + * + */ + double sumInW; + /** + * + */ + double averageInW; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/avro/StatsActivePower.avdl b/theodolite-benchmarks/commons/src/main/avro/StatsActivePower.avdl new file mode 100644 index 0000000000000000000000000000000000000000..9f4c6360661a6b40f267a17ae8205b8178044895 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/avro/StatsActivePower.avdl @@ -0,0 +1,65 @@ +@namespace("rocks.theodolite.benchmarks.commons.model.records") +protocol StatsActivePower { + + record HourOfDayActivePowerRecord { + string identifier; + int hourOfDay; + long periodStart; + long periodEnd; + long count; + double mean; + double populationVariance; + double min; + double max; + } + + record DayOfWeekActivePowerRecord { + string identifier; + int dayOfWeek; + long periodStart; + long periodEnd; + long count; + double mean; + double populationVariance; + double min; + double max; + } + + record HourOfWeekActivePowerRecord { + string identifier; + int dayOfWeek; + int hourOfDay; + long periodStart; + long periodEnd; + long count; + double mean; + double populationVariance; + double min; + double max; + } + + record MonthOfYearActivePowerRecord { + string identifier; + int monthOfYear; + long periodStart; + long periodEnd; + long count; + double mean; + double populationVariance; + double min; + double max; + } + + record YearActivePowerRecord { + string identifier; + int year; + long periodStart; + long periodEnd; + long count; + double mean; + double populationVariance; + double min; + double max; + } + +} \ No newline at end of file diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/commons/configuration/NameResolvingEnvironmentConfiguration.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/commons/configuration/NameResolvingEnvironmentConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..fb29d078d2fb5125103188247f1673a1da766536 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/commons/configuration/NameResolvingEnvironmentConfiguration.java @@ -0,0 +1,34 @@ +package rocks.theodolite.benchmarks.commons.commons.configuration; + +import java.util.Locale; +import org.apache.commons.configuration2.EnvironmentConfiguration; + +/** + * {@link EnvironmentConfiguration} that automatically translates Java property file style variables + * ({@code my.variable.name}) to environment style variables ({@code MY__VARIABLE_NAME}). + */ +public class NameResolvingEnvironmentConfiguration extends EnvironmentConfiguration { + + @Override + protected Object getPropertyInternal(final String key) { + final Object value = super.getPropertyInternal(key); + if (value == null) { + return super.getPropertyInternal(formatKeyAsEnvVariable(key)); + } + return value; + } + + @Override + protected boolean containsKeyInternal(final String key) { + final boolean value = super.containsKeyInternal(key); + if (!value) { + return super.containsKeyInternal(formatKeyAsEnvVariable(key)); + } + return value; + } + + public static String formatKeyAsEnvVariable(final String key) { + return key.toUpperCase(Locale.ROOT).replace('.', '_'); + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/commons/configuration/ServiceConfigurations.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/commons/configuration/ServiceConfigurations.java new file mode 100644 index 0000000000000000000000000000000000000000..6ad0703697aa02f641c9b86f7384bfd9b9e1956c --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/commons/configuration/ServiceConfigurations.java @@ -0,0 +1,120 @@ +package rocks.theodolite.benchmarks.commons.commons.configuration; + +import com.google.common.io.Resources; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import org.apache.commons.configuration2.CompositeConfiguration; +import org.apache.commons.configuration2.Configuration; +import org.apache.commons.configuration2.ex.ConfigurationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Helper class for creating {@link Configuration}s. + */ +public final class ServiceConfigurations { + + private static final Logger LOGGER = LoggerFactory.getLogger(ServiceConfigurations.class); + + private static final String DEFAULT_PROPERTIES_LOCATION = "META-INF/application.properties"; + private static final String USER_PROPERTIES_LOCATION = "config/application.properties"; + + private ServiceConfigurations() {} + + /** + * Create a {@link Configuration} as it typically used by microservices. More precisely, this + * means when trying to access value with a particular key, this configuration first looks for + * this key in the current environment variables, then in a properties file located in + * {@code config/application.properties}, and finally for a properties file in the classpath at + * {@code META-INF/application.properties}. + * + * @see NameResolvingEnvironmentConfiguration for details regarding the environemnt variable + * lookup. + */ + public static Configuration createWithDefaults() { + return builder() + .withEnvironmentVariables() + .withUserConfigurationFile(USER_PROPERTIES_LOCATION) + .withDefaultConfigurationFile(DEFAULT_PROPERTIES_LOCATION) + .build(); + } + + public static Builder builder() { + return new Builder(); + } + + /** + * Builder class for a {@link Configuration} for a microservice. + */ + public static class Builder { + + private final CompositeConfiguration configuration = new CompositeConfiguration(); + + private Builder() {} + + public Builder withEnvironmentVariables() { + this.configuration.addConfiguration(new NameResolvingEnvironmentConfiguration()); + return this; + } + + /** + * Add a properties file from the user's file system to the {@link Configuration}. + */ + public Builder withUserConfigurationFile(final String userPropertiesLocation) { + final Path path = Paths.get(userPropertiesLocation); + LOGGER.info("Looking for user configuration at {}", userPropertiesLocation); + if (Files.exists(path)) { + LOGGER.info("Found user configuration at {}", userPropertiesLocation); + try { + this.configuration.addConfiguration(configurations().properties(path.toFile())); + } catch (final ConfigurationException e) { + throw new IllegalArgumentException( + "Cannot load configuration from file '" + userPropertiesLocation + "'", e); + } + } else { + LOGGER.info("No user configuration found at {}", userPropertiesLocation); + } + return this; + } + + /** + * Add a properties file from the class path to the {@link Configuration}. + */ + public Builder withDefaultConfigurationFile(final String defaultPropertiesLocation) { + if (resourceExists(defaultPropertiesLocation)) { + try { + this.configuration + .addConfiguration(configurations().properties(defaultPropertiesLocation)); + } catch (final ConfigurationException e) { + throw new IllegalArgumentException( + "Cannot load configuration from ressource '" + defaultPropertiesLocation + "'", e); + } + } + return this; + } + + public Configuration build() { + return this.configuration; + } + + } + + /** + * Shortcut for long class name. + */ + private static org.apache.commons.configuration2.builder.fluent.Configurations configurations() { + // TODO Refactor when Configurations class is removed + return new org.apache.commons.configuration2.builder.fluent.Configurations(); + } + + private static boolean resourceExists(final String resourceName) { + try { + Resources.getResource(resourceName); + } catch (final IllegalArgumentException e) { + return false; + } + return true; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/configuration/events/Event.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/configuration/events/Event.java new file mode 100644 index 0000000000000000000000000000000000000000..895b3401c5d59abb6863caa246414e9ead69d773 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/configuration/events/Event.java @@ -0,0 +1,13 @@ +package rocks.theodolite.benchmarks.commons.configuration.events; + +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; + +/** + * Events that could occur when modifying a {@link SensorRegistry}. Currently only a general change + * event and a status posting event are supported. + */ +public enum Event { + + SENSOR_REGISTRY_CHANGED, SENSOR_REGISTRY_STATUS; + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/configuration/events/EventSerde.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/configuration/events/EventSerde.java new file mode 100644 index 0000000000000000000000000000000000000000..50a3faad61d6c6179efe983b0c172e66e0d28367 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/configuration/events/EventSerde.java @@ -0,0 +1,81 @@ +package rocks.theodolite.benchmarks.commons.configuration.events; + +import java.nio.ByteBuffer; +import java.util.Map; +import org.apache.kafka.common.serialization.ByteBufferDeserializer; +import org.apache.kafka.common.serialization.ByteBufferSerializer; +import org.apache.kafka.common.serialization.Deserializer; +import org.apache.kafka.common.serialization.Serde; +import org.apache.kafka.common.serialization.Serdes; +import org.apache.kafka.common.serialization.Serializer; + +/** + * Provides factory methods for creating Kafka serializers and deserializers for {@link Event}s. + */ +public final class EventSerde { + + private EventSerde() {} + + public static Serde<Event> serde() { + return Serdes.serdeFrom(new EventSerializer(), new EventDeserializer()); + } + + public static Serializer<Event> serializer() { + return new EventSerializer(); + } + + public static Deserializer<Event> deserializer() { + return new EventDeserializer(); + } + + private static class EventSerializer implements Serializer<Event> { + + private static final int INT_SIZE = 4; + + private final ByteBufferSerializer byteBufferSerializer = new ByteBufferSerializer(); + + @Override + public void configure(final Map<String, ?> configs, final boolean isKey) { + this.byteBufferSerializer.configure(configs, isKey); + } + + @Override + public byte[] serialize(final String topic, final Event event) { + return this.byteBufferSerializer.serialize(topic, + ByteBuffer.allocate(INT_SIZE).putInt(event.ordinal())); + } + + @Override + public void close() { + this.byteBufferSerializer.close(); + } + + } + + private static class EventDeserializer implements Deserializer<Event> { + + private final ByteBufferDeserializer byteBufferDeserializer = new ByteBufferDeserializer(); + + @Override + public void configure(final Map<String, ?> configs, final boolean isKey) { + this.byteBufferDeserializer.configure(configs, isKey); + } + + @Override + public Event deserialize(final String topic, final byte[] data) { + final int ordinal = this.byteBufferDeserializer.deserialize(topic, data).getInt(); + for (final Event event : Event.values()) { + if (ordinal == event.ordinal()) { + return event; + } + } + throw new IllegalArgumentException("Deserialized data is not a valid event."); + } + + @Override + public void close() { + this.byteBufferDeserializer.close(); + } + + } +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/avro/SchemaRegistryAvroSerdeFactory.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/avro/SchemaRegistryAvroSerdeFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..9f3d5721efd90000b9265b593be5656b989c4f44 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/avro/SchemaRegistryAvroSerdeFactory.java @@ -0,0 +1,39 @@ +package rocks.theodolite.benchmarks.commons.kafka.avro; + +import io.confluent.kafka.serializers.AbstractKafkaAvroSerDeConfig; +import io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde; +import java.util.Collections; +import java.util.Map; +import org.apache.avro.specific.SpecificRecord; +import org.apache.kafka.common.serialization.Serde; + +/** + * Factory methods to create {@link Serde}s for Avro records using the Confluent Schema Registry. + */ +public final class SchemaRegistryAvroSerdeFactory { + + private static final String SCHEMA_REGISTRY_URL_KEY = + AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG; + + private final Map<String, String> serdeConfig; + + public SchemaRegistryAvroSerdeFactory(final String schemaRegistryUrl) { + this.serdeConfig = Collections.singletonMap(SCHEMA_REGISTRY_URL_KEY, schemaRegistryUrl); + + } + + public <T extends SpecificRecord> Serde<T> forKeys() { + return this.build(true); + } + + public <T extends SpecificRecord> Serde<T> forValues() { + return this.build(false); + } + + private <T extends SpecificRecord> Serde<T> build(final boolean isKey) { + final Serde<T> avroSerde = new SpecificAvroSerde<>(); + avroSerde.configure(this.serdeConfig, isKey); + return avroSerde; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferConstants.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..b29c05359d04ebf2552da7a3c3a6b915ede1cd35 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferConstants.java @@ -0,0 +1,18 @@ +package rocks.theodolite.benchmarks.commons.kafka.simpleserdes; + +import java.nio.charset.Charset; + +/** + * Shared constants between {@link WriteBuffer} and {@link ReadBuffer}. + */ +public final class BufferConstants { + + public static final Charset CHARSET = Charset.forName("UTF-8"); + + public static final byte BOOLEAN_FALSE = 0; + + public static final byte BOOLEAN_TRUE = 1; + + private BufferConstants() {} + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferDeserializer.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferDeserializer.java new file mode 100644 index 0000000000000000000000000000000000000000..88fba611be5600d3a5557b34d5244e523dcbb017 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferDeserializer.java @@ -0,0 +1,13 @@ +package rocks.theodolite.benchmarks.commons.kafka.simpleserdes; + +/** + * Deserializer to deserialize a {@link ReadBuffer} to an object. + * + * @param <T> the type of the deserialized object + */ +@FunctionalInterface +public interface BufferDeserializer<T> { + + T deserialize(ReadBuffer buffer); + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferSerde.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferSerde.java new file mode 100644 index 0000000000000000000000000000000000000000..e14f03e2b36e5551911536f2dff20f70e8efe08a --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferSerde.java @@ -0,0 +1,11 @@ +package rocks.theodolite.benchmarks.commons.kafka.simpleserdes; + +/** + * Combine {@link BufferSerializer} and {@link BufferDeserializer} into one type. This allows + * implementing a serde in one class. + * + * @param <T> Type of the serializer and deserializer. + */ +public interface BufferSerde<T> extends BufferSerializer<T>, BufferDeserializer<T> { + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferSerializer.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..9c7353a64a39839f183ad4153f369e3d33bcfe5b --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/BufferSerializer.java @@ -0,0 +1,13 @@ +package rocks.theodolite.benchmarks.commons.kafka.simpleserdes; + +/** + * Serializer to serialize an object to a {@link WriteBuffer}. + * + * @param <T> the type of the serialized object + */ +@FunctionalInterface +public interface BufferSerializer<T> { + + void serialize(WriteBuffer buffer, T data); + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/ReadBuffer.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/ReadBuffer.java new file mode 100644 index 0000000000000000000000000000000000000000..cf0e7af93c31b20e7136d4f6b1c870691cd4801d --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/ReadBuffer.java @@ -0,0 +1,67 @@ +package rocks.theodolite.benchmarks.commons.kafka.simpleserdes; + +import java.nio.ByteBuffer; + +/** + * A buffer that is constructed from a byte array and data can be sequentially read to different + * kinds of data types. It is the counterpart to {@link WriteBuffer}. + */ +public class ReadBuffer { + + private final ByteBuffer buffer; + + /** + * Create this buffer by a byte array. + */ + public ReadBuffer(final byte[] bytes) { + this.buffer = ByteBuffer.wrap(bytes); + } + + public byte getByte() { + return this.buffer.get(); + } + + /** + * Get a byte array. + */ + public byte[] getBytes() { + final int bytesLength = this.buffer.getInt(); + final byte[] bytes = new byte[bytesLength]; + this.buffer.get(bytes); + return bytes; + } + + public boolean getBoolean() { // NOPMD + return this.getByte() == BufferConstants.BOOLEAN_TRUE; + } + + public short getShort() { // NOPMD + return this.buffer.getShort(); + } + + public int getInt() { + return this.buffer.getInt(); + } + + public long getLong() { + return this.buffer.getLong(); + } + + public float getFloat() { + return this.buffer.getFloat(); + } + + public double getDouble() { + return this.buffer.getDouble(); + } + + public int getChar() { + return this.buffer.getChar(); + } + + public String getString() { + final byte[] bytes = this.getBytes(); + return new String(bytes, BufferConstants.CHARSET); + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/SimpleDeserializer.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/SimpleDeserializer.java new file mode 100644 index 0000000000000000000000000000000000000000..d3d2b6756c417f62c85bfd5a269d0d47d36daa7c --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/SimpleDeserializer.java @@ -0,0 +1,38 @@ +package rocks.theodolite.benchmarks.commons.kafka.simpleserdes; + +import java.util.Map; +import org.apache.kafka.common.serialization.Deserializer; + +/** + * Kafka {@link Deserializer} to be configured with a {@link BufferDeserializer} for simpler usage. + * + * @param <T> the type of the deserialized object + */ +public class SimpleDeserializer<T> implements Deserializer<T> { + + private final BufferDeserializer<T> deserializer; + + public SimpleDeserializer(final BufferDeserializer<T> deserializer) { + this.deserializer = deserializer; + } + + @Override + public void configure(final Map<String, ?> configs, final boolean isKey) { + // Do nothing + } + + @Override + public T deserialize(final String topic, final byte[] bytes) { + if (bytes == null) { + return null; + } + final ReadBuffer buffer = new ReadBuffer(bytes); + return this.deserializer.deserialize(buffer); + } + + @Override + public void close() { + // Do nothing + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/SimpleSerdes.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/SimpleSerdes.java new file mode 100644 index 0000000000000000000000000000000000000000..ae1c0530f8283122451b7e20d32f56300cdf6ef7 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/SimpleSerdes.java @@ -0,0 +1,24 @@ +package rocks.theodolite.benchmarks.commons.kafka.simpleserdes; + +import org.apache.kafka.common.serialization.Serde; +import org.apache.kafka.common.serialization.Serdes; + +/** + * Factory class to create <i>Simple Serdes</i>. These are serdes created from a + * {@link BufferSerializer} and a {@link BufferDeserializer}. + */ +public final class SimpleSerdes { + + private SimpleSerdes() {} + + public static <T> Serde<T> create(final BufferSerde<T> serde) { + return Serdes.serdeFrom(new SimpleSerializer<>(serde), new SimpleDeserializer<>(serde)); + } + + public static <T> Serde<T> create(final BufferSerializer<T> serializer, + final BufferDeserializer<T> deserializer) { + return Serdes.serdeFrom(new SimpleSerializer<>(serializer), + new SimpleDeserializer<>(deserializer)); + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/SimpleSerializer.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/SimpleSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..4ed3d91f74a3ad6bc3a0ff8f52d91e53a741e65d --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/SimpleSerializer.java @@ -0,0 +1,39 @@ +package rocks.theodolite.benchmarks.commons.kafka.simpleserdes; + +import java.util.Map; +import org.apache.kafka.common.serialization.Serializer; + +/** + * Kafka {@link Serializer} to be configured with a {@link BufferSerializer} for simpler usage. + * + * @param <T> the type of the serialized objects + */ +public class SimpleSerializer<T> implements Serializer<T> { + + private final BufferSerializer<T> serializer; + + public SimpleSerializer(final BufferSerializer<T> serializer) { + this.serializer = serializer; + } + + @Override + public void configure(final Map<String, ?> configs, final boolean isKey) { + // Do nothing + } + + @Override + public byte[] serialize(final String topic, final T data) { + if (data == null) { + return null; + } + final WriteBuffer buffer = new WriteBuffer(); + this.serializer.serialize(buffer, data); + return buffer.getBytes(); + } + + @Override + public void close() { + // Do nothing + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/WriteBuffer.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/WriteBuffer.java new file mode 100644 index 0000000000000000000000000000000000000000..144b125f031250c09900360898f98f871643f036 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/kafka/simpleserdes/WriteBuffer.java @@ -0,0 +1,69 @@ +package rocks.theodolite.benchmarks.commons.kafka.simpleserdes; + +import java.nio.ByteBuffer; + +/** + * A buffer to which different kinds of data types can be written and its content can be returned as + * bytes. Its counterpart is a {@link ReadBuffer} which allows to read the data in the order it is + * written. + */ +public class WriteBuffer { + + private static final int BYTE_BUFFER_CAPACITY = 65_536; // Is only virtual memory + + private final ByteBuffer buffer = ByteBuffer.allocateDirect(BYTE_BUFFER_CAPACITY); + + public void putByte(final byte value) { + this.buffer.put(value); + } + + public void putBytes(final byte[] value) { + this.buffer.putInt(value.length); + this.buffer.put(value); + } + + public void putBoolean(final boolean value) { + this.putByte( + value ? BufferConstants.BOOLEAN_TRUE : BufferConstants.BOOLEAN_FALSE); + } + + public void putShort(final short value) { // NOPMD + this.buffer.putShort(value); + } + + public void putInt(final int value) { + this.buffer.putInt(value); + } + + public void putLong(final long value) { + this.buffer.putLong(value); + } + + public void putFloat(final float value) { + this.buffer.putFloat(value); + } + + public void putDouble(final double value) { + this.buffer.putDouble(value); + } + + public void putChar(final char value) { + this.buffer.putChar(value); + } + + public void putString(final String value) { + final byte[] bytes = value.getBytes(BufferConstants.CHARSET); + this.putBytes(bytes); + } + + /** + * Get the content of this buffer as bytes. + */ + public byte[] getBytes() { + this.buffer.flip(); + final byte[] bytes = new byte[this.buffer.remaining()]; + this.buffer.get(bytes, 0, bytes.length); + return bytes; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/AbstractSensor.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/AbstractSensor.java new file mode 100644 index 0000000000000000000000000000000000000000..3dad538bb9ddb41959511ee41591d069450b7f69 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/AbstractSensor.java @@ -0,0 +1,35 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import java.util.Optional; + +abstract class AbstractSensor implements Sensor { + + private final AggregatedSensor parent; + + private final String identifier; + + private final String name; + + protected AbstractSensor(final AggregatedSensor parent, final String identifier, + final String name) { + this.parent = parent; + this.identifier = identifier; + this.name = name; + } + + @Override + public Optional<AggregatedSensor> getParent() { + return Optional.ofNullable(this.parent); + } + + @Override + public String getIdentifier() { + return this.identifier; + } + + @Override + public String getName() { + return this.name; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/AggregatedSensor.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/AggregatedSensor.java new file mode 100644 index 0000000000000000000000000000000000000000..fa8717ded4643f2350174e4c26dd10ffe608d2ac --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/AggregatedSensor.java @@ -0,0 +1,56 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +/** + * Representing an aggregated sensor in the {@link SensorRegistry}, i.e. one that may have child + * sensors. + */ +public interface AggregatedSensor extends Sensor { + + Collection<Sensor> getChildren(); + + /** + * Returns all {@link MachineSensor}s that are children (including grandchildren etc.) of this + * aggregated sensor. In other words, it returns all leaves located below this aggregated sensor + * in the corresponding {@link SensorRegistry}. + */ + default Collection<MachineSensor> getAllChildren() { + final List<MachineSensor> allChildren = new ArrayList<>(); + final Queue<Sensor> untraversedSensors = new LinkedList<>(this.getChildren()); + while (!untraversedSensors.isEmpty()) { + final Sensor sensor = untraversedSensors.poll(); + if (sensor instanceof MachineSensor) { + allChildren.add((MachineSensor) sensor); + } else if (sensor instanceof AggregatedSensor) { + untraversedSensors.addAll(((AggregatedSensor) sensor).getChildren()); + } + } + return allChildren; + } + + /** + * Flattens this {@link AggregatedSensor} and all of its children to a collection of + * {@link Sensor}s. + * + * @return A collection containing this {@link AggregatedSensor} and all of its children. + */ + default Collection<Sensor> flatten() { + final List<Sensor> accumulator = new ArrayList<>(); + final Queue<Sensor> untraversedSensors = new LinkedList<>(); + untraversedSensors.add(this); + while (!untraversedSensors.isEmpty()) { + final Sensor sensor = untraversedSensors.poll(); + accumulator.add(sensor); + if (sensor instanceof AggregatedSensor) { + untraversedSensors.addAll(((AggregatedSensor) sensor).getChildren()); + } + } + return accumulator; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/ImmutableSensorRegistry.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/ImmutableSensorRegistry.java new file mode 100644 index 0000000000000000000000000000000000000000..bac00a0c0c4086c1e3847619e5603f020ca78e8a --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/ImmutableSensorRegistry.java @@ -0,0 +1,145 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableList.Builder; +import com.google.common.collect.ImmutableMap; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import java.util.Collection; +import java.util.Objects; +import java.util.Optional; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.AggregatedSensorSerializer; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.MachineSensorSerializer; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.SensorRegistryDeserializer; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.SensorRegistrySerializer; + +/** + * Implementation of a {@link SensorRegistry} that is immutable. + */ +public final class ImmutableSensorRegistry implements SensorRegistry { + + private static final Gson GSON = new GsonBuilder() + .registerTypeAdapter(ImmutableSensorRegistry.class, new SensorRegistrySerializer()) + .registerTypeAdapter(ImmutableSensorRegistry.ImmutableAggregatatedSensor.class, + new AggregatedSensorSerializer()) + .registerTypeAdapter(MachineSensorImpl.class, new MachineSensorSerializer()) + .registerTypeAdapter(SensorRegistry.class, new SensorRegistryDeserializer()).create(); + + private final ImmutableMap<String, MachineSensor> machineSensors; + private final AggregatedSensor topLevelSensor; + + private ImmutableSensorRegistry(final SensorRegistry sensorRegistry) { + final ImmutableMap.Builder<String, MachineSensor> mapBuilder = ImmutableMap.builder(); + this.topLevelSensor = + new ImmutableAggregatatedSensor(null, sensorRegistry.getTopLevelSensor(), mapBuilder); + this.machineSensors = mapBuilder.build(); + } + + @Override + public Optional<MachineSensor> getSensorForIdentifier(final String identifier) { + return Optional.ofNullable(this.machineSensors.get(identifier)); + } + + @Override + public AggregatedSensor getTopLevelSensor() { + return this.topLevelSensor; + } + + @Override + public Collection<MachineSensor> getMachineSensors() { + return this.machineSensors.values(); + } + + @Override + public String toJson() { + // Necessary method. Deletion would cause SensorRegistry.toJson() to fail. + return GSON.toJson(this); + } + + @Override + public int hashCode() { + return Objects.hashCode(this.topLevelSensor); + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (obj instanceof SensorRegistry) { + final SensorRegistry other = (SensorRegistry) obj; + return Objects.equals(this.getTopLevelSensor(), other.getTopLevelSensor()); + } + return false; + } + + public static ImmutableSensorRegistry copyOf(final SensorRegistry sensorRegistry) { + return new ImmutableSensorRegistry(sensorRegistry); + } + + public static SensorRegistry fromJson(final String json) { + return GSON.fromJson(json, SensorRegistry.class); + } + + private static final class ImmutableAggregatatedSensor extends AbstractSensor + implements AggregatedSensor { + + private final ImmutableList<Sensor> children; + + private ImmutableAggregatatedSensor(final AggregatedSensor newParent, + final AggregatedSensor sensorToCopy, + final ImmutableMap.Builder<String, MachineSensor> sensorRegistryMapBuilder) { + super(newParent, sensorToCopy.getIdentifier(), sensorToCopy.getName()); + final Builder<Sensor> childrenBuilder = ImmutableList.builder(); + for (final Sensor child : sensorToCopy.getChildren()) { + if (child instanceof MachineSensor) { + final MachineSensor newChild = + new MachineSensorImpl(this, child.getIdentifier(), child.getName()); + childrenBuilder.add(newChild); + sensorRegistryMapBuilder.put(newChild.getIdentifier(), newChild); + } else if (child instanceof AggregatedSensor) { + final AggregatedSensor newChild = new ImmutableAggregatatedSensor(this, + (AggregatedSensor) child, sensorRegistryMapBuilder); + childrenBuilder.add(newChild); + } else { + throw new IllegalStateException( + "Sensor " + child + " is neither of type '" + + MachineSensor.class.getSimpleName() + "' nor " + + AggregatedSensor.class.getSimpleName() + "' and thus not supported."); + } + } + this.children = childrenBuilder.build(); + } + + @Override + public Collection<Sensor> getChildren() { + return this.children; + } + + @Override + public int hashCode() { + return Objects.hash(this.getIdentifier(), this.children); + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (obj instanceof AggregatedSensor) { + final AggregatedSensor other = (AggregatedSensor) obj; + return Objects.equals(this.getIdentifier(), other.getIdentifier()) + && Objects.equals(this.children, other.getChildren()); + } + return false; + } + + @Override + public String toString() { + return this.getName() + '[' + this.getIdentifier() + "] (" + this.children.size() + + " children)"; + } + + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MachineSensor.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MachineSensor.java new file mode 100644 index 0000000000000000000000000000000000000000..cdb4b535bffd807acb92fbfd057f5986b4840ba8 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MachineSensor.java @@ -0,0 +1,25 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +/** + * Representing a real sensor in the {@link SensorRegistry}, i.e. one that is not aggregated. + */ +public interface MachineSensor extends Sensor { + + /** + * Get a list of parent, grandparent etc. sensors. + */ + default List<AggregatedSensor> getParents() { + Optional<AggregatedSensor> parent = this.getParent(); + final List<AggregatedSensor> parents = new ArrayList<>(); + while (parent.isPresent()) { + parents.add(parent.get()); + parent = parent.get().getParent(); + } + return parents; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MachineSensorImpl.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MachineSensorImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..191664bfdee31874003d7420ef7f81560c4fe29b --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MachineSensorImpl.java @@ -0,0 +1,34 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import java.util.Objects; + +class MachineSensorImpl extends AbstractSensor implements MachineSensor { + + protected MachineSensorImpl(final AggregatedSensor parent, final String identifier, + final String name) { + super(parent, identifier, name); + } + + @Override + public int hashCode() { + return Objects.hashCode(this.getIdentifier()); + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (obj instanceof MachineSensor) { + final MachineSensor other = (MachineSensor) obj; + return Objects.equals(this.getIdentifier(), other.getIdentifier()); + } + return false; + } + + @Override + public String toString() { + return this.getName() + '[' + this.getIdentifier() + ']'; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MutableAggregatedSensor.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MutableAggregatedSensor.java new file mode 100644 index 0000000000000000000000000000000000000000..c0b5e42c83998622294adcb38dab50fd591d286d --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MutableAggregatedSensor.java @@ -0,0 +1,96 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Objects; + +/** + * A {@link MutableAggregatedSensor} which can child sensors be added to. + */ +public class MutableAggregatedSensor extends AbstractSensor implements AggregatedSensor { + + private final List<Sensor> children = new ArrayList<>(); + private final MutableSensorRegistry sensorRegistry; + + protected MutableAggregatedSensor(final MutableSensorRegistry registry, final String identifier, + final String name) { + super(null, identifier, name); + this.sensorRegistry = registry; + } + + protected MutableAggregatedSensor(final MutableAggregatedSensor parent, final String identifier, + final String name) { + super(parent, identifier, name); + this.sensorRegistry = parent.sensorRegistry; + } + + @Override + public Collection<Sensor> getChildren() { + return this.children; + } + + /** + * Create a new {@link MutableAggregatedSensor} as child of this sensor. + */ + public MutableAggregatedSensor addChildAggregatedSensor(final String identifier) { + return this.addChildAggregatedSensor(identifier, ""); + } + + /** + * Create a new {@link MutableAggregatedSensor} as child of this sensor. + */ + public MutableAggregatedSensor addChildAggregatedSensor(final String identifier, + final String name) { + final MutableAggregatedSensor aggregatedSensor = + new MutableAggregatedSensor(this, identifier, name); + this.children.add(aggregatedSensor); + return aggregatedSensor; + } + + /** + * Create a new {@link MachineSensor} as child of this sensor. + */ + public MachineSensor addChildMachineSensor(final String identifier) { + return this.addChildMachineSensor(identifier, ""); + } + + /** + * Create a new {@link MachineSensor} as child of this sensor. + */ + public MachineSensor addChildMachineSensor(final String identifier, final String name) { + final MachineSensorImpl machineSensor = new MachineSensorImpl(this, identifier, name); + final boolean registerResult = this.sensorRegistry.register(machineSensor); + if (!registerResult) { + throw new IllegalArgumentException( + "Sensor width identifier " + identifier + " is already registered."); + } + this.children.add(machineSensor); + return machineSensor; + } + + @Override + public int hashCode() { + return Objects.hash(this.getIdentifier(), this.children); + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (obj instanceof AggregatedSensor) { + final AggregatedSensor other = (AggregatedSensor) obj; + return Objects.equals(this.getIdentifier(), other.getIdentifier()) + && Objects.equals(this.children, other.getChildren()); + } + return false; + } + + @Override + public String toString() { + return this.getName() + '[' + this.getIdentifier() + "] (" + this.children.size() + + " children)"; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MutableSensorRegistry.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MutableSensorRegistry.java new file mode 100644 index 0000000000000000000000000000000000000000..53a0418e6c2a8efe6139fd2150de218b4f8c6966 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MutableSensorRegistry.java @@ -0,0 +1,84 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.AggregatedSensorSerializer; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.MachineSensorSerializer; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.SensorRegistrySerializer; + +/** + * A {@link SensorRegistry} to which sensors can be added. + */ +public class MutableSensorRegistry implements SensorRegistry { + + private static final Gson GSON = new GsonBuilder() + .registerTypeAdapter(MutableSensorRegistry.class, new SensorRegistrySerializer()) + .registerTypeAdapter(MutableAggregatedSensor.class, new AggregatedSensorSerializer()) + .registerTypeAdapter(MachineSensorImpl.class, new MachineSensorSerializer()).create(); + + // TODO HashMap for efficient access to machine sensors + private final Map<String, MachineSensorImpl> machineSensors = new HashMap<>(); + + // TODO maybe access to root + private final MutableAggregatedSensor topLevelSensor; + + public MutableSensorRegistry(final String topLevelSensorIdentifier) { + this(topLevelSensorIdentifier, ""); + } + + public MutableSensorRegistry(final String topLevelSensorIdentifier, + final String topLevelSensorName) { + this.topLevelSensor = + new MutableAggregatedSensor(this, topLevelSensorIdentifier, topLevelSensorName); + } + + @Override + public Optional<MachineSensor> getSensorForIdentifier(final String identifier) { + return Optional.ofNullable(this.machineSensors.get(identifier)); + } + + @Override + public MutableAggregatedSensor getTopLevelSensor() { + return this.topLevelSensor; + } + + @Override + public Collection<MachineSensor> getMachineSensors() { + return Collections.unmodifiableCollection(this.machineSensors.values()); + } + + protected boolean register(final MachineSensorImpl machineSensor) { + final Object oldValue = + this.machineSensors.putIfAbsent(machineSensor.getIdentifier(), machineSensor); + return oldValue == null; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.topLevelSensor); + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (obj instanceof SensorRegistry) { + final SensorRegistry other = (SensorRegistry) obj; + return Objects.equals(this.getTopLevelSensor(), other.getTopLevelSensor()); + } + return false; + } + + @Override + public String toJson() { + return GSON.toJson(this); + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/Sensor.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/Sensor.java new file mode 100644 index 0000000000000000000000000000000000000000..b22cc81d3912d8094ae67475ce261ce958d3d236 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/Sensor.java @@ -0,0 +1,16 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import java.util.Optional; + +/** + * Class representing a sensor in the {@link SensorRegistry}. + */ +public interface Sensor { + + Optional<AggregatedSensor> getParent(); + + String getIdentifier(); + + String getName(); + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/SensorRegistry.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/SensorRegistry.java new file mode 100644 index 0000000000000000000000000000000000000000..e079f5c12e4a3ddfe9f680860444c239ae51aa6b --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/SensorRegistry.java @@ -0,0 +1,45 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import java.util.Collection; +import java.util.Optional; + +/** + * Hierarchical data structure (i.e. a tree) for organizing sensors. A {@link SensorRegistry} has + * one top-level sensor which can have multiple child sensors. These sensors can either be real + * {@link MachineSensor}s or {@link AggregatedSensor}s, having child sensors. + */ +public interface SensorRegistry { + + Optional<MachineSensor> getSensorForIdentifier(final String identifier); + + AggregatedSensor getTopLevelSensor(); + + Collection<MachineSensor> getMachineSensors(); + + /** + * Flattens the hierarchy to a collection of all contained {@link Sensor}s. + * + * @return A collection of all {@link Sensor}s contained in the hierarchy. + */ + default Collection<Sensor> flatten() { + return this.getTopLevelSensor().flatten(); + } + + /** + * Converts this sensor registry into a json string. + * + * <p> + * Per default a copy of this sensor registry is created to ensure that proper (de)serializers + * exist. If subclasses have appropriate serdes, they should override this method. + * </p> + */ + default String toJson() { + final ImmutableSensorRegistry immutableSensorRegistry = ImmutableSensorRegistry.copyOf(this); + return immutableSensorRegistry.toJson(); + } + + static SensorRegistry fromJson(final String json) { + return ImmutableSensorRegistry.fromJson(json); + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/AggregatedSensorSerializer.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/AggregatedSensorSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..64156fbc10af5a64a02107840d3586cafc30f6e8 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/AggregatedSensorSerializer.java @@ -0,0 +1,25 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.AggregatedSensor; + +/** + * {@link JsonSerializer} for {@link AggregatedSensor}s. + */ +public final class AggregatedSensorSerializer implements JsonSerializer<AggregatedSensor> { + + @Override + public JsonElement serialize(final AggregatedSensor sensor, final Type type, + final JsonSerializationContext context) { + final JsonObject jsonSensorObject = new JsonObject(); + jsonSensorObject.addProperty("identifier", sensor.getIdentifier()); + jsonSensorObject.addProperty("name", sensor.getName()); + jsonSensorObject.add("children", context.serialize(sensor.getChildren())); + return jsonSensorObject; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/MachineSensorSerializer.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/MachineSensorSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..4301552e922801d402f456b51a5607d9e1351294 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/MachineSensorSerializer.java @@ -0,0 +1,24 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MachineSensor; + +/** + * {@link JsonSerializer} for {@link MachineSensor}s. + */ +public final class MachineSensorSerializer implements JsonSerializer<MachineSensor> { + + @Override + public JsonElement serialize(final MachineSensor sensor, final Type type, + final JsonSerializationContext context) { + final JsonObject jsonSensorObject = new JsonObject(); + jsonSensorObject.addProperty("identifier", sensor.getIdentifier()); + jsonSensorObject.addProperty("name", sensor.getName()); + return jsonSensorObject; + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistryDeserializer.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistryDeserializer.java new file mode 100644 index 0000000000000000000000000000000000000000..b0a3a30524ae4d6c3b78d584c5eb574644fcbb08 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistryDeserializer.java @@ -0,0 +1,120 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization; + +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import java.lang.reflect.Type; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.AggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.ImmutableSensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MutableAggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MutableSensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; + +/** + * {@link JsonDeserializer} for {@link AggregatedSensor}s. + */ +public final class SensorRegistryDeserializer implements JsonDeserializer<SensorRegistry> { + + private static final String IDENTIFIER_KEY = "identifier"; + + private static final String NAME_KEY = "name"; + + private static final String CHILDREN_KEY = "children"; + + @Override + public SensorRegistry deserialize(final JsonElement jsonElement, final Type type, + final JsonDeserializationContext context) { + final MutableSensorRegistry sensorRegistry = this.transformTopLevelSensor(jsonElement); + + return ImmutableSensorRegistry.copyOf(sensorRegistry); + } + + private MutableSensorRegistry transformTopLevelSensor(final JsonElement jsonElement) { + final SensorParseResult parseResult = this.parseSensor(jsonElement); // + if (parseResult == null) { + // create empty registry + return new MutableSensorRegistry("", ""); + } else { + // create registry from result + final MutableSensorRegistry sensorRegistry = + new MutableSensorRegistry(parseResult.identifier, parseResult.name); + if (parseResult.children != null) { + for (final JsonElement childJsonElement : parseResult.children) { + this.addSensor(childJsonElement, sensorRegistry.getTopLevelSensor()); + } + } + return sensorRegistry; + } + } + + private void addSensor(final JsonElement jsonElement, + final MutableAggregatedSensor parentSensor) { + final SensorParseResult parseResult = this.parseSensor(jsonElement); + if (parseResult != null) { + // create child sensor from result + if (parseResult.children == null) { + // create MachineSensor + parentSensor.addChildMachineSensor(parseResult.identifier, parseResult.name); + } else { + // create Aggregated Sensor + final MutableAggregatedSensor sensor = + parentSensor.addChildAggregatedSensor(parseResult.identifier, parseResult.name); + for (final JsonElement childJsonElement : parseResult.children) { + this.addSensor(childJsonElement, sensor); + } + } + } + } + + // returns null if invalid JsonElement + private SensorParseResult parseSensor(final JsonElement jsonElement) { + if (jsonElement.isJsonObject()) { + final JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.has(IDENTIFIER_KEY)) { + final JsonElement identifierJsonElement = jsonObject.get(IDENTIFIER_KEY); + final JsonElement nameJsonElement = jsonObject.get(NAME_KEY); + if (identifierJsonElement.isJsonPrimitive() && nameJsonElement.isJsonPrimitive()) { + final JsonPrimitive identifierJsonPrimitive = identifierJsonElement.getAsJsonPrimitive(); + final JsonPrimitive nameJsonPrimitive = nameJsonElement.getAsJsonPrimitive(); + if (identifierJsonPrimitive.isString()) { + final String identifierString = identifierJsonPrimitive.getAsString(); + final String nameString = nameJsonPrimitive.getAsString(); + final JsonArray childrenJsonArray = this.parseChildren(jsonObject); + return new SensorParseResult(identifierString, nameString, childrenJsonArray); + } + } + } + } + return null; + // TODO throw exception + } + + // returns null if JsonObject does not have children or children is not an array + private JsonArray parseChildren(final JsonObject parentJsonObject) { + if (parentJsonObject.has(CHILDREN_KEY)) { + final JsonElement childrenJsonElement = parentJsonObject.get(CHILDREN_KEY); + if (childrenJsonElement.isJsonArray()) { + return childrenJsonElement.getAsJsonArray(); + } + } + return null; + // TODO throw exception + } + + private static class SensorParseResult { + private final String identifier; + private final String name; + private final JsonArray children; + + private SensorParseResult(final String identifier, final String name, + final JsonArray children) { + this.identifier = identifier; + this.children = children; + this.name = name; + } + } + +} diff --git a/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistrySerializer.java b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistrySerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..0a3581164a3e17c7e681b4c78f3d71a5a398ee92 --- /dev/null +++ b/theodolite-benchmarks/commons/src/main/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistrySerializer.java @@ -0,0 +1,20 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization; + +import com.google.gson.JsonElement; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; + +/** + * {@link JsonSerializer} for {@link SensorRegistry}s. + */ +public final class SensorRegistrySerializer implements JsonSerializer<SensorRegistry> { + + @Override + public JsonElement serialize(final SensorRegistry sensorRegistry, final Type type, + final JsonSerializationContext context) { + return context.serialize(sensorRegistry.getTopLevelSensor()); + } + +} diff --git a/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/common/configuration/NameResolvingEnvironmentConfigurationTest.java b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/common/configuration/NameResolvingEnvironmentConfigurationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e7bc8d0f66b1aea0b367756bd383af6d6ea6c0f9 --- /dev/null +++ b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/common/configuration/NameResolvingEnvironmentConfigurationTest.java @@ -0,0 +1,88 @@ +package rocks.theodolite.benchmarks.commons.common.configuration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import org.apache.commons.configuration2.Configuration; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.EnvironmentVariables; +import rocks.theodolite.benchmarks.commons.commons.configuration.NameResolvingEnvironmentConfiguration; + +public class NameResolvingEnvironmentConfigurationTest { + + private static final String PROPERTY_FILES_KEY = "my.env.var"; + private static final String ENV_VAR_KEY = "MY_ENV_VAR"; + private static final String STRING_VALUE = "value"; + private static final String STRING_VALUE_2 = "value2"; + private static final int INT_VALUE = 7; + + @Rule + public final EnvironmentVariables environmentVariables = new EnvironmentVariables(); + + @Test + public void testHelperLibrary() { + this.environmentVariables.clear("name"); + this.environmentVariables.set("name", STRING_VALUE); + assertEquals("value", System.getenv("name")); + } + + @Test + public void testGetUsingEnvVarFormat() { + this.environmentVariables.clear(ENV_VAR_KEY); + this.environmentVariables.set(ENV_VAR_KEY, STRING_VALUE); + final Configuration config = new NameResolvingEnvironmentConfiguration(); + final String result = config.getString(ENV_VAR_KEY); + assertEquals(STRING_VALUE, result); + } + + @Test + public void testGetUsingPropertiesFormat() { + this.environmentVariables.clear(ENV_VAR_KEY); + this.environmentVariables.set(ENV_VAR_KEY, STRING_VALUE); + final Configuration config = new NameResolvingEnvironmentConfiguration(); + final String result = config.getString(PROPERTY_FILES_KEY); + assertEquals(STRING_VALUE, result); + } + + @Test + public void testGetOfNumber() { + this.environmentVariables.clear(ENV_VAR_KEY); + this.environmentVariables.set(ENV_VAR_KEY, String.valueOf(INT_VALUE)); + final Configuration config = new NameResolvingEnvironmentConfiguration(); + final int result = config.getInt(PROPERTY_FILES_KEY); + assertEquals(INT_VALUE, result); + } + + @Test + public void testGetOfBothExisting() { + this.environmentVariables.clear(ENV_VAR_KEY, PROPERTY_FILES_KEY); + this.environmentVariables.set(ENV_VAR_KEY, STRING_VALUE); + this.environmentVariables.set(PROPERTY_FILES_KEY, STRING_VALUE_2); + final Configuration config = new NameResolvingEnvironmentConfiguration(); + final String result = config.getString(PROPERTY_FILES_KEY); + assertEquals(STRING_VALUE_2, result); + } + + @Test + public void testGetNonExistingUsingEnvVarFormat() { + this.environmentVariables.clear(ENV_VAR_KEY); + final Configuration config = new NameResolvingEnvironmentConfiguration(); + final String result = config.getString(ENV_VAR_KEY); + assertNull(result); + } + + @Test + public void testGetNonExistingUsingPropertiesFormat() { + this.environmentVariables.clear(ENV_VAR_KEY); + final Configuration config = new NameResolvingEnvironmentConfiguration(); + final String result = config.getString(PROPERTY_FILES_KEY); + assertNull(result); + } + + @Test + public void testFormatKeyAsEnvVariable() { + assertEquals(ENV_VAR_KEY, + NameResolvingEnvironmentConfiguration.formatKeyAsEnvVariable(PROPERTY_FILES_KEY)); + } + +} diff --git a/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/ExampleSensors.java b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/ExampleSensors.java new file mode 100644 index 0000000000000000000000000000000000000000..9d1b4d65a46202561de0aee701895d57cba4ee12 --- /dev/null +++ b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/ExampleSensors.java @@ -0,0 +1,36 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import java.util.List; +import java.util.stream.Collectors; + +public final class ExampleSensors { + + private static final SensorRegistry REGISTRY; + + static { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root"); + final MutableAggregatedSensor topLevel = sensorRegistry.getTopLevelSensor(); + final MutableAggregatedSensor comcent = topLevel.addChildAggregatedSensor("comcent"); + final MutableAggregatedSensor server1 = comcent.addChildAggregatedSensor("comcent.server1"); + final MachineSensor server1pw1 = server1.addChildMachineSensor("comcent.server1.pw1"); + final MachineSensor server1pw2 = server1.addChildMachineSensor("comcent.server1.pw2"); + final MachineSensor server1pw3 = server1.addChildMachineSensor("comcent.server1.pw3"); + final MutableAggregatedSensor server2 = comcent.addChildAggregatedSensor("comcent.server2"); + final MachineSensor server2pw1 = server2.addChildMachineSensor("comcent.server2.pw1"); + final MachineSensor server2pw2 = server2.addChildMachineSensor("comcent.server2.pw2"); + + REGISTRY = ImmutableSensorRegistry.copyOf(sensorRegistry); + } + + private ExampleSensors() {} + + public static List<String> machineSensorNames() { + return REGISTRY.getMachineSensors().stream().map(s -> s.getIdentifier()) + .collect(Collectors.toList()); + } + + public static SensorRegistry registry() { + return REGISTRY; + } + +} diff --git a/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/ImmutableSensorRegistryTest.java b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/ImmutableSensorRegistryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2be6ce4d5920f6c2640e0701a4f6afbc0cfa544f --- /dev/null +++ b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/ImmutableSensorRegistryTest.java @@ -0,0 +1,106 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +public class ImmutableSensorRegistryTest { + + @Test + public void testEquals() { + final ImmutableSensorRegistry sensorRegistry1 = + ImmutableSensorRegistry.copyOf(this.getSensorRegistry()); + final ImmutableSensorRegistry sensorRegistry2 = + ImmutableSensorRegistry.copyOf(this.getSensorRegistry()); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertTrue(sensorRegistry1.equals(sensorRegistry2)); + assertTrue(sensorRegistry2.equals(sensorRegistry1)); + } + + @Test + public void testEqualsWithDifferentNames() { + final ImmutableSensorRegistry sensorRegistry1 = + ImmutableSensorRegistry.copyOf(this.getSensorRegistry()); + final ImmutableSensorRegistry sensorRegistry2 = + ImmutableSensorRegistry.copyOf(this.getSensorRegistryWithDifferentNames()); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertTrue(sensorRegistry1.equals(sensorRegistry2)); + assertTrue(sensorRegistry2.equals(sensorRegistry1)); + } + + @Test + public void testNotEquals() { + final ImmutableSensorRegistry sensorRegistry1 = + ImmutableSensorRegistry.copyOf(this.getSensorRegistry()); + final ImmutableSensorRegistry sensorRegistry2 = + ImmutableSensorRegistry.copyOf(this.getOtherSensorRegistry()); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertFalse(sensorRegistry1.equals(sensorRegistry2)); + assertFalse(sensorRegistry2.equals(sensorRegistry1)); + } + + @Test + public void testEqualHashCodes() { + final ImmutableSensorRegistry sensorRegistry1 = + ImmutableSensorRegistry.copyOf(this.getSensorRegistry()); + final ImmutableSensorRegistry sensorRegistry2 = + ImmutableSensorRegistry.copyOf(this.getSensorRegistry()); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertTrue(sensorRegistry1.hashCode() == sensorRegistry2.hashCode()); + } + + @Test + public void testEqualHashCodesWithDifferentNames() { + final ImmutableSensorRegistry sensorRegistry1 = + ImmutableSensorRegistry.copyOf(this.getSensorRegistry()); + final ImmutableSensorRegistry sensorRegistry2 = + ImmutableSensorRegistry.copyOf(this.getSensorRegistryWithDifferentNames()); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertTrue(sensorRegistry1.hashCode() == sensorRegistry2.hashCode()); + } + + @Test + public void testNotEqualHashCodes() { + final ImmutableSensorRegistry sensorRegistry1 = + ImmutableSensorRegistry.copyOf(this.getSensorRegistry()); + final ImmutableSensorRegistry sensorRegistry2 = + ImmutableSensorRegistry.copyOf(this.getOtherSensorRegistry()); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertFalse(sensorRegistry1.hashCode() == sensorRegistry2.hashCode()); + } + + private MutableSensorRegistry getSensorRegistry() { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root", "Root"); + final MutableAggregatedSensor topLevel = sensorRegistry.getTopLevelSensor(); + topLevel.addChildMachineSensor("child-1", "Child 1"); + final MutableAggregatedSensor aggregatedSensor = + topLevel.addChildAggregatedSensor("child-2", "Child 2"); + aggregatedSensor.addChildMachineSensor("grandchild-1", "Grandchild 1"); + aggregatedSensor.addChildMachineSensor("grandchild-2", "Grandchild 2"); + return sensorRegistry; + } + + private MutableSensorRegistry getSensorRegistryWithDifferentNames() { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root", "Root"); + final MutableAggregatedSensor topLevel = sensorRegistry.getTopLevelSensor(); + topLevel.addChildMachineSensor("child-1", "Child 1 Alternative"); + final MutableAggregatedSensor aggregatedSensor = + topLevel.addChildAggregatedSensor("child-2", "Child 2"); + aggregatedSensor.addChildMachineSensor("grandchild-1", "Grandchild 1"); + aggregatedSensor.addChildMachineSensor("grandchild-2", "Grandchild 2 Alternative"); + return sensorRegistry; + } + + private MutableSensorRegistry getOtherSensorRegistry() { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root", "Root"); + final MutableAggregatedSensor topLevel = sensorRegistry.getTopLevelSensor(); + topLevel.addChildMachineSensor("child-1", "Child 1"); + final MutableAggregatedSensor aggregatedSensor = + topLevel.addChildAggregatedSensor("child-2", "Child 2"); + aggregatedSensor.addChildMachineSensor("grandchild-1", "Grandchild 1"); + aggregatedSensor.addChildMachineSensor("grandchild-2", "Grandchild 2"); + aggregatedSensor.addChildMachineSensor("grandchild-3", "Grandchild 3"); + return sensorRegistry; + } + +} diff --git a/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MaschineSensorImplExposer.java b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MaschineSensorImplExposer.java new file mode 100644 index 0000000000000000000000000000000000000000..f397d8ad7c2676e7f98be8d0fdb1743347509960 --- /dev/null +++ b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MaschineSensorImplExposer.java @@ -0,0 +1,13 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +/** + * Helper class to allow tests in other packages access {@link MachineSensorImpl} class objects. + */ +public final class MaschineSensorImplExposer { + + public static final Class<? extends MachineSensor> MACHINE_SENSOR_IMPL_CLASS = + MachineSensorImpl.class; + + private MaschineSensorImplExposer() {} + +} diff --git a/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MutableSensorRegistryTest.java b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MutableSensorRegistryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5d49c65c69209c574de35ac4509cf32c04c89459 --- /dev/null +++ b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/MutableSensorRegistryTest.java @@ -0,0 +1,102 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import java.util.Optional; +import org.junit.Test; + +public class MutableSensorRegistryTest { + + @Test + public void parentOfTopLevelShouldBeNotPresent() { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root"); + final Optional<AggregatedSensor> parent = sensorRegistry.getTopLevelSensor().getParent(); + assertFalse(parent.isPresent()); + } + + @Test + public void testEquals() { + final MutableSensorRegistry sensorRegistry1 = this.getSensorRegistry(); + final MutableSensorRegistry sensorRegistry2 = this.getSensorRegistry(); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertTrue(sensorRegistry1.equals(sensorRegistry2)); + assertTrue(sensorRegistry2.equals(sensorRegistry1)); + } + + @Test + public void testEqualsWithDifferentNames() { + final MutableSensorRegistry sensorRegistry1 = this.getSensorRegistry(); + final MutableSensorRegistry sensorRegistry2 = this.getSensorRegistryWithDifferentNames(); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertTrue(sensorRegistry1.equals(sensorRegistry2)); + assertTrue(sensorRegistry2.equals(sensorRegistry1)); + } + + @Test + public void testNotEquals() { + final MutableSensorRegistry sensorRegistry1 = this.getSensorRegistry(); + final MutableSensorRegistry sensorRegistry2 = this.getOtherSensorRegistry(); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertFalse(sensorRegistry1.equals(sensorRegistry2)); + assertFalse(sensorRegistry2.equals(sensorRegistry1)); + } + + @Test + public void testEqualHashCodes() { + final MutableSensorRegistry sensorRegistry1 = this.getSensorRegistry(); + final MutableSensorRegistry sensorRegistry2 = this.getSensorRegistry(); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertTrue(sensorRegistry1.hashCode() == sensorRegistry2.hashCode()); + } + + @Test + public void testEqualHashCodesWithDifferentNames() { + final MutableSensorRegistry sensorRegistry1 = this.getSensorRegistry(); + final MutableSensorRegistry sensorRegistry2 = this.getSensorRegistryWithDifferentNames(); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertTrue(sensorRegistry1.hashCode() == sensorRegistry2.hashCode()); + } + + @Test + public void testNotEqualHashCodes() { + final MutableSensorRegistry sensorRegistry1 = this.getSensorRegistry(); + final MutableSensorRegistry sensorRegistry2 = this.getOtherSensorRegistry(); + assertFalse(sensorRegistry1 == sensorRegistry2); + assertFalse(sensorRegistry1.hashCode() == sensorRegistry2.hashCode()); + } + + private MutableSensorRegistry getSensorRegistry() { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root", "Root"); + final MutableAggregatedSensor topLevel = sensorRegistry.getTopLevelSensor(); + topLevel.addChildMachineSensor("child-1", "Child 1"); + final MutableAggregatedSensor aggregatedSensor = + topLevel.addChildAggregatedSensor("child-2", "Child 2"); + aggregatedSensor.addChildMachineSensor("grandchild-1", "Grandchild 1"); + aggregatedSensor.addChildMachineSensor("grandchild-2", "Grandchild 2"); + return sensorRegistry; + } + + private MutableSensorRegistry getSensorRegistryWithDifferentNames() { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root", "Root"); + final MutableAggregatedSensor topLevel = sensorRegistry.getTopLevelSensor(); + topLevel.addChildMachineSensor("child-1", "Child 1 Alternative"); + final MutableAggregatedSensor aggregatedSensor = + topLevel.addChildAggregatedSensor("child-2", "Child 2"); + aggregatedSensor.addChildMachineSensor("grandchild-1", "Grandchild 1"); + aggregatedSensor.addChildMachineSensor("grandchild-2", "Grandchild 2 Alternative"); + return sensorRegistry; + } + + private MutableSensorRegistry getOtherSensorRegistry() { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root", "Root"); + final MutableAggregatedSensor topLevel = sensorRegistry.getTopLevelSensor(); + topLevel.addChildMachineSensor("child-1", "Child 1"); + final MutableAggregatedSensor aggregatedSensor = + topLevel.addChildAggregatedSensor("child-2", "Child 2"); + aggregatedSensor.addChildMachineSensor("grandchild-1", "Grandchild 1"); + aggregatedSensor.addChildMachineSensor("grandchild-2", "Grandchild 2"); + aggregatedSensor.addChildMachineSensor("grandchild-3", "Grandchild 3"); + return sensorRegistry; + } + +} diff --git a/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistryDeserializerTest.java b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistryDeserializerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a9821eb90a916e42fdff8750d5c0d7c3cfd265a8 --- /dev/null +++ b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistryDeserializerTest.java @@ -0,0 +1,174 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import rocks.theodolite.benchmarks.commons.model.sensorregistry.AggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MachineSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.Sensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.SensorRegistryDeserializer; + +public class SensorRegistryDeserializerTest { + + private Gson gson; + + @Before + public void setUp() throws Exception { + this.gson = new GsonBuilder().registerTypeAdapter(SensorRegistry.class, new SensorRegistryDeserializer()).create(); + } + + @After + public void tearDown() throws Exception { + this.gson = null; + } + + @Test + public void testEmptyRegistry() { + final String json = ""; + final SensorRegistry registry = this.gson.fromJson(json, SensorRegistry.class); + assertNull(registry); + } + + @Test + public void testRegistryOfWrongType() { + final String json = "[{\"identifier\": \"my-id\", \"name\": \"My Name\"}]"; + final SensorRegistry registry = this.gson.fromJson(json, SensorRegistry.class); + assertEquals(registry.getTopLevelSensor().getIdentifier(), ""); + assertTrue(registry.getTopLevelSensor().getChildren().isEmpty()); + } + + @Test + public void testRegistryWithMissingIdentifier() { + final String json = "{\"children\": []}"; + final SensorRegistry registry = this.gson.fromJson(json, SensorRegistry.class); + assertEquals(registry.getTopLevelSensor().getIdentifier(), ""); + assertTrue(registry.getTopLevelSensor().getChildren().isEmpty()); + } + + @Test + public void testRegistryWithMissingChildren() { + final String json = "{\"identifier\": \"my-root-id\", \"name\": \"My Name\"}"; + final SensorRegistry registry = this.gson.fromJson(json, SensorRegistry.class); + assertEquals(registry.getTopLevelSensor().getIdentifier(), "my-root-id"); + assertTrue(registry.getTopLevelSensor().getChildren().isEmpty()); + } + + @Test + public void testRegistryWithZeroChildren() { + final String json = "{\"identifier\": \"my-root-id\", \"name\": \"My Name\", \"children\": []}"; + final SensorRegistry registry = this.gson.fromJson(json, SensorRegistry.class); + assertEquals(registry.getTopLevelSensor().getIdentifier(), "my-root-id"); + assertTrue(registry.getTopLevelSensor().getChildren().isEmpty()); + } + + @Test + public void testRegistryWithOneGenerationChildren() { + final String json = "{\"identifier\": \"my-root-id\", \"name\": \"My Name\", \"children\": [{\"identifier\": \"child-id-1\", \"name\": \"Child 1\"}, {\"identifier\": \"child-id-2\", \"name\": \"Child 2\"}, {\"identifier\": \"child-id-3\", \"name\": \"Child 3\"}]}"; + final List<String> childIdentifiers = ImmutableList.of("child-id-1", "child-id-2", "child-id-3"); // List.of() in Java <= 9 + + final SensorRegistry registry = this.gson.fromJson(json, SensorRegistry.class); + final AggregatedSensor topLevelSensor = registry.getTopLevelSensor(); + assertEquals(topLevelSensor.getIdentifier(), "my-root-id"); + final List<Sensor> childSensors = Lists.newArrayList(topLevelSensor.getChildren()); + assertEquals(childSensors.size(), 3); + for (final Sensor sensor : childSensors) { + assertTrue(childIdentifiers.contains(sensor.getIdentifier())); + assertTrue(sensor instanceof MachineSensor); + } + for (final String childIdentifier : childIdentifiers) { + assertTrue(registry.getSensorForIdentifier(childIdentifier).isPresent()); + } + } + + @Test + public void testRegistryWithCorruptedChild() { + final String json = "{\"identifier\": \"my-root-id\", \"name\": \"My Name\", \"children\": [{\"identifier\": \"child-id-1\", \"name\": \"Child 1\"}, {\"no-identifier\": \"child-id-2\", \"name\": \"Child 2\"}]}"; + final List<String> childIdentifiers = ImmutableList.of("child-id-1"); // List.of() in Java <= 9 + + final SensorRegistry registry = this.gson.fromJson(json, SensorRegistry.class); + final AggregatedSensor topLevelSensor = registry.getTopLevelSensor(); + assertEquals(topLevelSensor.getIdentifier(), "my-root-id"); + final List<Sensor> childSensors = Lists.newArrayList(topLevelSensor.getChildren()); + assertEquals(childSensors.size(), 1); + for (final Sensor sensor : childSensors) { + assertTrue(childIdentifiers.contains(sensor.getIdentifier())); + assertTrue(sensor instanceof MachineSensor); + } + for (final String childIdentifier : childIdentifiers) { + assertTrue(registry.getSensorForIdentifier(childIdentifier).isPresent()); + } + } + + @Test + public void testRegistryWithArrayAsChild() { + final String json = "{\"identifier\": \"my-root-id\", \"name\": \"My Name\", \"children\": [{\"identifier\": \"child-id-1\", \"name\": \"Child 1\"}, [{\"identifier\": \"child-id-2\", \"name\": \"Child 2\"}]]}"; + final List<String> childIdentifiers = ImmutableList.of("child-id-1"); // List.of() in Java <= 9 + + final SensorRegistry registry = this.gson.fromJson(json, SensorRegistry.class); + final AggregatedSensor topLevelSensor = registry.getTopLevelSensor(); + assertEquals(topLevelSensor.getIdentifier(), "my-root-id"); + final List<Sensor> childSensors = Lists.newArrayList(topLevelSensor.getChildren()); + assertEquals(childSensors.size(), 1); + for (final Sensor sensor : childSensors) { + assertTrue(childIdentifiers.contains(sensor.getIdentifier())); + assertTrue(sensor instanceof MachineSensor); + } + for (final String childIdentifier : childIdentifiers) { + assertTrue(registry.getSensorForIdentifier(childIdentifier).isPresent()); + } + } + + @Test + public void testRegistryWithTwoGenerationChildren() { + final String json = "{\"identifier\": \"my-root-id\", \"name\": \"My Name\", \"children\": [{\"identifier\": \"child-id-1\", \"name\": \"Child 1\", \"children\": [{\"identifier\": \"child-id-1-1\", \"name\": \"Child 1a\"}, {\"identifier\": \"child-id-1-2\", \"name\": \"Child 1b\"}, {\"identifier\": \"child-id-1-3\", \"name\": \"Child 1c\"}]}, {\"identifier\": \"child-id-2\", \"name\": \"Child 2\"}]}"; + final List<String> childIdentifiers = ImmutableList.of("child-id-1", "child-id-2"); // List.of() in Java <= 9 + final List<String> grandChildIdentifiers = ImmutableList.of("child-id-1-1", "child-id-1-2", "child-id-1-3"); // List.of() in Java <= 9 + final List<String> machineSensorIdentifiers = ImmutableList.of("child-id-2", "child-id-1-1", "child-id-1-2", // List.of() in Java <= 9 + "child-id-1-3"); + + final SensorRegistry registry = this.gson.fromJson(json, SensorRegistry.class); + final AggregatedSensor topLevelSensor = registry.getTopLevelSensor(); + assertEquals(topLevelSensor.getIdentifier(), "my-root-id"); + final List<Sensor> childSensors = Lists.newArrayList(topLevelSensor.getChildren()); + assertEquals(childSensors.size(), 2); + for (final Sensor sensor : childSensors) { + assertTrue(childIdentifiers.contains(sensor.getIdentifier())); + if (sensor.getIdentifier().equals("child-id-2")) { + assertTrue(sensor instanceof MachineSensor); + } else if (sensor.getIdentifier().equals("child-id-1")) { + assertTrue(sensor instanceof AggregatedSensor); + if (sensor instanceof AggregatedSensor) { + final AggregatedSensor aggregatedSensor = (AggregatedSensor) sensor; + final List<Sensor> grandChildSensors = Lists.newArrayList(aggregatedSensor.getChildren()); + assertEquals(grandChildSensors.size(), 3); + for (final Sensor grandChildSensor : grandChildSensors) { + assertTrue(grandChildIdentifiers.contains(grandChildSensor.getIdentifier())); + assertTrue(grandChildSensor instanceof MachineSensor); + } + } else { + fail(); // Should never happen because of asserTrue check before + } + } else { + fail("Sensor is neither of type MachineSensor nor AggregatedSensor"); + } + } + for (final String identifier : machineSensorIdentifiers) { + assertTrue(registry.getSensorForIdentifier(identifier).isPresent()); + } + } + +} diff --git a/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistrySerializerTest.java b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistrySerializerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c2413b571c3445df71480f76cb2b0cf251ad6009 --- /dev/null +++ b/theodolite-benchmarks/commons/src/test/java/rocks/theodolite/benchmarks/commons/model/sensorregistry/serialization/SensorRegistrySerializerTest.java @@ -0,0 +1,74 @@ +package rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization; + +import static org.junit.Assert.assertEquals; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MaschineSensorImplExposer; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MutableAggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MutableSensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.AggregatedSensorSerializer; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.MachineSensorSerializer; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.serialization.SensorRegistrySerializer; + +public class SensorRegistrySerializerTest { + + private Gson gson; + + @Before + public void setUp() throws Exception { + this.gson = new GsonBuilder() + .registerTypeAdapter(MutableSensorRegistry.class, new SensorRegistrySerializer()) + .registerTypeAdapter(MutableAggregatedSensor.class, new AggregatedSensorSerializer()) + .registerTypeAdapter(MaschineSensorImplExposer.MACHINE_SENSOR_IMPL_CLASS, + new MachineSensorSerializer()) + .create(); + } + + @After + public void tearDown() throws Exception { + this.gson = null; + } + + @Test + public void testEmptySensorRegistry() { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root", "Root"); + + final String json = this.gson.toJson(sensorRegistry); + System.out.println(json); + assertEquals(json, "{\"identifier\":\"root\",\"name\":\"Root\",\"children\":[]}"); + } + + @Test + public void testEmptySensorRegistryWithChildren() { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root", "Root"); + final MutableAggregatedSensor topLevel = sensorRegistry.getTopLevelSensor(); + topLevel.addChildMachineSensor("child-1", "Child 1"); + topLevel.addChildMachineSensor("child-2"); + + final String json = this.gson.toJson(sensorRegistry); + System.out.println(json); + assertEquals(json, + "{\"identifier\":\"root\",\"name\":\"Root\",\"children\":[{\"identifier\":\"child-1\",\"name\":\"Child 1\"},{\"identifier\":\"child-2\",\"name\":\"\"}]}"); + } + + @Test + public void testEmptySensorRegistryWithGrandChildren() { + final MutableSensorRegistry sensorRegistry = new MutableSensorRegistry("root", "Root"); + final MutableAggregatedSensor topLevel = sensorRegistry.getTopLevelSensor(); + final MutableAggregatedSensor aggregatedSensor = + topLevel.addChildAggregatedSensor("child-1", "Child 1"); + aggregatedSensor.addChildMachineSensor("child-1-1", "Child 1a"); + aggregatedSensor.addChildMachineSensor("child-1-2", "Child 1b"); + topLevel.addChildMachineSensor("child-2", "Child 2"); + + final String json = this.gson.toJson(sensorRegistry); + System.out.println(json); + assertEquals(json, + "{\"identifier\":\"root\",\"name\":\"Root\",\"children\":[{\"identifier\":\"child-1\",\"name\":\"Child 1\",\"children\":[{\"identifier\":\"child-1-1\",\"name\":\"Child 1a\"},{\"identifier\":\"child-1-2\",\"name\":\"Child 1b\"}]},{\"identifier\":\"child-2\",\"name\":\"Child 2\"}]}"); + } + +} diff --git a/theodolite-benchmarks/http-bridge/build.gradle b/theodolite-benchmarks/http-bridge/build.gradle index fa98d9fdd602174a945df95321f5e32b8c64052f..7714f9947b1361badb8a17d3eb6f063b1dc39aab 100644 --- a/theodolite-benchmarks/http-bridge/build.gradle +++ b/theodolite-benchmarks/http-bridge/build.gradle @@ -17,8 +17,7 @@ repositories { } dependencies { - implementation('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } - implementation('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } + implementation project(':commons') implementation project(':load-generator-commons') implementation 'io.javalin:javalin:4.3.0' diff --git a/theodolite-benchmarks/http-bridge/src/main/java/rocks/theodolite/benchmarks/httpbridge/EnvVarHttpBridgeFactory.java b/theodolite-benchmarks/http-bridge/src/main/java/rocks/theodolite/benchmarks/httpbridge/EnvVarHttpBridgeFactory.java index d3c172ac87221ab03f0171883df26802bf5a3aa9..2d49f05eea8aee1a3ed72d63868fbd6a50a92f48 100644 --- a/theodolite-benchmarks/http-bridge/src/main/java/rocks/theodolite/benchmarks/httpbridge/EnvVarHttpBridgeFactory.java +++ b/theodolite-benchmarks/http-bridge/src/main/java/rocks/theodolite/benchmarks/httpbridge/EnvVarHttpBridgeFactory.java @@ -3,9 +3,9 @@ package rocks.theodolite.benchmarks.httpbridge; import java.util.List; import java.util.Objects; import java.util.Optional; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.loadgenerator.ConfigurationKeys; import rocks.theodolite.benchmarks.loadgenerator.TitanKafkaSenderFactory; -import titan.ccp.model.records.ActivePowerRecord; class EnvVarHttpBridgeFactory { diff --git a/theodolite-benchmarks/kstreams-commons/build.gradle b/theodolite-benchmarks/kstreams-commons/build.gradle index 167a75327b251af20b1142fe42c82b3bbedfe62b..e443e3af19d8b51e230d6f57a865aef9a4d90e30 100644 --- a/theodolite-benchmarks/kstreams-commons/build.gradle +++ b/theodolite-benchmarks/kstreams-commons/build.gradle @@ -14,9 +14,8 @@ repositories { dependencies { // These dependencies are used internally, and not exposed to consumers on their own compile classpath. + implementation project(':commons') // implementation 'org.slf4j:slf4j-simple:1.7.25' - implementation('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } - implementation('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } implementation 'org.apache.kafka:kafka-streams:3.1.0' // Use JUnit test framework diff --git a/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/GenericSerde.java b/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/GenericSerde.java new file mode 100644 index 0000000000000000000000000000000000000000..4fa269385e522d42f9c3af3a6f4102468380bc35 --- /dev/null +++ b/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/GenericSerde.java @@ -0,0 +1,64 @@ +package rocks.theodolite.benchmarks.commons.kstreams; + +import java.util.Map; +import java.util.function.Function; +import org.apache.kafka.common.serialization.Deserializer; +import org.apache.kafka.common.serialization.Serde; +import org.apache.kafka.common.serialization.Serializer; + +/** + * Factory methods to create generic {@link Serde}s. + */ +public final class GenericSerde { + + private GenericSerde() {} + + /** + * Create a {@link Serde} using a serialize and a deserialize function. + * + * @param serializer function to convert a record into a byte array + * @param deserializer function to create a record from a byte array + */ + public static <T> Serde<T> from(final Function<T, byte[]> serializer, + final Function<byte[], T> deserializer) { + return org.apache.kafka.common.serialization.Serdes.serdeFrom(new Serializer<T>() { + + @Override + public void configure(final Map<String, ?> configs, final boolean isKey) { + // Do nothing + } + + @Override + public byte[] serialize(final String topic, final T data) { + return serializer.apply(data); + } + + @Override + public void close() { + // Do nothing + } + }, new Deserializer<T>() { + + @Override + public void configure(final Map<String, ?> configs, final boolean isKey) { + // Do nothing + } + + @Override + public T deserialize(final String topic, final byte[] data) { + if (data == null) { + return null; + } + return deserializer.apply(data); + } + + @Override + public void close() { + // Do nothing + } + + }); + + } + +} diff --git a/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/KafkaStreamsBuilder.java b/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/KafkaStreamsBuilder.java index 06e8591eebc538fcfaed2db394625d8a6dd8b033..5a2716c6ebcb2a857946908b500554d3de883174 100644 --- a/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/KafkaStreamsBuilder.java +++ b/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/KafkaStreamsBuilder.java @@ -7,7 +7,6 @@ import org.apache.commons.configuration2.Configuration; import org.apache.kafka.streams.KafkaStreams; import org.apache.kafka.streams.StreamsConfig; import org.apache.kafka.streams.Topology; -import titan.ccp.common.kafka.streams.PropertiesBuilder; /** * Builder for the Kafka Streams configuration. diff --git a/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/PropertiesBuilder.java b/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/PropertiesBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..78dda383a25b155c7ab1de91df9ddd6f320fbecc --- /dev/null +++ b/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/PropertiesBuilder.java @@ -0,0 +1,50 @@ +package rocks.theodolite.benchmarks.commons.kstreams; + +import java.util.Properties; +import java.util.function.Predicate; + + +/** + * Interface for a helper class for constructing and logging Kafka Stream {@link Properties}. + */ +public interface PropertiesBuilder { + + /** + * Set the provided configuration key to the provided value. + */ + <T> PropertiesBuilder set(String configKey, T value); + + /** + * Set the provided configuration key to the provided value if a given condition is evaluated to + * true. + */ + <T> PropertiesBuilder set(String configKey, T value, Predicate<T> condition); + + /** + * Build a {@link Properties} object with the option being set before. + */ + Properties build(); + + /** + * Interface representing an Kafka Stream {@link Properties} builder without the application id + * yet being set. + */ + interface WithoutApplicationId { + + /** + * Continue building Kafka Stream properties by specifying an application id. From now on, all + * configuration properties can be set directly. + */ + PropertiesBuilder applicationId(String applicationId); + + } + + /** + * Start building Kafka Stream properties by specifying a bootstrap server. Next, an application + * id has to be specified. + */ + static PropertiesBuilder.WithoutApplicationId bootstrapServers(final String bootstrapServers) { + return PropertiesBuilderImpl.bootstrapServers(bootstrapServers); + } + +} diff --git a/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/PropertiesBuilderImpl.java b/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/PropertiesBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..34459b8ea3d4c7d842e38c06cf12d7f0ffb9f14c --- /dev/null +++ b/theodolite-benchmarks/kstreams-commons/src/main/java/rocks/theodolite/benchmarks/commons/kstreams/PropertiesBuilderImpl.java @@ -0,0 +1,52 @@ +package rocks.theodolite.benchmarks.commons.kstreams; + +import java.util.Objects; +import java.util.Properties; +import java.util.function.Predicate; +import org.apache.kafka.streams.StreamsConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Default implementation for {@link PropertiesBuilder} and + * {@link PropertiesBuilder.WithoutApplicationId}. + */ +class PropertiesBuilderImpl implements PropertiesBuilder, PropertiesBuilder.WithoutApplicationId { + + private static final Logger LOGGER = LoggerFactory.getLogger(PropertiesBuilderImpl.class); + + private final Properties properties = new Properties(); + + @Override + public <T> PropertiesBuilderImpl set(final String configKey, final T value) { + this.properties.put(configKey, value); + LOGGER.info("Set Kafka Streams configuration parameter '{}' to '{}'.", configKey, value); + return this; + } + + @Override + public <T> PropertiesBuilderImpl set(final String configKey, final T value, + final Predicate<T> condition) { + if (condition.test(value)) { + this.set(configKey, value); + } + return this; + } + + @Override + public Properties build() { + return this.properties; + } + + @Override + public PropertiesBuilderImpl applicationId(final String applicationId) { + Objects.requireNonNull(applicationId, "Kafka Streams application ID cannot be null."); + return this.set(StreamsConfig.APPLICATION_ID_CONFIG, applicationId); + } + + protected static PropertiesBuilderImpl bootstrapServers(final String bootsrapservers) { + Objects.requireNonNull(bootsrapservers, "Kafka bootstrap servers cannot be null."); + return new PropertiesBuilderImpl().set(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, bootsrapservers); + } + +} diff --git a/theodolite-benchmarks/load-generator-commons/build.gradle b/theodolite-benchmarks/load-generator-commons/build.gradle index 62542eeabc1cccb35fa9f71d1929b72956a56999..082fb8eb9f1df15fb7b054588bb9728940eb442f 100644 --- a/theodolite-benchmarks/load-generator-commons/build.gradle +++ b/theodolite-benchmarks/load-generator-commons/build.gradle @@ -18,8 +18,7 @@ dependencies { implementation 'org.slf4j:slf4j-simple:1.7.25' implementation 'com.google.guava:guava:30.1-jre' implementation 'com.google.code.gson:gson:2.8.2' - implementation('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } - implementation('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } + implementation project(':commons') implementation 'org.apache.kafka:kafka-streams:2.6.0' // TODO required? implementation platform('com.google.cloud:libraries-bom:24.2.0') implementation 'com.google.protobuf:protobuf-java-util' diff --git a/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/EnvVarLoadGeneratorFactory.java b/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/EnvVarLoadGeneratorFactory.java index ae9a6d4220ceaec091a0a2fb49fb82f16fdbb42e..5d5f3c0c64b4d8a0efc4f4c7c332986ea4b9560d 100644 --- a/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/EnvVarLoadGeneratorFactory.java +++ b/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/EnvVarLoadGeneratorFactory.java @@ -7,7 +7,7 @@ import java.util.Properties; import org.apache.kafka.clients.producer.ProducerConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; class EnvVarLoadGeneratorFactory { diff --git a/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/KafkaRecordSender.java b/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/KafkaRecordSender.java index 56b1946ad78d888fe6e5140fdc373bb2cd3a4ed4..0593e850112bf20d0e02f0a6f2aa884b9ce4406e 100644 --- a/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/KafkaRecordSender.java +++ b/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/KafkaRecordSender.java @@ -8,7 +8,7 @@ import org.apache.kafka.clients.producer.ProducerConfig; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.common.serialization.Serializer; import org.apache.kafka.common.serialization.StringSerializer; -import titan.ccp.common.kafka.avro.SchemaRegistryAvroSerdeFactory; +import rocks.theodolite.benchmarks.commons.kafka.avro.SchemaRegistryAvroSerdeFactory; /** * Sends records to Kafka. diff --git a/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanKafkaSenderFactory.java b/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanKafkaSenderFactory.java index ee7d416513439a5d0ba7bad7bcdb09e1baf5e4c7..02a46952d9f21bfda5dc7ebea24fc1c7779e77bb 100644 --- a/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanKafkaSenderFactory.java +++ b/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanKafkaSenderFactory.java @@ -1,7 +1,7 @@ package rocks.theodolite.benchmarks.loadgenerator; import java.util.Properties; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * A factory for creating {@link KafkaRecordSender}s that sends Titan {@link ActivePowerRecord}s. diff --git a/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanPubSubSenderFactory.java b/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanPubSubSenderFactory.java index 569d98fb9dcd235d12a0c415fdae495eeb6abdd4..c355033343854004e0aa4dff066da6abdebd7f8b 100644 --- a/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanPubSubSenderFactory.java +++ b/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanPubSubSenderFactory.java @@ -2,7 +2,7 @@ package rocks.theodolite.benchmarks.loadgenerator; import java.io.IOException; import java.nio.ByteBuffer; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * A factory for creating {@link PubSubRecordSender}s that sends Titan {@link ActivePowerRecord}s. diff --git a/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanRecordGenerator.java b/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanRecordGenerator.java index 34b17db4220e60e1fd273b1acf0a0c1543a0742b..41ee632fccb836f0264251142e01386019746674 100644 --- a/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanRecordGenerator.java +++ b/theodolite-benchmarks/load-generator-commons/src/main/java/rocks/theodolite/benchmarks/loadgenerator/TitanRecordGenerator.java @@ -1,7 +1,7 @@ package rocks.theodolite.benchmarks.loadgenerator; import java.time.Clock; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * A factory for creating {@link RecordGenerator}s that creates Titan {@link ActivePowerRecord}s. diff --git a/theodolite-benchmarks/load-generator-commons/src/test/java/rocks/theodolite/benchmarks/loadgenerator/HttpRecordSenderTest.java b/theodolite-benchmarks/load-generator-commons/src/test/java/rocks/theodolite/benchmarks/loadgenerator/HttpRecordSenderTest.java index 731dda6c74fd3cd6d74771f95896c2260ce6df29..74e10711643398c7d0eb79a80a8ba3ff033cb4a7 100644 --- a/theodolite-benchmarks/load-generator-commons/src/test/java/rocks/theodolite/benchmarks/loadgenerator/HttpRecordSenderTest.java +++ b/theodolite-benchmarks/load-generator-commons/src/test/java/rocks/theodolite/benchmarks/loadgenerator/HttpRecordSenderTest.java @@ -14,7 +14,7 @@ import java.net.URI; import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; public class HttpRecordSenderTest { diff --git a/theodolite-benchmarks/load-generator-commons/src/test/java/rocks/theodolite/benchmarks/loadgenerator/TitanRecordGeneratorTest.java b/theodolite-benchmarks/load-generator-commons/src/test/java/rocks/theodolite/benchmarks/loadgenerator/TitanRecordGeneratorTest.java index eb7c7f2a403dfb7138bdfd8e0855930001a4488b..7ef2ae41935120a0619f76379ee321bc83c9ba4c 100644 --- a/theodolite-benchmarks/load-generator-commons/src/test/java/rocks/theodolite/benchmarks/loadgenerator/TitanRecordGeneratorTest.java +++ b/theodolite-benchmarks/load-generator-commons/src/test/java/rocks/theodolite/benchmarks/loadgenerator/TitanRecordGeneratorTest.java @@ -7,7 +7,7 @@ import java.time.ZoneId; import java.time.ZoneOffset; import org.junit.Assert; import org.junit.Test; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; public class TitanRecordGeneratorTest { diff --git a/theodolite-benchmarks/settings.gradle b/theodolite-benchmarks/settings.gradle index 0040989a8b3b02487c2d7328726b7caadb90f32f..1979f5f335444084b5421dcdba3228594a7b907e 100644 --- a/theodolite-benchmarks/settings.gradle +++ b/theodolite-benchmarks/settings.gradle @@ -1,5 +1,14 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + } +} rootProject.name = 'theodolite-benchmarks' + + +include 'commons' include 'load-generator-commons' include 'kstreams-commons' include 'flink-commons' diff --git a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/ConverterAdapter.java b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/ConverterAdapter.java index 08834a47223e8b4209da79c4cdcbb6a60e027418..b32d0cb8213b57cbad7f97f97409992e90d03abd 100644 --- a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/ConverterAdapter.java +++ b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/ConverterAdapter.java @@ -2,8 +2,8 @@ package rocks.theodolite.benchmarks.uc1.beam; import org.apache.beam.sdk.transforms.SimpleFunction; import org.apache.beam.sdk.values.TypeDescriptor; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc1.commons.RecordConverter; -import titan.ccp.model.records.ActivePowerRecord; /** * {@link SimpleFunction} which wraps a {@link RecordConverter} to be used with Beam. diff --git a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/GenericSink.java b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/GenericSink.java index 04eae799837b2e5278842d248d135e479f84086b..e42b7dea8ce346af11e5379e258970949a9def45 100644 --- a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/GenericSink.java +++ b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/GenericSink.java @@ -4,8 +4,8 @@ import org.apache.beam.sdk.transforms.MapElements; import org.apache.beam.sdk.transforms.PTransform; import org.apache.beam.sdk.transforms.ParDo; import org.apache.beam.sdk.values.PCollection; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc1.commons.DatabaseAdapter; -import titan.ccp.model.records.ActivePowerRecord; /** * A {@link PTransform} for a generic {@link DatabaseAdapter}. diff --git a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/PipelineFactory.java b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/PipelineFactory.java index d95d9b3343835f8348af15c3d00c34ef807d4501..74271aca04e28ab213ef396d61e12adc30517035 100644 --- a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/PipelineFactory.java +++ b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/PipelineFactory.java @@ -9,8 +9,8 @@ import org.apache.beam.sdk.transforms.Values; import org.apache.commons.configuration2.Configuration; import rocks.theodolite.benchmarks.commons.beam.AbstractPipelineFactory; import rocks.theodolite.benchmarks.commons.beam.kafka.KafkaActivePowerTimestampReader; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc1.beam.firestore.FirestoreOptionsExpander; -import titan.ccp.model.records.ActivePowerRecord; /** * {@link AbstractPipelineFactory} for UC1. diff --git a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/SinkFactory.java b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/SinkFactory.java index d4854293b0c26804f0204e58c09a45f13dbf171f..73b95bb2257c80a1523b76c1e6b136319e6537cf 100644 --- a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/SinkFactory.java +++ b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/SinkFactory.java @@ -3,7 +3,7 @@ package rocks.theodolite.benchmarks.uc1.beam; import org.apache.beam.sdk.transforms.PTransform; import org.apache.beam.sdk.values.PCollection; import org.apache.commons.configuration2.Configuration; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Interface for a class that creates sinks (i.e., {@link PTransform}s that map and store diff --git a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/SinkType.java b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/SinkType.java index da836815e09631e2ebc071badc02618171e0792a..60eaabfddbbc7738c33f1c2b563703710e3f0a0e 100644 --- a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/SinkType.java +++ b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/SinkType.java @@ -4,9 +4,9 @@ import java.util.stream.Stream; import org.apache.beam.sdk.transforms.PTransform; import org.apache.beam.sdk.values.PCollection; import org.apache.commons.configuration2.Configuration; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc1.beam.firestore.FirestoreSink; import rocks.theodolite.benchmarks.uc1.commons.logger.LogWriterFactory; -import titan.ccp.model.records.ActivePowerRecord; /** * Supported Sink types, i.e., {@link PTransform} for converting and storing diff --git a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/firestore/DocumentMapper.java b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/firestore/DocumentMapper.java index 1abf847250779150bb48b45c162afaeac1130044..6d23c929688bbbcda1586fb41a454605f48e2ef7 100644 --- a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/firestore/DocumentMapper.java +++ b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/firestore/DocumentMapper.java @@ -4,7 +4,7 @@ import com.google.firestore.v1.Document; import com.google.firestore.v1.Value; import java.io.IOException; import org.apache.beam.sdk.transforms.SimpleFunction; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; final class DocumentMapper extends SimpleFunction<ActivePowerRecord, Document> { diff --git a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/firestore/FirestoreSink.java b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/firestore/FirestoreSink.java index dfe3f240b9727d0fa5027ea5f29cd67def3323ba..100bb6205bd91d2562f9141332943610ba3b5e3e 100644 --- a/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/firestore/FirestoreSink.java +++ b/theodolite-benchmarks/uc1-beam/src/main/java/rocks/theodolite/benchmarks/uc1/beam/firestore/FirestoreSink.java @@ -7,7 +7,7 @@ import org.apache.beam.sdk.transforms.MapElements; import org.apache.beam.sdk.transforms.PTransform; import org.apache.beam.sdk.values.PCollection; import org.apache.commons.configuration2.Configuration; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * A {@link PTransform} mapping {@link ActivePowerRecord}s to {@link Document}s, followed by storing diff --git a/theodolite-benchmarks/uc1-commons/build.gradle b/theodolite-benchmarks/uc1-commons/build.gradle index 0f7d31d1f557ecd214b3a57227851d0f70b61084..7f742b99d8555f8be8f0ac4861ba257b1913afef 100644 --- a/theodolite-benchmarks/uc1-commons/build.gradle +++ b/theodolite-benchmarks/uc1-commons/build.gradle @@ -13,11 +13,7 @@ repositories { } dependencies { - // Make this implementation once this is a local subproject. - // Currently, Flink needs its own version of these dependencies. - compileOnly('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } - compileOnly('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } - + implementation project(':commons') implementation 'com.google.code.gson:gson:2.8.9' testImplementation 'junit:junit:4.12' diff --git a/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/DatabaseAdapter.java b/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/DatabaseAdapter.java index a1cb1ade0dc76b168cf9ee54f64d5ac88d6b3a98..99e59a6e6fcbef8e49fe04d7ecaf9ed929e9b13e 100644 --- a/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/DatabaseAdapter.java +++ b/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/DatabaseAdapter.java @@ -1,7 +1,7 @@ package rocks.theodolite.benchmarks.uc1.commons; import java.util.Objects; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * A database adapter consisting of a {@link RecordConverter} and a {@link DatabaseWriter}. diff --git a/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/RecordConverter.java b/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/RecordConverter.java index 105f19e0e920e3516f7277cd7804dae210a7d0b1..a728e9d6b676a273c3847b89b2091e8928aba114 100644 --- a/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/RecordConverter.java +++ b/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/RecordConverter.java @@ -1,6 +1,6 @@ package rocks.theodolite.benchmarks.uc1.commons; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Converts an {@link ActivePowerRecord} to the type required by a database. diff --git a/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/logger/JsonConverter.java b/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/logger/JsonConverter.java index f9974affb7bf57fc63e9bfe8ba92fd056da9a97b..a59f02687c1c6a0455f43e5a34c421c85e6972cd 100644 --- a/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/logger/JsonConverter.java +++ b/theodolite-benchmarks/uc1-commons/src/main/java/rocks/theodolite/benchmarks/uc1/commons/logger/JsonConverter.java @@ -2,8 +2,8 @@ package rocks.theodolite.benchmarks.uc1.commons.logger; import com.google.gson.Gson; import java.io.Serializable; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc1.commons.RecordConverter; -import titan.ccp.model.records.ActivePowerRecord; /** * {@link RecordConverter} that converts {@link ActivePowerRecord}s to JSON strings. diff --git a/theodolite-benchmarks/uc1-flink/src/main/java/rocks/theodolite/benchmarks/uc1/flink/ConverterAdapter.java b/theodolite-benchmarks/uc1-flink/src/main/java/rocks/theodolite/benchmarks/uc1/flink/ConverterAdapter.java index 064b8afbb03dc16262ca7fcf90a0fdd8af4419a9..8380cdc09caa35814f3203bdf6dc1746875fdf9b 100644 --- a/theodolite-benchmarks/uc1-flink/src/main/java/rocks/theodolite/benchmarks/uc1/flink/ConverterAdapter.java +++ b/theodolite-benchmarks/uc1-flink/src/main/java/rocks/theodolite/benchmarks/uc1/flink/ConverterAdapter.java @@ -1,8 +1,8 @@ package rocks.theodolite.benchmarks.uc1.flink; import org.apache.flink.api.common.functions.MapFunction; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc1.commons.RecordConverter; -import titan.ccp.model.records.ActivePowerRecord; /** * {@link MapFunction} which wraps a {@link RecordConverter} to be used with Flink. diff --git a/theodolite-benchmarks/uc1-flink/src/main/java/rocks/theodolite/benchmarks/uc1/flink/HistoryServiceFlinkJob.java b/theodolite-benchmarks/uc1-flink/src/main/java/rocks/theodolite/benchmarks/uc1/flink/HistoryServiceFlinkJob.java index d674effac653cb1613a1b218f381ec3c6c910673..83936d7482058e7db2ae6ebf2292ff3c22dbda09 100644 --- a/theodolite-benchmarks/uc1-flink/src/main/java/rocks/theodolite/benchmarks/uc1/flink/HistoryServiceFlinkJob.java +++ b/theodolite-benchmarks/uc1-flink/src/main/java/rocks/theodolite/benchmarks/uc1/flink/HistoryServiceFlinkJob.java @@ -7,11 +7,11 @@ import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import rocks.theodolite.benchmarks.commons.commons.configuration.ServiceConfigurations; import rocks.theodolite.benchmarks.commons.flink.KafkaConnectorFactory; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc1.commons.DatabaseAdapter; import rocks.theodolite.benchmarks.uc1.commons.logger.LogWriterFactory; -import titan.ccp.common.configuration.ServiceConfigurations; -import titan.ccp.model.records.ActivePowerRecord; /** * The History microservice implemented as a Flink job. diff --git a/theodolite-benchmarks/uc1-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc1/hazelcastjet/Uc1HazelcastJetFactory.java b/theodolite-benchmarks/uc1-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc1/hazelcastjet/Uc1HazelcastJetFactory.java index 4a5c5dead14e606847dc5e2ac3c95414d9f611b3..93aaa1a7e844634bb4fdf283d5b9f41a0d6c0b7f 100644 --- a/theodolite-benchmarks/uc1-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc1/hazelcastjet/Uc1HazelcastJetFactory.java +++ b/theodolite-benchmarks/uc1-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc1/hazelcastjet/Uc1HazelcastJetFactory.java @@ -134,8 +134,8 @@ public class Uc1HazelcastJetFactory { * @return The Uc1HazelcastJetBuilder factory with set kafkaPropertiesForPipeline. */ public Uc1HazelcastJetFactory setPropertiesFromEnv(final String bootstrapServersDefault, // NOPMD - final String schemaRegistryUrlDefault, - final String jobName) { + final String schemaRegistryUrlDefault, + final String jobName) { // Use KafkaPropertiesBuilder to build a properties object used for kafka final KafkaPropertiesBuilder propsBuilder = new KafkaPropertiesBuilder(); final Properties kafkaProps = diff --git a/theodolite-benchmarks/uc1-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc1/hazelcastjet/Uc1PipelineBuilder.java b/theodolite-benchmarks/uc1-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc1/hazelcastjet/Uc1PipelineBuilder.java index c02ea1e7ea7fb3f27bdbf818248678011a93f6a2..e6107682ef3aff91d45bcd7a65675b5a6323975e 100644 --- a/theodolite-benchmarks/uc1-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc1/hazelcastjet/Uc1PipelineBuilder.java +++ b/theodolite-benchmarks/uc1-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc1/hazelcastjet/Uc1PipelineBuilder.java @@ -1,18 +1,18 @@ package rocks.theodolite.benchmarks.uc1.hazelcastjet; -import static com.hazelcast.jet.pipeline.SinkBuilder.sinkBuilder; - import com.hazelcast.jet.kafka.KafkaSources; import com.hazelcast.jet.pipeline.Pipeline; import com.hazelcast.jet.pipeline.Sink; +import com.hazelcast.jet.pipeline.SinkBuilder; import com.hazelcast.jet.pipeline.StreamSource; import com.hazelcast.jet.pipeline.StreamStage; import java.util.Map.Entry; import java.util.Properties; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc1.commons.DatabaseAdapter; import rocks.theodolite.benchmarks.uc1.commons.DatabaseWriter; import rocks.theodolite.benchmarks.uc1.commons.logger.LogWriterFactory; -import titan.ccp.model.records.ActivePowerRecord; + /** * Builder to build a HazelcastJet Pipeline for UC1 which can be used for stream processing using @@ -45,7 +45,7 @@ public class Uc1PipelineBuilder { // Do not refactor this to just use the call // (There is a problem with static calls in functions in hazelcastjet) final DatabaseWriter<String> writer = this.databaseAdapter.getDatabaseWriter(); - final Sink<String> sink = sinkBuilder( + final Sink<String> sink = SinkBuilder.sinkBuilder( "Sink into database", x -> writer) .<String>receiveFn(DatabaseWriter::write) .build(); diff --git a/theodolite-benchmarks/uc1-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc1/hazelcast/Uc1PipelineTest.java b/theodolite-benchmarks/uc1-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc1/hazelcast/Uc1PipelineTest.java index 525327ddbcdcddb6cf1bfe4e2d6be62d3384fc0c..8ffde0487ab88c260655f51eac3d2701f31a7ab0 100644 --- a/theodolite-benchmarks/uc1-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc1/hazelcast/Uc1PipelineTest.java +++ b/theodolite-benchmarks/uc1-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc1/hazelcast/Uc1PipelineTest.java @@ -1,5 +1,7 @@ package rocks.theodolite.benchmarks.uc1.hazelcast; +import static com.hazelcast.jet.pipeline.SinkBuilder.sinkBuilder; +import static com.hazelcast.logging.Logger.getLogger; import com.hazelcast.jet.Jet; import com.hazelcast.jet.JetInstance; import com.hazelcast.jet.config.JetConfig; @@ -12,24 +14,21 @@ import com.hazelcast.jet.pipeline.test.AssertionCompletedException; import com.hazelcast.jet.pipeline.test.Assertions; import com.hazelcast.jet.pipeline.test.TestSources; import com.hazelcast.jet.test.SerialTest; +import com.hazelcast.logging.ILogger; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.CompletionException; -import com.hazelcast.logging.ILogger; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; import org.slf4j.Logger; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc1.commons.DatabaseAdapter; import rocks.theodolite.benchmarks.uc1.commons.DatabaseWriter; import rocks.theodolite.benchmarks.uc1.commons.logger.LogWriterFactory; import rocks.theodolite.benchmarks.uc1.hazelcastjet.Uc1PipelineBuilder; -import titan.ccp.model.records.ActivePowerRecord; - -import static com.hazelcast.jet.pipeline.SinkBuilder.sinkBuilder; -import static com.hazelcast.logging.Logger.getLogger; /** * Test methods for the Hazelcast Jet Implementation of UC1. @@ -44,7 +43,7 @@ public class Uc1PipelineTest extends JetTestSupport { // Standart Logger private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(Uc1PipelineTest.class); // HazelcastJet Logger - private static final ILogger logger = getLogger(Uc1PipelineTest.class); + private static final ILogger logger = getLogger(Uc1PipelineTest.class); private final DatabaseAdapter<String> databaseAdapter = LogWriterFactory.forJson(); @@ -55,7 +54,7 @@ public class Uc1PipelineTest extends JetTestSupport { @Before public void buildUc1Pipeline() { - this.logger.info("Hazelcast Logger"); + Uc1PipelineTest.logger.info("Hazelcast Logger"); LOGGER.info("Standard Logger"); @@ -67,9 +66,9 @@ public class Uc1PipelineTest extends JetTestSupport { // Create mock jet instance with configuration final String testClusterName = randomName(); final JetConfig testJetConfig = new JetConfig(); -// testJetConfig.setProperty( "hazelcast.logging.type", "slf4j" ); + // testJetConfig.setProperty( "hazelcast.logging.type", "slf4j" ); testJetConfig.getHazelcastConfig().setClusterName(testClusterName); - this.testInstance = createJetMember(testJetConfig); + this.testInstance = this.createJetMember(testJetConfig); // Create a test source @@ -92,17 +91,17 @@ public class Uc1PipelineTest extends JetTestSupport { final DatabaseWriter<String> adapter = this.databaseAdapter.getDatabaseWriter(); final Sink<String> sink = sinkBuilder( "database-sink", x -> adapter) - .<String>receiveFn(DatabaseWriter::write) - .build(); + .<String>receiveFn(DatabaseWriter::write) + .build(); -// Map Stage, can be used instead of sink -// StreamStage<String> log = uc1Topology.map(s -> { -// LOGGER.info(s); -// return s; -// }); -// log.writeTo(sink); + // Map Stage, can be used instead of sink + // StreamStage<String> log = uc1Topology.map(s -> { + // LOGGER.info(s); + // return s; + // }); + // log.writeTo(sink); - //apply sink + // apply sink this.uc1Topology.writeTo(sink); } @@ -121,8 +120,8 @@ public class Uc1PipelineTest extends JetTestSupport { // Assertion this.uc1Topology.apply(Assertions.assertCollectedEventually(assertTimeoutSeconds, collection -> { - //print the newest Record -// LOGGER.info(collection.get(collection.size()-1)); + // print the newest Record + // LOGGER.info(collection.get(collection.size()-1)); // Run pipeline until 5th item Assert.assertTrue("Not enough data arrived in the end", diff --git a/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/HistoryService.java b/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/HistoryService.java index 0a2a1bec7c3515f903905efeb07e717a46e329ea..dd792ac8a814514338d6fb27b4f67f4b6f033105 100644 --- a/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/HistoryService.java +++ b/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/HistoryService.java @@ -3,7 +3,7 @@ package rocks.theodolite.benchmarks.uc1.kstreams; import java.util.concurrent.CompletableFuture; import org.apache.commons.configuration2.Configuration; import org.apache.kafka.streams.KafkaStreams; -import titan.ccp.common.configuration.ServiceConfigurations; +import rocks.theodolite.benchmarks.commons.commons.configuration.ServiceConfigurations; /** * A microservice that manages the history and, therefore, stores and aggregates incoming diff --git a/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/TopologyBuilder.java b/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/TopologyBuilder.java index 944e449c4693dc7c234844c97567d7f9f048cf3b..efbf774066773cd6a17d830cf07b629231fe06ef 100644 --- a/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/TopologyBuilder.java +++ b/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/TopologyBuilder.java @@ -5,10 +5,10 @@ import org.apache.kafka.common.serialization.Serdes; import org.apache.kafka.streams.StreamsBuilder; import org.apache.kafka.streams.Topology; import org.apache.kafka.streams.kstream.Consumed; +import rocks.theodolite.benchmarks.commons.kafka.avro.SchemaRegistryAvroSerdeFactory; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc1.commons.DatabaseAdapter; import rocks.theodolite.benchmarks.uc1.commons.logger.LogWriterFactory; -import titan.ccp.common.kafka.avro.SchemaRegistryAvroSerdeFactory; -import titan.ccp.model.records.ActivePowerRecord; /** * Builds Kafka Stream Topology for the History microservice. diff --git a/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/Uc1KafkaStreamsBuilder.java b/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/Uc1KafkaStreamsBuilder.java index a1e9c4d78d0f340273fb3db944ba96913c8d0b13..05d6a5845a9eb79998d7c4fc1940357559d0936d 100644 --- a/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/Uc1KafkaStreamsBuilder.java +++ b/theodolite-benchmarks/uc1-kstreams/src/main/java/rocks/theodolite/benchmarks/uc1/kstreams/Uc1KafkaStreamsBuilder.java @@ -4,8 +4,8 @@ import java.util.Objects; import java.util.Properties; import org.apache.commons.configuration2.Configuration; import org.apache.kafka.streams.Topology; +import rocks.theodolite.benchmarks.commons.kafka.avro.SchemaRegistryAvroSerdeFactory; import rocks.theodolite.benchmarks.commons.kstreams.KafkaStreamsBuilder; -import titan.ccp.common.kafka.avro.SchemaRegistryAvroSerdeFactory; /** * Builder for the Kafka Streams configuration. diff --git a/theodolite-benchmarks/uc2-beam/src/main/java/rocks/theodolite/benchmarks/uc2/beam/PipelineFactory.java b/theodolite-benchmarks/uc2-beam/src/main/java/rocks/theodolite/benchmarks/uc2/beam/PipelineFactory.java index 375b2a6cba5256e0644b6beaf26d41e010089250..decbcae1c4b524f9f39295ecd49275a3c1b09951 100644 --- a/theodolite-benchmarks/uc2-beam/src/main/java/rocks/theodolite/benchmarks/uc2/beam/PipelineFactory.java +++ b/theodolite-benchmarks/uc2-beam/src/main/java/rocks/theodolite/benchmarks/uc2/beam/PipelineFactory.java @@ -22,7 +22,7 @@ import rocks.theodolite.benchmarks.commons.beam.AbstractPipelineFactory; import rocks.theodolite.benchmarks.commons.beam.ConfigurationKeys; import rocks.theodolite.benchmarks.commons.beam.kafka.KafkaActivePowerTimestampReader; import rocks.theodolite.benchmarks.commons.beam.kafka.KafkaWriterTransformation; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * {@link AbstractPipelineFactory} for UC2. diff --git a/theodolite-benchmarks/uc2-beam/src/main/java/rocks/theodolite/benchmarks/uc2/beam/StatsAggregation.java b/theodolite-benchmarks/uc2-beam/src/main/java/rocks/theodolite/benchmarks/uc2/beam/StatsAggregation.java index a8956ee4b55c1e545e2c25ce38e2911b7c961337..cf320bf18b37f25b787c1baea1109892f2aa83fa 100644 --- a/theodolite-benchmarks/uc2-beam/src/main/java/rocks/theodolite/benchmarks/uc2/beam/StatsAggregation.java +++ b/theodolite-benchmarks/uc2-beam/src/main/java/rocks/theodolite/benchmarks/uc2/beam/StatsAggregation.java @@ -6,7 +6,7 @@ import java.io.Serializable; import org.apache.beam.sdk.coders.AvroCoder; import org.apache.beam.sdk.coders.DefaultCoder; import org.apache.beam.sdk.transforms.Combine.CombineFn; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Aggregation Class for ActivePowerRecords. Creates a StatsAccumulator based on the ValueInW. diff --git a/theodolite-benchmarks/uc2-flink/src/main/java/rocks/theodolite/benchmarks/uc2/flink/HistoryServiceFlinkJob.java b/theodolite-benchmarks/uc2-flink/src/main/java/rocks/theodolite/benchmarks/uc2/flink/HistoryServiceFlinkJob.java index 7e67be897ce06f9f12e3fbcefb61d44a0775eea5..30d6081534b04be6e33af96d42f5c783111e1e3e 100644 --- a/theodolite-benchmarks/uc2-flink/src/main/java/rocks/theodolite/benchmarks/uc2/flink/HistoryServiceFlinkJob.java +++ b/theodolite-benchmarks/uc2-flink/src/main/java/rocks/theodolite/benchmarks/uc2/flink/HistoryServiceFlinkJob.java @@ -13,11 +13,11 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer; import org.apache.kafka.common.serialization.Serdes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import rocks.theodolite.benchmarks.commons.commons.configuration.ServiceConfigurations; import rocks.theodolite.benchmarks.commons.flink.KafkaConnectorFactory; import rocks.theodolite.benchmarks.commons.flink.StateBackends; import rocks.theodolite.benchmarks.commons.flink.serialization.StatsSerializer; -import titan.ccp.common.configuration.ServiceConfigurations; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** diff --git a/theodolite-benchmarks/uc2-flink/src/main/java/rocks/theodolite/benchmarks/uc2/flink/StatsAggregateFunction.java b/theodolite-benchmarks/uc2-flink/src/main/java/rocks/theodolite/benchmarks/uc2/flink/StatsAggregateFunction.java index b2a9e5f538c9e92ba777dbcd61caaa3199ebb383..ca5c9b2aee2285f5e8415d853fd9fe09f2d51b49 100644 --- a/theodolite-benchmarks/uc2-flink/src/main/java/rocks/theodolite/benchmarks/uc2/flink/StatsAggregateFunction.java +++ b/theodolite-benchmarks/uc2-flink/src/main/java/rocks/theodolite/benchmarks/uc2/flink/StatsAggregateFunction.java @@ -3,8 +3,8 @@ package rocks.theodolite.benchmarks.uc2.flink; import com.google.common.math.Stats; import com.google.common.math.StatsAccumulator; import org.apache.flink.api.common.functions.AggregateFunction; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc2.flink.util.StatsFactory; -import titan.ccp.model.records.ActivePowerRecord; /** * Statistical aggregation of {@link ActivePowerRecord}s using {@link Stats}. diff --git a/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/HistoryService.java b/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/HistoryService.java index f382978b714fdfdff6c190339c2ed23a2e037069..7737959bde97ce8332c87fc88b0aa9fd90bf8250 100644 --- a/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/HistoryService.java +++ b/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/HistoryService.java @@ -57,8 +57,8 @@ public class HistoryService { */ private void createHazelcastJetApplication() throws Exception { // NOPMD new Uc2HazelcastJetFactory() - .setReadPropertiesFromEnv(KAFKA_BOOTSTRAP_DEFAULT, SCHEMA_REGISTRY_URL_DEFAULT,JOB_NAME) - .setWritePropertiesFromEnv(KAFKA_BOOTSTRAP_DEFAULT,SCHEMA_REGISTRY_URL_DEFAULT) + .setReadPropertiesFromEnv(KAFKA_BOOTSTRAP_DEFAULT, SCHEMA_REGISTRY_URL_DEFAULT, JOB_NAME) + .setWritePropertiesFromEnv(KAFKA_BOOTSTRAP_DEFAULT, SCHEMA_REGISTRY_URL_DEFAULT) .setKafkaInputTopicFromEnv(KAFKA_INPUT_TOPIC_DEFAULT) .setKafkaOutputTopicFromEnv(KAFKA_OUTPUT_TOPIC_DEFAULT) .setDownsampleIntervalFromEnv(DOWNSAMPLE_INTERVAL_DEFAULT_MS) diff --git a/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2HazelcastJetFactory.java b/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2HazelcastJetFactory.java index 143b154f3726e75d2842766b49bd2e26f57ce39b..92029a78405deacae5e7ad352b184eb852cd842e 100644 --- a/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2HazelcastJetFactory.java +++ b/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2HazelcastJetFactory.java @@ -180,9 +180,9 @@ public class Uc2HazelcastJetFactory { * @return The Uc2HazelcastJetBuilder factory with set kafkaReadPropertiesForPipeline. */ public Uc2HazelcastJetFactory setReadPropertiesFromEnv(// NOPMD - final String bootstrapServersDefault, - final String schemaRegistryUrlDefault, - final String jobName) { + final String bootstrapServersDefault, + final String schemaRegistryUrlDefault, + final String jobName) { // Use KafkaPropertiesBuilder to build a properties object used for kafka final KafkaPropertiesBuilder propsBuilder = new KafkaPropertiesBuilder(); final Properties kafkaReadProps = diff --git a/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2PipelineBuilder.java b/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2PipelineBuilder.java index 73377de6122d4a723c5dbbcb8198fa814c4bed1e..92e59d256c5f2d5b43644b2e498ca1f2dbca4202 100644 --- a/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2PipelineBuilder.java +++ b/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2PipelineBuilder.java @@ -14,8 +14,10 @@ import com.hazelcast.jet.pipeline.WindowDefinition; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc2.hazelcastjet.uc2specifics.StatsAccumulatorSupplier; -import titan.ccp.model.records.ActivePowerRecord; + + /** * Builder to build a HazelcastJet Pipeline for UC2 which can be used for stream processing using @@ -108,8 +110,7 @@ public class Uc2PipelineBuilder { * @return An AggregateOperation used by Hazelcast Jet in a streaming stage which aggregates * ActivePowerRecord Objects into Stats Objects. */ - public AggregateOperation1<Entry<String, ActivePowerRecord>, - StatsAccumulator, Stats> uc2AggregateOperation() { + public AggregateOperation1<Entry<String, ActivePowerRecord>, StatsAccumulator, Stats> uc2AggregateOperation() { // NOCS // Aggregate Operation to Create a Stats Object from Entry<String,ActivePowerRecord> items using // the Statsaccumulator. return AggregateOperation @@ -129,7 +130,7 @@ public class Uc2PipelineBuilder { .andExportFinish( (accumulator) -> { return accumulator.snapshot(); - }); + }); } } diff --git a/theodolite-benchmarks/uc2-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2PipelineTest.java b/theodolite-benchmarks/uc2-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2PipelineTest.java index ff72b9558f43334feb8846d50bef2c6714d9404a..0a579c8d4ad2c872f7c90b1d6456de78b3a20f91 100644 --- a/theodolite-benchmarks/uc2-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2PipelineTest.java +++ b/theodolite-benchmarks/uc2-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/Uc2PipelineTest.java @@ -19,7 +19,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Test methods for the Hazelcast Jet Implementation of UC2. @@ -39,10 +39,10 @@ public class Uc2PipelineTest extends JetTestSupport { public void buildUc2Pipeline() { // Setup Configuration - int testItemsPerSecond = 1; - String testSensorName = "TEST-SENSOR"; - Double testValueInW = 10.0; - int testWindowInMs = 5000; + final int testItemsPerSecond = 1; + final String testSensorName = "TEST-SENSOR"; + final Double testValueInW = 10.0; + final int testWindowInMs = 5000; // Create mock jet instance with configuration final String testClusterName = randomName(); @@ -61,7 +61,7 @@ public class Uc2PipelineTest extends JetTestSupport { }); // Create pipeline to test - Uc2PipelineBuilder pipelineBuilder = new Uc2PipelineBuilder(); + final Uc2PipelineBuilder pipelineBuilder = new Uc2PipelineBuilder(); this.testPipeline = Pipeline.create(); this.uc2Topology = pipelineBuilder.extendUc2Topology(this.testPipeline, testSource, testWindowInMs); @@ -75,14 +75,15 @@ public class Uc2PipelineTest extends JetTestSupport { public void testOutput() { // Assertion Configuration - int timeout = 14; - String expectedOutput = "Stats{count=5, mean=10.0, populationStandardDeviation=0.0, min=10.0, max=10.0}"; + final int timeout = 14; + final String expectedOutput = + "Stats{count=5, mean=10.0, populationStandardDeviation=0.0, min=10.0, max=10.0}"; // Assertion this.uc2Topology.apply(Assertions.assertCollectedEventually(timeout, collection -> Assert.assertTrue( "Not the right amount items in Stats Object!", - collection.get(collection.size()-1).getValue().equals(expectedOutput)))); + collection.get(collection.size() - 1).getValue().equals(expectedOutput)))); // Run the test! try { diff --git a/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/HistoryService.java b/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/HistoryService.java index 3b87053507a7739381482719acf317903fe2d361..4afc2d91eaaf98226f262f072cfd7e5aed6f847e 100644 --- a/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/HistoryService.java +++ b/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/HistoryService.java @@ -5,8 +5,8 @@ import java.util.Objects; import java.util.concurrent.CompletableFuture; import org.apache.commons.configuration2.Configuration; import org.apache.kafka.streams.KafkaStreams; +import rocks.theodolite.benchmarks.commons.commons.configuration.ServiceConfigurations; import rocks.theodolite.benchmarks.commons.kstreams.ConfigurationKeys; -import titan.ccp.common.configuration.ServiceConfigurations; /** * A microservice that manages the history and, therefore, stores and aggregates incoming diff --git a/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/TopologyBuilder.java b/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/TopologyBuilder.java index ae17c83bc141ef6056d7f9f89738d1442ba4afed..cd1d8cd92149d368a27452fa7689f5549a9c2bc7 100644 --- a/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/TopologyBuilder.java +++ b/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/TopologyBuilder.java @@ -13,10 +13,10 @@ import org.apache.kafka.streams.kstream.Produced; import org.apache.kafka.streams.kstream.TimeWindows; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import rocks.theodolite.benchmarks.commons.kafka.avro.SchemaRegistryAvroSerdeFactory; +import rocks.theodolite.benchmarks.commons.kstreams.GenericSerde; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc2.kstreams.util.StatsFactory; -import titan.ccp.common.kafka.GenericSerde; -import titan.ccp.common.kafka.avro.SchemaRegistryAvroSerdeFactory; -import titan.ccp.model.records.ActivePowerRecord; /** * Builds Kafka Stream Topology for the History microservice. diff --git a/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/Uc2KafkaStreamsBuilder.java b/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/Uc2KafkaStreamsBuilder.java index 9db55ef921e44ac6ebb8b31ca58c13862c33ddcb..d9d4a23ec512ce4f7799648a4ea4f629e7b369ad 100644 --- a/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/Uc2KafkaStreamsBuilder.java +++ b/theodolite-benchmarks/uc2-kstreams/src/main/java/rocks/theodolite/benchmarks/uc2/kstreams/Uc2KafkaStreamsBuilder.java @@ -5,8 +5,8 @@ import java.util.Objects; import java.util.Properties; import org.apache.commons.configuration2.Configuration; import org.apache.kafka.streams.Topology; +import rocks.theodolite.benchmarks.commons.kafka.avro.SchemaRegistryAvroSerdeFactory; import rocks.theodolite.benchmarks.commons.kstreams.KafkaStreamsBuilder; -import titan.ccp.common.kafka.avro.SchemaRegistryAvroSerdeFactory; /** * Builder for the Kafka Streams configuration. diff --git a/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/HourOfDayKeySerde.java b/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/HourOfDayKeySerde.java index 1c09d7d508888b48c2a509d83f55ff49ca967f17..8bc32ccc2146f6467f6fcf374f95e8b87c2c351c 100644 --- a/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/HourOfDayKeySerde.java +++ b/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/HourOfDayKeySerde.java @@ -1,10 +1,10 @@ package rocks.theodolite.benchmarks.uc3.beam; import org.apache.kafka.common.serialization.Serde; -import titan.ccp.common.kafka.simpleserdes.BufferSerde; -import titan.ccp.common.kafka.simpleserdes.ReadBuffer; -import titan.ccp.common.kafka.simpleserdes.SimpleSerdes; -import titan.ccp.common.kafka.simpleserdes.WriteBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.BufferSerde; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.ReadBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.SimpleSerdes; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.WriteBuffer; /** * {@link BufferSerde} for a {@link HourOfDayKey}. Use the {@link #create()} method to create a new diff --git a/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/MapTimeFormat.java b/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/MapTimeFormat.java index 3c0d7acdbeccfaf03aac70df478e3db6dd1378e4..0cad038141bd7b30d765520403529e9184bbcb86 100644 --- a/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/MapTimeFormat.java +++ b/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/MapTimeFormat.java @@ -5,7 +5,7 @@ import java.time.LocalDateTime; import java.time.ZoneId; import org.apache.beam.sdk.transforms.SimpleFunction; import org.apache.beam.sdk.values.KV; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Changes the time format to us Europe/Paris time. diff --git a/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/PipelineFactory.java b/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/PipelineFactory.java index 9c766e41254555647dd7ef1eed0417613b7c1629..f6587be4c4660a2e34f34efdaa417a7080073d0e 100644 --- a/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/PipelineFactory.java +++ b/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/PipelineFactory.java @@ -23,7 +23,7 @@ import rocks.theodolite.benchmarks.commons.beam.AbstractPipelineFactory; import rocks.theodolite.benchmarks.commons.beam.ConfigurationKeys; import rocks.theodolite.benchmarks.commons.beam.kafka.KafkaActivePowerTimestampReader; import rocks.theodolite.benchmarks.commons.beam.kafka.KafkaWriterTransformation; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * {@link AbstractPipelineFactory} for UC3. diff --git a/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/StatsAggregation.java b/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/StatsAggregation.java index e479c0ab5e192f7e5239c100a05df454bd2973ad..4fca536baf6db33e57700263cefb837ca8eb5b8b 100644 --- a/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/StatsAggregation.java +++ b/theodolite-benchmarks/uc3-beam/src/main/java/rocks/theodolite/benchmarks/uc3/beam/StatsAggregation.java @@ -6,7 +6,7 @@ import java.io.Serializable; import org.apache.beam.sdk.coders.AvroCoder; import org.apache.beam.sdk.coders.DefaultCoder; import org.apache.beam.sdk.transforms.Combine.CombineFn; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** diff --git a/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/HistoryServiceFlinkJob.java b/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/HistoryServiceFlinkJob.java index 4cf7ed080882e42bf488a8e6490c3eab463882b4..4554d505c7a8c90dbf7fbc075d5877b1fa49412b 100644 --- a/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/HistoryServiceFlinkJob.java +++ b/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/HistoryServiceFlinkJob.java @@ -17,15 +17,15 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer; import org.apache.kafka.common.serialization.Serdes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import rocks.theodolite.benchmarks.commons.commons.configuration.ServiceConfigurations; import rocks.theodolite.benchmarks.commons.flink.KafkaConnectorFactory; import rocks.theodolite.benchmarks.commons.flink.StateBackends; import rocks.theodolite.benchmarks.commons.flink.serialization.StatsSerializer; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc3.flink.util.HourOfDayKey; import rocks.theodolite.benchmarks.uc3.flink.util.HourOfDayKeyFactory; import rocks.theodolite.benchmarks.uc3.flink.util.HourOfDayKeySerde; import rocks.theodolite.benchmarks.uc3.flink.util.StatsKeyFactory; -import titan.ccp.common.configuration.ServiceConfigurations; -import titan.ccp.model.records.ActivePowerRecord; /** * The History microservice implemented as a Flink job. diff --git a/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/StatsAggregateFunction.java b/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/StatsAggregateFunction.java index 38d277dac28e88c82a38a1b56ef15cab2c00db14..83951a4228fe0b73a4330bfae5177f508b9c1b0e 100644 --- a/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/StatsAggregateFunction.java +++ b/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/StatsAggregateFunction.java @@ -3,8 +3,8 @@ package rocks.theodolite.benchmarks.uc3.flink; import com.google.common.math.Stats; import com.google.common.math.StatsAccumulator; import org.apache.flink.api.common.functions.AggregateFunction; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc3.flink.util.StatsFactory; -import titan.ccp.model.records.ActivePowerRecord; /** * Statistical aggregation of {@link ActivePowerRecord}s using {@link Stats}. diff --git a/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/util/HourOfDayKeySerde.java b/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/util/HourOfDayKeySerde.java index 2c5bd40fe29f683693fb57bc679dd288e7d3bfb9..5b08fcad2ff744e3d0e14e51d35fad88d2900470 100644 --- a/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/util/HourOfDayKeySerde.java +++ b/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/util/HourOfDayKeySerde.java @@ -6,10 +6,10 @@ import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Output; import java.io.Serializable; import org.apache.kafka.common.serialization.Serde; -import titan.ccp.common.kafka.simpleserdes.BufferSerde; -import titan.ccp.common.kafka.simpleserdes.ReadBuffer; -import titan.ccp.common.kafka.simpleserdes.SimpleSerdes; -import titan.ccp.common.kafka.simpleserdes.WriteBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.BufferSerde; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.ReadBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.SimpleSerdes; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.WriteBuffer; /** * {@link BufferSerde} for a {@link HourOfDayKey}. Use the {@link #create()} method to create a new diff --git a/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/util/HourOfDayRecordFactory.java b/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/util/HourOfDayRecordFactory.java index 5c52a446eac7f7ba39dfe12c247744054fd735d5..420179a0825d5b897f6927040eb57c43d27837ef 100644 --- a/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/util/HourOfDayRecordFactory.java +++ b/theodolite-benchmarks/uc3-flink/src/main/java/rocks/theodolite/benchmarks/uc3/flink/util/HourOfDayRecordFactory.java @@ -2,7 +2,7 @@ package rocks.theodolite.benchmarks.uc3.flink.util; import com.google.common.math.Stats; import org.apache.kafka.streams.kstream.Windowed; -import titan.ccp.model.records.HourOfDayActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord; /** * {@link StatsRecordFactory} to create an {@link HourOfDayActivePowerRecord}. diff --git a/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3HazelcastJetFactory.java b/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3HazelcastJetFactory.java index be6d70d27b9a868914ec5d28e84b4a90454ab56c..d87aa19d316b278160dbc92b19b9be3d40a41d61 100644 --- a/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3HazelcastJetFactory.java +++ b/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3HazelcastJetFactory.java @@ -192,9 +192,9 @@ public class Uc3HazelcastJetFactory { // NOPMD * @return The Uc3HazelcastJetBuilder factory with set kafkaReadPropertiesForPipeline. */ public Uc3HazelcastJetFactory setReadPropertiesFromEnv(// NOPMD - final String bootstrapServersDefault, - final String schemaRegistryUrlDefault, - final String jobName) { + final String bootstrapServersDefault, + final String schemaRegistryUrlDefault, + final String jobName) { // Use KafkaPropertiesBuilder to build a properties object used for kafka final KafkaPropertiesBuilder propsBuilder = new KafkaPropertiesBuilder(); final Properties kafkaReadProps = diff --git a/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3PipelineBuilder.java b/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3PipelineBuilder.java index c8427de60742c2923d4ec17703592f5b8310de0c..e651d44fd2d099ae41296cc08487c787501d9b46 100644 --- a/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3PipelineBuilder.java +++ b/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3PipelineBuilder.java @@ -15,10 +15,10 @@ import java.util.Map.Entry; import java.util.Properties; import java.util.TimeZone; import java.util.concurrent.TimeUnit; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc3.hazelcastjet.uc3specifics.HourOfDayKey; import rocks.theodolite.benchmarks.uc3.hazelcastjet.uc3specifics.HoursOfDayKeyFactory; import rocks.theodolite.benchmarks.uc3.hazelcastjet.uc3specifics.StatsKeyFactory; -import titan.ccp.model.records.ActivePowerRecord; /** * Builder to build a HazelcastJet Pipeline for UC3 which can be used for stream processing using diff --git a/theodolite-benchmarks/uc3-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3PipelineTest.java b/theodolite-benchmarks/uc3-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3PipelineTest.java index 3df4f4642f1bc6c8637f90bcae3f352f5c298e51..969ff27d1154a0bd52cb3a048eca2f12ca901138 100644 --- a/theodolite-benchmarks/uc3-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3PipelineTest.java +++ b/theodolite-benchmarks/uc3-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/Uc3PipelineTest.java @@ -14,20 +14,18 @@ import com.hazelcast.jet.pipeline.test.TestSources; import com.hazelcast.jet.test.SerialTest; import java.time.Instant; import java.time.LocalDateTime; -import java.util.ArrayList; import java.util.Map; -import java.util.TimeZone; import java.util.Map.Entry; +import java.util.TimeZone; import java.util.concurrent.CompletionException; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; -import rocks.theodolite.benchmarks.uc3.hazelcastjet.Uc3PipelineBuilder; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc3.hazelcastjet.uc3specifics.HourOfDayKey; import rocks.theodolite.benchmarks.uc3.hazelcastjet.uc3specifics.HourOfDayKeySerializer; -import titan.ccp.model.records.ActivePowerRecord; /** * Test methods for the Hazelcast Jet Implementation of UC3. @@ -49,13 +47,13 @@ public class Uc3PipelineTest extends JetTestSupport { public void buildUc3Pipeline() { // Setup Configuration - int testItemsPerSecond = 1; - String testSensorName = "TEST-SENSOR"; - Double testValueInW = 10.0; - int testHopSizeInSec = 1; - int testWindowSizeInSec = 50; + final int testItemsPerSecond = 1; + final String testSensorName = "TEST-SENSOR"; + final Double testValueInW = 10.0; + final int testHopSizeInSec = 1; + final int testWindowSizeInSec = 50; // Used to check hourOfDay - long mockTimestamp = 1632741651; + final long mockTimestamp = 1632741651; // Create mock jet instance with configuration @@ -75,9 +73,9 @@ public class Uc3PipelineTest extends JetTestSupport { }); // Create pipeline to test - Uc3PipelineBuilder pipelineBuilder = new Uc3PipelineBuilder(); + final Uc3PipelineBuilder pipelineBuilder = new Uc3PipelineBuilder(); this.testPipeline = Pipeline.create(); - this.uc3Topology = pipelineBuilder.extendUc3Topology(testPipeline, testSource, + this.uc3Topology = pipelineBuilder.extendUc3Topology(this.testPipeline, testSource, testHopSizeInSec, testWindowSizeInSec); } @@ -88,11 +86,11 @@ public class Uc3PipelineTest extends JetTestSupport { public void testOutput() { // Assertion Configuration - int timeout = 10; - String testSensorName = "TEST-SENSOR"; - Double testValueInW = 10.0; + final int timeout = 10; + final String testSensorName = "TEST-SENSOR"; + final Double testValueInW = 10.0; // Used to check hourOfDay - long mockTimestamp = 1632741651; + final long mockTimestamp = 1632741651; // Assertion this.uc3Topology.apply(Assertions.assertCollectedEventually(timeout, @@ -105,17 +103,15 @@ public class Uc3PipelineTest extends JetTestSupport { boolean allOkay = true; if (collection != null) { System.out.println("DEBUG: CHECK 2 || Collection Size: " + collection.size()); - for (int i = 0; i < collection.size(); i++) { + for (final Entry<String, String> currentEntry : collection) { // Build hour of day - long timestamp = mockTimestamp; - int expectedHour = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), + final long timestamp = mockTimestamp; + final int expectedHour = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), TimeZone.getDefault().toZoneId()).getHour(); - // Compare expected output with generated output - Entry<String, String> currentEntry = collection.get(i); - String expectedKey = testSensorName + ";" + expectedHour; - String expectedValue = testValueInW.toString(); + final String expectedKey = testSensorName + ";" + expectedHour; + final String expectedValue = testValueInW.toString(); // DEBUG System.out.println( diff --git a/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HistoryService.java b/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HistoryService.java index a327d2ecfa4c0727e7a29a69e7ab8910afdfd3d2..8776fcda3092d8282f6ab85f69c734bf834a2bcc 100644 --- a/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HistoryService.java +++ b/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HistoryService.java @@ -4,8 +4,8 @@ import java.time.Duration; import java.util.concurrent.CompletableFuture; import org.apache.commons.configuration2.Configuration; import org.apache.kafka.streams.KafkaStreams; +import rocks.theodolite.benchmarks.commons.commons.configuration.ServiceConfigurations; import rocks.theodolite.benchmarks.commons.kstreams.ConfigurationKeys; -import titan.ccp.common.configuration.ServiceConfigurations; /** * A microservice that manages the history and, therefore, stores and aggregates incoming diff --git a/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HourOfDayKeySerde.java b/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HourOfDayKeySerde.java index 4014e5e30dee36a737ab582e527fc8fb4b8a32a9..e2a3b03e1e51df2756299b66d24e89d9cf0403b9 100644 --- a/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HourOfDayKeySerde.java +++ b/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HourOfDayKeySerde.java @@ -1,10 +1,10 @@ package rocks.theodolite.benchmarks.uc3.kstreams; import org.apache.kafka.common.serialization.Serde; -import titan.ccp.common.kafka.simpleserdes.BufferSerde; -import titan.ccp.common.kafka.simpleserdes.ReadBuffer; -import titan.ccp.common.kafka.simpleserdes.SimpleSerdes; -import titan.ccp.common.kafka.simpleserdes.WriteBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.BufferSerde; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.ReadBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.SimpleSerdes; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.WriteBuffer; /** * {@link BufferSerde} for a {@link HourOfDayKey}. Use the {@link #create()} method to create a new diff --git a/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HourOfDayRecordFactory.java b/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HourOfDayRecordFactory.java index 3d67a6ebe86eb33378fe0711b6b8ca1ab1f5c6a9..4d2e2d5b5014dda3604085972fdcf56e8f8aa011 100644 --- a/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HourOfDayRecordFactory.java +++ b/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/HourOfDayRecordFactory.java @@ -2,7 +2,7 @@ package rocks.theodolite.benchmarks.uc3.kstreams; import com.google.common.math.Stats; import org.apache.kafka.streams.kstream.Windowed; -import titan.ccp.model.records.HourOfDayActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.HourOfDayActivePowerRecord; /** * {@link StatsRecordFactory} to create an {@link HourOfDayActivePowerRecord}. diff --git a/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/TopologyBuilder.java b/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/TopologyBuilder.java index b956959c5680c3c23eb35c0548004bb55de09a20..f2825ca81f69b5a70e883dcf034c51093745221d 100644 --- a/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/TopologyBuilder.java +++ b/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/TopologyBuilder.java @@ -16,10 +16,10 @@ import org.apache.kafka.streams.kstream.Grouped; import org.apache.kafka.streams.kstream.Materialized; import org.apache.kafka.streams.kstream.Produced; import org.apache.kafka.streams.kstream.TimeWindows; +import rocks.theodolite.benchmarks.commons.kafka.avro.SchemaRegistryAvroSerdeFactory; +import rocks.theodolite.benchmarks.commons.kstreams.GenericSerde; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc3.kstreams.util.StatsFactory; -import titan.ccp.common.kafka.GenericSerde; -import titan.ccp.common.kafka.avro.SchemaRegistryAvroSerdeFactory; -import titan.ccp.model.records.ActivePowerRecord; /** * Builds Kafka Stream Topology for the History microservice. diff --git a/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/Uc3KafkaStreamsBuilder.java b/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/Uc3KafkaStreamsBuilder.java index 3c80e5eedef0c9dda8ac3c729f158d0872b5769b..e05b30f75a3a1e01f132e56595e50297160c5c66 100644 --- a/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/Uc3KafkaStreamsBuilder.java +++ b/theodolite-benchmarks/uc3-kstreams/src/main/java/rocks/theodolite/benchmarks/uc3/kstreams/Uc3KafkaStreamsBuilder.java @@ -5,8 +5,8 @@ import java.util.Objects; import java.util.Properties; import org.apache.commons.configuration2.Configuration; import org.apache.kafka.streams.Topology; +import rocks.theodolite.benchmarks.commons.kafka.avro.SchemaRegistryAvroSerdeFactory; import rocks.theodolite.benchmarks.commons.kstreams.KafkaStreamsBuilder; -import titan.ccp.common.kafka.avro.SchemaRegistryAvroSerdeFactory; /** * Builder for the Kafka Streams configuration. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/AggregatedActivePowerRecordEventTimePolicy.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/AggregatedActivePowerRecordEventTimePolicy.java index 3af4957aa210a5f6a184bf4b513202dd4087567f..1a2f99cd82a9f8b4af7b3b5a13ad8610036cbc72 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/AggregatedActivePowerRecordEventTimePolicy.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/AggregatedActivePowerRecordEventTimePolicy.java @@ -5,7 +5,7 @@ import org.apache.beam.sdk.io.kafka.KafkaRecord; import org.apache.beam.sdk.io.kafka.TimestampPolicy; import org.apache.beam.sdk.transforms.windowing.BoundedWindow; import org.joda.time.Instant; -import titan.ccp.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; /** * TimeStampPolicy to use event time based on the timestamp of the record value. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/AggregatedToActive.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/AggregatedToActive.java index 63f914dca0e6536d52ce225e791d2e3b89107394..4d1c2241eefa8706c29d08256304ecec8313e478 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/AggregatedToActive.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/AggregatedToActive.java @@ -2,8 +2,8 @@ package rocks.theodolite.benchmarks.uc4.beam; import org.apache.beam.sdk.transforms.SimpleFunction; import org.apache.beam.sdk.values.KV; -import titan.ccp.model.records.ActivePowerRecord; -import titan.ccp.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; /** * Converts AggregatedActivePowerRecord to ActivePowerRecord. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/DuplicateAsFlatMap.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/DuplicateAsFlatMap.java index 1b430c99bb127f0746772571443f625ae69be54d..1c4071f4a3bbe78683c9e4854f62d428fc8a07ad 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/DuplicateAsFlatMap.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/DuplicateAsFlatMap.java @@ -10,7 +10,7 @@ import org.apache.beam.sdk.state.ValueState; import org.apache.beam.sdk.transforms.DoFn; import org.apache.beam.sdk.values.KV; import org.apache.beam.sdk.values.PCollectionView; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/FilterEvents.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/FilterEvents.java index 6a96d7270640c1cfa3a162e0d506792d577103c5..59818e18b7e86c53b80b2a6230087957870d2f47 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/FilterEvents.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/FilterEvents.java @@ -2,7 +2,7 @@ package rocks.theodolite.benchmarks.uc4.beam; import org.apache.beam.sdk.transforms.SerializableFunction; import org.apache.beam.sdk.values.KV; -import titan.ccp.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; /** * Filters for {@code Event.SENSOR_REGISTRY_CHANGED} and {@code Event.SENSOR_REGISTRY_STATUS} diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/FilterNullValues.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/FilterNullValues.java index 9aa48d7b8f6fdc64aad205821ec4db25f606156b..903204363ace1f19439c3686dfd278fc89da2be9 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/FilterNullValues.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/FilterNullValues.java @@ -2,7 +2,7 @@ package rocks.theodolite.benchmarks.uc4.beam; import org.apache.beam.sdk.transforms.SerializableFunction; import org.apache.beam.sdk.values.KV; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Filters {@code null} Values. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/GenerateParentsFn.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/GenerateParentsFn.java index e6f01c3d59c5c92f5d0c51ac807a76f0a37612b1..a020d32735893c4dd0851d902dcf62304223199d 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/GenerateParentsFn.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/GenerateParentsFn.java @@ -8,10 +8,10 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.beam.sdk.transforms.DoFn; import org.apache.beam.sdk.values.KV; -import titan.ccp.configuration.events.Event; -import titan.ccp.model.sensorregistry.AggregatedSensor; -import titan.ccp.model.sensorregistry.Sensor; -import titan.ccp.model.sensorregistry.SensorRegistry; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.AggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.Sensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; /** * DoFn class to generate a child-parent pair for every sensor in the hierarchy. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/PipelineFactory.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/PipelineFactory.java index 42d12d82026df0682f771b0cec5c1705ead83b2e..955f7101515c9467edc2e4900aa5464437f0e904 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/PipelineFactory.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/PipelineFactory.java @@ -40,15 +40,15 @@ import rocks.theodolite.benchmarks.commons.beam.ConfigurationKeys; import rocks.theodolite.benchmarks.commons.beam.kafka.KafkaActivePowerTimestampReader; import rocks.theodolite.benchmarks.commons.beam.kafka.KafkaGenericReader; import rocks.theodolite.benchmarks.commons.beam.kafka.KafkaWriterTransformation; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; import rocks.theodolite.benchmarks.uc4.beam.serialization.AggregatedActivePowerRecordCoder; import rocks.theodolite.benchmarks.uc4.beam.serialization.AggregatedActivePowerRecordDeserializer; import rocks.theodolite.benchmarks.uc4.beam.serialization.AggregatedActivePowerRecordSerializer; import rocks.theodolite.benchmarks.uc4.beam.serialization.EventCoder; import rocks.theodolite.benchmarks.uc4.beam.serialization.EventDeserializer; import rocks.theodolite.benchmarks.uc4.beam.serialization.SensorParentKeyCoder; -import titan.ccp.configuration.events.Event; -import titan.ccp.model.records.ActivePowerRecord; -import titan.ccp.model.records.AggregatedActivePowerRecord; /** * {@link AbstractPipelineFactory} for UC4. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/RecordAggregation.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/RecordAggregation.java index 6fbf6ff3f3abcdfd4f5ca0de93d68c2532655b4d..e853e0b6e5a22d68f9b315799f86f1b6dfa1947a 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/RecordAggregation.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/RecordAggregation.java @@ -4,8 +4,8 @@ import java.io.Serializable; import org.apache.beam.sdk.coders.AvroCoder; import org.apache.beam.sdk.coders.DefaultCoder; import org.apache.beam.sdk.transforms.Combine.CombineFn; -import titan.ccp.model.records.ActivePowerRecord; -import titan.ccp.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/SetIdForAggregated.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/SetIdForAggregated.java index 23ebb6d0104ef3992b4e2a4763dd23e722fe30f9..a616a966733e2dd3ead7d2c126efaa7c37577ff6 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/SetIdForAggregated.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/SetIdForAggregated.java @@ -2,7 +2,7 @@ package rocks.theodolite.benchmarks.uc4.beam; import org.apache.beam.sdk.transforms.SimpleFunction; import org.apache.beam.sdk.values.KV; -import titan.ccp.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; /** * Sets the identifier for new {@link AggregatedActivePowerRecord}. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/SetKeyToGroup.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/SetKeyToGroup.java index 3ffba12823aca2da88250eb601615de1ac5177e2..8477e987cad81625d373ee7d1155eaf701a53087 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/SetKeyToGroup.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/SetKeyToGroup.java @@ -2,7 +2,7 @@ package rocks.theodolite.benchmarks.uc4.beam; import org.apache.beam.sdk.transforms.SimpleFunction; import org.apache.beam.sdk.values.KV; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Set the Key for a group of {@code ActivePowerRecords} to their Parent. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordCoder.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordCoder.java index f460d42de2042064952434f6bf044920f217138a..759b8baab70b73ad2a32c50768b7911059c68aab 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordCoder.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordCoder.java @@ -8,7 +8,7 @@ import java.util.List; import org.apache.beam.sdk.coders.AvroCoder; import org.apache.beam.sdk.coders.Coder; import org.apache.beam.sdk.coders.CoderException; -import titan.ccp.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; /** * {@link Coder} for an {@link AggregatedActivePowerRecord}. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordDeserializer.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordDeserializer.java index 2c481f8e6f68a3a0decbcb73c3751f464646b7cf..1083103f7394e88c5d59ccd97aaa0885ff6b634b 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordDeserializer.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordDeserializer.java @@ -2,7 +2,7 @@ package rocks.theodolite.benchmarks.uc4.beam.serialization; import io.confluent.kafka.streams.serdes.avro.SpecificAvroDeserializer; import org.apache.kafka.common.serialization.Deserializer; -import titan.ccp.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; /** * {@link Deserializer} for an {@link AggregatedActivePowerRecord}. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordSerializer.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordSerializer.java index 073c3d0f94c24872460ae58c6236a0c4e19e0d5d..2c742ca65d288e2ee04bfb860fb89cf7ecbb8bbf 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordSerializer.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/AggregatedActivePowerRecordSerializer.java @@ -2,7 +2,7 @@ package rocks.theodolite.benchmarks.uc4.beam.serialization; import io.confluent.kafka.streams.serdes.avro.SpecificAvroSerializer; import org.apache.kafka.common.serialization.Serializer; -import titan.ccp.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; /** * {@link Serializer} for an {@link AggregatedActivePowerRecord}. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/EventCoder.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/EventCoder.java index b96398398e61f3db0f0632f8384d11f30ccc7aca..2d555ef12db49b76fa3d8c4a9398ce562eaa6453 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/EventCoder.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/EventCoder.java @@ -10,8 +10,8 @@ import java.util.List; import org.apache.beam.sdk.coders.Coder; import org.apache.beam.sdk.coders.CoderException; import org.apache.kafka.common.serialization.Serde; -import titan.ccp.configuration.events.Event; -import titan.ccp.configuration.events.EventSerde; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.configuration.events.EventSerde; /** * Wrapper Class that encapsulates a Event Serde in a org.apache.beam.sdk.coders.Coder. diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/EventDeserializer.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/EventDeserializer.java index ae9c480e1c76949f8cfa5d27c73282e270232d0a..9399a42606d6e8e7f3f58bf4a515e5f83041a88d 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/EventDeserializer.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/EventDeserializer.java @@ -3,7 +3,7 @@ package rocks.theodolite.benchmarks.uc4.beam.serialization; import java.util.Map; import org.apache.kafka.common.serialization.ByteBufferDeserializer; import org.apache.kafka.common.serialization.Deserializer; -import titan.ccp.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; /** * Deserializer for Events(SensorRegistry changes). diff --git a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/SensorParentKeySerde.java b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/SensorParentKeySerde.java index 64242b3fd2618b154e47cc46ce2fe6f9375be209..9c8d1eff664c72fcb31e6dcfddff5f53b97ff055 100644 --- a/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/SensorParentKeySerde.java +++ b/theodolite-benchmarks/uc4-beam/src/main/java/rocks/theodolite/benchmarks/uc4/beam/serialization/SensorParentKeySerde.java @@ -1,11 +1,11 @@ package rocks.theodolite.benchmarks.uc4.beam.serialization; import org.apache.kafka.common.serialization.Serde; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.BufferSerde; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.ReadBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.SimpleSerdes; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.WriteBuffer; import rocks.theodolite.benchmarks.uc4.beam.SensorParentKey; -import titan.ccp.common.kafka.simpleserdes.BufferSerde; -import titan.ccp.common.kafka.simpleserdes.ReadBuffer; -import titan.ccp.common.kafka.simpleserdes.SimpleSerdes; -import titan.ccp.common.kafka.simpleserdes.WriteBuffer; /** * {@link Serde} factory for {@link SensorParentKey}. diff --git a/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/AggregationServiceFlinkJob.java b/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/AggregationServiceFlinkJob.java index 726a7f590aaa5be4ccb6e817076da5ede21cf272..fd6d073bb5a4f7948e06e081a94eaa027be036b5 100644 --- a/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/AggregationServiceFlinkJob.java +++ b/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/AggregationServiceFlinkJob.java @@ -19,21 +19,21 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer; import org.apache.kafka.common.serialization.Serdes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import rocks.theodolite.benchmarks.commons.commons.configuration.ServiceConfigurations; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.configuration.events.EventSerde; import rocks.theodolite.benchmarks.commons.flink.KafkaConnectorFactory; import rocks.theodolite.benchmarks.commons.flink.StateBackends; import rocks.theodolite.benchmarks.commons.flink.TupleType; +import rocks.theodolite.benchmarks.commons.kafka.avro.SchemaRegistryAvroSerdeFactory; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.ImmutableSensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; import rocks.theodolite.benchmarks.uc4.flink.util.ImmutableSensorRegistrySerializer; import rocks.theodolite.benchmarks.uc4.flink.util.ImmutableSetSerializer; import rocks.theodolite.benchmarks.uc4.flink.util.SensorParentKey; import rocks.theodolite.benchmarks.uc4.flink.util.SensorParentKeySerializer; -import titan.ccp.common.configuration.ServiceConfigurations; -import titan.ccp.common.kafka.avro.SchemaRegistryAvroSerdeFactory; -import titan.ccp.configuration.events.Event; -import titan.ccp.configuration.events.EventSerde; -import titan.ccp.model.records.ActivePowerRecord; -import titan.ccp.model.records.AggregatedActivePowerRecord; -import titan.ccp.model.sensorregistry.ImmutableSensorRegistry; -import titan.ccp.model.sensorregistry.SensorRegistry; /** * The Aggregation microservice implemented as a Flink job. diff --git a/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/ChildParentsFlatMapFunction.java b/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/ChildParentsFlatMapFunction.java index c439df1e49381f8779a64814ae056635bd408c64..77391393d2977218ff15972f0329393388d24453 100644 --- a/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/ChildParentsFlatMapFunction.java +++ b/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/ChildParentsFlatMapFunction.java @@ -13,9 +13,9 @@ import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.java.tuple.Tuple2; import org.apache.flink.configuration.Configuration; import org.apache.flink.util.Collector; -import titan.ccp.model.sensorregistry.AggregatedSensor; -import titan.ccp.model.sensorregistry.Sensor; -import titan.ccp.model.sensorregistry.SensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.AggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.Sensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; /** * Transforms a {@link SensorRegistry} into key value pairs of Sensor identifiers and their parents' diff --git a/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/JoinAndDuplicateCoFlatMapFunction.java b/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/JoinAndDuplicateCoFlatMapFunction.java index 624327a69feb8bce2f1b85af3e57cf5db9511e74..0171e4b0b0c876242834edc76e8117615dc6b3b2 100644 --- a/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/JoinAndDuplicateCoFlatMapFunction.java +++ b/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/JoinAndDuplicateCoFlatMapFunction.java @@ -9,8 +9,8 @@ import org.apache.flink.api.java.tuple.Tuple2; import org.apache.flink.configuration.Configuration; import org.apache.flink.streaming.api.functions.co.RichCoFlatMapFunction; import org.apache.flink.util.Collector; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; import rocks.theodolite.benchmarks.uc4.flink.util.SensorParentKey; -import titan.ccp.model.records.ActivePowerRecord; /** * A {@link RichCoFlatMapFunction} which joins each incoming {@link ActivePowerRecord} with its diff --git a/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/RecordAggregationProcessWindowFunction.java b/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/RecordAggregationProcessWindowFunction.java index 29e1ea32235ae0789e72f4931932b2697c60759b..6dff6edaf5fb6343f0c6c4b12cbff4a9175751eb 100644 --- a/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/RecordAggregationProcessWindowFunction.java +++ b/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/RecordAggregationProcessWindowFunction.java @@ -11,9 +11,9 @@ import org.apache.flink.configuration.Configuration; import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction; import org.apache.flink.streaming.api.windowing.windows.TimeWindow; import org.apache.flink.util.Collector; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; import rocks.theodolite.benchmarks.uc4.flink.util.SensorParentKey; -import titan.ccp.model.records.ActivePowerRecord; -import titan.ccp.model.records.AggregatedActivePowerRecord; /** * A {@link ProcessWindowFunction} which performs the windowed aggregation of all diff --git a/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/util/ImmutableSensorRegistrySerializer.java b/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/util/ImmutableSensorRegistrySerializer.java index 54d8826900cc70a5eb86d71df7fcf9c4a4da4a7f..c491adc47d31211e809a00ad283266511e96c534 100644 --- a/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/util/ImmutableSensorRegistrySerializer.java +++ b/theodolite-benchmarks/uc4-flink/src/main/java/rocks/theodolite/benchmarks/uc4/flink/util/ImmutableSensorRegistrySerializer.java @@ -5,7 +5,7 @@ import com.esotericsoftware.kryo.Serializer; import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Output; import java.io.Serializable; -import titan.ccp.model.sensorregistry.ImmutableSensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.ImmutableSensorRegistry; /** * A {@link Serializer} for {@link ImmutableSensorRegistry}s. diff --git a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4HazelcastJetFactory.java b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4HazelcastJetFactory.java index 9b6aa71267150296d8b65268b1922925b7ada796..693f36bb2b4cd4d208496dfe804d635311f6eea5 100644 --- a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4HazelcastJetFactory.java +++ b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4HazelcastJetFactory.java @@ -13,13 +13,13 @@ import org.slf4j.Logger; import rocks.theodolite.benchmarks.commons.hazelcastjet.ConfigurationKeys; import rocks.theodolite.benchmarks.commons.hazelcastjet.JetInstanceBuilder; import rocks.theodolite.benchmarks.commons.hazelcastjet.KafkaPropertiesBuilder; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.ImmutableSensorRegistry; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.EventDeserializer; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.ImmutableSensorRegistryUc4Serializer; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.SensorGroupKey; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.SensorGroupKeySerializer; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.ValueGroup; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.ValueGroupSerializer; -import titan.ccp.model.sensorregistry.ImmutableSensorRegistry; /** * A Hazelcast Jet factory which can build a Hazelcast Jet Instance and Pipeline for the UC4 @@ -197,9 +197,9 @@ public class Uc4HazelcastJetFactory { * @return The Uc4HazelcastJetBuilder factory with set kafkaReadPropertiesForPipeline. */ public Uc4HazelcastJetFactory setReadPropertiesFromEnv(// NOPMD - final String bootstrapServersDefault, - final String schemaRegistryUrlDefault, - final String jobName) { + final String bootstrapServersDefault, + final String schemaRegistryUrlDefault, + final String jobName) { // Use KafkaPropertiesBuilder to build a properties object used for kafka final KafkaPropertiesBuilder propsBuilder = new KafkaPropertiesBuilder(); diff --git a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4PipelineBuilder.java b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4PipelineBuilder.java index 2efb8250c0e1136b34412e4553b2d216c5e24b43..f15633a8f8cd9beef2d235000d5d2827d06730b8 100644 --- a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4PipelineBuilder.java +++ b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4PipelineBuilder.java @@ -1,4 +1,4 @@ -package rocks.theodolite.benchmarks.uc4.hazelcastjet; +package rocks.theodolite.benchmarks.uc4.hazelcastjet; // NOPMD Excessive imports import com.hazelcast.function.BiFunctionEx; import com.hazelcast.jet.Traverser; @@ -25,20 +25,19 @@ import java.util.Properties; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.AggregatedActivePowerRecordAccumulator; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.ChildParentsTransformer; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.SensorGroupKey; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.ValueGroup; -import titan.ccp.configuration.events.Event; -import titan.ccp.model.records.ActivePowerRecord; -import titan.ccp.model.records.AggregatedActivePowerRecord; -import titan.ccp.model.sensorregistry.SensorRegistry; /** * Builder to build a HazelcastJet Pipeline for UC4 which can be used for stream processing using * Hazelcast Jet. */ -@SuppressWarnings("PMD.ExcessiveImports") public class Uc4PipelineBuilder { private static final Logger LOGGER = LoggerFactory.getLogger(Uc4PipelineBuilder.class); @@ -117,9 +116,9 @@ public class Uc4PipelineBuilder { * * <p> * UC4 takes {@code ActivePowerRecord} events from sensors and a {@code SensorRegistry} with maps - * from keys to groups to map values to their according groups. A feedback stream allows for - * group keys to be mapped to values and eventually to be mapped to other top level groups defines - * by the {@code SensorRegistry}. + * from keys to groups to map values to their according groups. A feedback stream allows for group + * keys to be mapped to values and eventually to be mapped to other top level groups defines by + * the {@code SensorRegistry}. * </p> * * <p> @@ -180,10 +179,10 @@ public class Uc4PipelineBuilder { ////////////////////////////////// // (2) UC4 Merge Input with aggregation stream - final StreamStageWithKey<Entry<String, ActivePowerRecord>, String> - mergedInputAndAggregations = inputStream - .merge(aggregations) - .groupingKey(Entry::getKey); + final StreamStageWithKey<Entry<String, ActivePowerRecord>, String> mergedInputAndAggregations = + inputStream + .merge(aggregations) + .groupingKey(Entry::getKey); ////////////////////////////////// // (3) UC4 Join Configuration and Merges Input/Aggregation Stream @@ -235,28 +234,25 @@ public class Uc4PipelineBuilder { ////////////////////////////////// // (5) UC4 Last Value Map // Table with tumbling window differentiation [ (sensorKey,Group) , value ],Time - final StageWithWindow<Entry<SensorGroupKey, ActivePowerRecord>> - windowedLastValues = dupliAsFlatmappedStage - .window(WindowDefinition.tumbling(windowSize)); + final StageWithWindow<Entry<SensorGroupKey, ActivePowerRecord>> windowedLastValues = + dupliAsFlatmappedStage + .window(WindowDefinition.tumbling(windowSize)); - final AggregateOperation1<Entry<SensorGroupKey, ActivePowerRecord>, - AggregatedActivePowerRecordAccumulator, AggregatedActivePowerRecord> aggrOp = + final AggregateOperation1<Entry<SensorGroupKey, ActivePowerRecord>, AggregatedActivePowerRecordAccumulator, AggregatedActivePowerRecord> aggrOp = // NOCS AggregateOperation - .withCreate(AggregatedActivePowerRecordAccumulator::new) - .<Entry<SensorGroupKey, ActivePowerRecord>>andAccumulate((acc, rec) -> { - acc.setId(rec.getKey().getGroup()); - acc.addInputs(rec.getValue()); - }) - .andCombine((acc, acc2) -> - acc.addInputs(acc2.getId(), acc2.getSumInW(), acc2.getCount(), acc.getTimestamp())) - .andDeduct((acc, acc2) -> acc.removeInputs(acc2.getSumInW(), acc2.getCount())) - .andExportFinish(acc -> - new AggregatedActivePowerRecord(acc.getId(), + .withCreate(AggregatedActivePowerRecordAccumulator::new) + .<Entry<SensorGroupKey, ActivePowerRecord>>andAccumulate((acc, rec) -> { + acc.setId(rec.getKey().getGroup()); + acc.addInputs(rec.getValue()); + }) + .andCombine((acc, acc2) -> acc.addInputs(acc2.getId(), acc2.getSumInW(), + acc2.getCount(), acc.getTimestamp())) + .andDeduct((acc, acc2) -> acc.removeInputs(acc2.getSumInW(), acc2.getCount())) + .andExportFinish(acc -> new AggregatedActivePowerRecord(acc.getId(), acc.getTimestamp(), acc.getCount(), acc.getSumInW(), - acc.getAverageInW()) - ); + acc.getAverageInW())); // write aggregation back to kafka diff --git a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/AggregatedActivePowerRecordAccumulator.java b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/AggregatedActivePowerRecordAccumulator.java index 3166f16cd31bf0e6d4dff6548468791e7a5e5c5c..14934fbe3ceec6e01836958c1f7686e225ea40fd 100644 --- a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/AggregatedActivePowerRecordAccumulator.java +++ b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/AggregatedActivePowerRecordAccumulator.java @@ -1,6 +1,6 @@ package rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Accumulator class for AggregatedActivePowerRecords. @@ -25,10 +25,10 @@ public class AggregatedActivePowerRecordAccumulator { * Creates an AggregationObject. */ public AggregatedActivePowerRecordAccumulator(final String id, - final long timestamp, - final long count, - final double sumInW, - final double averageInW) { + final long timestamp, + final long count, + final double sumInW, + final double averageInW) { this.id = id; this.timestamp = timestamp; this.count = count; @@ -50,16 +50,16 @@ public class AggregatedActivePowerRecordAccumulator { this.count += 1; this.sumInW += record.getValueInW(); this.timestamp = record.getTimestamp(); - this.averageInW = sumInW / count; + this.averageInW = this.sumInW / this.count; } /** * Adds the records from another aggregator. */ public void addInputs(final String id, - final double sumInW, - final long count, - final long timestamp) { + final double sumInW, + final long count, + final long timestamp) { this.id = this.id == null ? id : this.id; this.sumInW += sumInW; this.count += count; @@ -68,8 +68,8 @@ public class AggregatedActivePowerRecordAccumulator { } /** - * Removes the values of another aggreagator. - * Not a complete reset since the old timestamp is lost. + * Removes the values of another aggreagator. Not a complete reset since the old timestamp is + * lost. */ public void removeInputs(final double sumInW, final long count) { this.sumInW -= sumInW; @@ -79,22 +79,22 @@ public class AggregatedActivePowerRecordAccumulator { } public long getCount() { - return count; + return this.count; } public double getSumInW() { - return sumInW; + return this.sumInW; } public double getAverageInW() { - return averageInW; + return this.averageInW; } public String getId() { - return id; + return this.id; } public long getTimestamp() { - return timestamp; + return this.timestamp; } } diff --git a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ChildParentsTransformer.java b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ChildParentsTransformer.java index ad3b2294cb934ba04b07df2e2b2d3dbdd6e1a905..3ba604270e37d746c2e98bc4eef5c80d2526b446 100644 --- a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ChildParentsTransformer.java +++ b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ChildParentsTransformer.java @@ -10,10 +10,11 @@ import org.apache.kafka.streams.kstream.Transformer; import org.apache.kafka.streams.processor.ProcessorContext; import org.apache.kafka.streams.state.KeyValueIterator; import org.apache.kafka.streams.state.KeyValueStore; -import titan.ccp.configuration.events.Event; -import titan.ccp.model.sensorregistry.AggregatedSensor; -import titan.ccp.model.sensorregistry.Sensor; -import titan.ccp.model.sensorregistry.SensorRegistry; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.AggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.Sensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; + /** * Transforms a {@link SensorRegistry} into key value pairs of Sensor identifiers and their parents' diff --git a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/EventDeserializer.java b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/EventDeserializer.java index c8d06b497009944b9a9a0fda4ab224e5fe992e3d..ebdc9de86e82a9c8c16a71830190d26e6f0e34fa 100644 --- a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/EventDeserializer.java +++ b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/EventDeserializer.java @@ -2,8 +2,8 @@ package rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics; import java.util.Map; import org.apache.kafka.common.serialization.Deserializer; -import titan.ccp.configuration.events.Event; -import titan.ccp.configuration.events.EventSerde; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.configuration.events.EventSerde; /** * Deserializer for Event Objects. diff --git a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ImmutableSensorRegistryUc4Serializer.java b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ImmutableSensorRegistryUc4Serializer.java index 53d22f7f156891cf11e5b8915eed17b74c3d57fb..84e007dde7fb3a075a605bacfbbda05f206c2ee4 100644 --- a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ImmutableSensorRegistryUc4Serializer.java +++ b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ImmutableSensorRegistryUc4Serializer.java @@ -4,7 +4,7 @@ import com.hazelcast.nio.ObjectDataInput; import com.hazelcast.nio.ObjectDataOutput; import com.hazelcast.nio.serialization.StreamSerializer; import java.io.IOException; -import titan.ccp.model.sensorregistry.ImmutableSensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.ImmutableSensorRegistry; /** * {@link StreamSerializer} for Hazelcast Jet to serialize and deserialize an diff --git a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ValueGroup.java b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ValueGroup.java index 893efcf74fe8a16202d795fca5cc43b63190dc50..b5f5fc7cb2822667dcaa26560fa83b2da3a513d9 100644 --- a/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ValueGroup.java +++ b/theodolite-benchmarks/uc4-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/uc4specifics/ValueGroup.java @@ -2,7 +2,8 @@ package rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics; import java.util.Objects; import java.util.Set; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; + /** * Structure: (valueInW, Set(Groups)). diff --git a/theodolite-benchmarks/uc4-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4PipelineTest.java b/theodolite-benchmarks/uc4-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4PipelineTest.java index b74c2874b92a51b138ffe8b44b1cf750dfce5880..569f06105dbdb2b99c10d89b5f72585fe011fe19 100644 --- a/theodolite-benchmarks/uc4-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4PipelineTest.java +++ b/theodolite-benchmarks/uc4-hazelcastjet/src/test/java/rocks/theodolite/benchmarks/uc4/hazelcastjet/Uc4PipelineTest.java @@ -22,19 +22,19 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; -import rocks.theodolite.benchmarks.uc4.hazelcastjet.Uc4PipelineBuilder; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.ImmutableSensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MachineSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MutableAggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MutableSensorRegistry; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.ImmutableSensorRegistryUc4Serializer; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.SensorGroupKey; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.SensorGroupKeySerializer; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.ValueGroup; import rocks.theodolite.benchmarks.uc4.hazelcastjet.uc4specifics.ValueGroupSerializer; -import titan.ccp.configuration.events.Event; -import titan.ccp.model.records.ActivePowerRecord; -import titan.ccp.model.records.AggregatedActivePowerRecord; -import titan.ccp.model.sensorregistry.ImmutableSensorRegistry; -import titan.ccp.model.sensorregistry.MachineSensor; -import titan.ccp.model.sensorregistry.MutableAggregatedSensor; -import titan.ccp.model.sensorregistry.MutableSensorRegistry; + @Category(SerialTest.class) public class Uc4PipelineTest extends JetTestSupport { @@ -75,7 +75,7 @@ public class Uc4PipelineTest extends JetTestSupport { final StreamSource<Entry<String, AggregatedActivePowerRecord>> testAggregationSource = TestSources.itemStream(testItemsPerSecond, (timestamp, item) -> { - AggregatedActivePowerRecord test = + final AggregatedActivePowerRecord test = new AggregatedActivePowerRecord(testSensorName, System.currentTimeMillis(), 1L, @@ -100,7 +100,7 @@ public class Uc4PipelineTest extends JetTestSupport { // Topology: // level2Group -> level1Group -> testSensor - + // Create Registry final MutableSensorRegistry testRegistry = new MutableSensorRegistry(testLevel2GroupName); // Add Sensors @@ -118,7 +118,7 @@ public class Uc4PipelineTest extends JetTestSupport { // Create pipeline to test final Uc4PipelineBuilder pipelineBuilder = new Uc4PipelineBuilder(); this.testPipeline = Pipeline.create(); - this.uc4Topology = pipelineBuilder.extendUc4Topology(testPipeline, + this.uc4Topology = pipelineBuilder.extendUc4Topology(this.testPipeline, testInputSource, testAggregationSource, testConfigSource, testWindowSize); this.uc4Topology.writeTo(Sinks.logger()); @@ -130,8 +130,8 @@ public class Uc4PipelineTest extends JetTestSupport { @Test public void testOutput() { -// System.out.println("DEBUG DEBUG DEBUG || ENTERED TEST 1"); - + // System.out.println("DEBUG DEBUG DEBUG || ENTERED TEST 1"); + // Assertion Configuration final int timeout = 20; final String testSensorName = "TEST-SENSOR"; @@ -141,7 +141,7 @@ public class Uc4PipelineTest extends JetTestSupport { // Assertion - this.uc4Topology.apply(Assertions.assertCollectedEventually(timeout, + this.uc4Topology.apply(Assertions.assertCollectedEventually(timeout, collection -> { System.out.println("DEBUG || ENTERED ASSERTION COLLECTED EVENTUALLY"); @@ -168,11 +168,11 @@ public class Uc4PipelineTest extends JetTestSupport { testLevel1contained = true; } - if(Objects.equals(key, testLevel2GroupName)){ + if (Objects.equals(key, testLevel2GroupName)) { testLevel2contained = true; } - if (testValueInW != agg.getAverageInW()){ + if (testValueInW != agg.getAverageInW()) { averageEqTest = false; } @@ -191,10 +191,10 @@ public class Uc4PipelineTest extends JetTestSupport { System.out.println("avOk: " + avOk); Assert.assertTrue("Assertion did not complete!", allOkay); - + })); - try{ + try { final JobConfig jobConfig = new JobConfig() .registerSerializer(ValueGroup.class, ValueGroupSerializer.class) @@ -209,7 +209,7 @@ public class Uc4PipelineTest extends JetTestSupport { "Job was expected to complete with AssertionCompletedException, but completed with: " + e.getCause(), errorMsg.contains(AssertionCompletedException.class.getName())); - } catch (Exception e){ + } catch (final Exception e) { System.out.println("ERRORORORO TEST BROKEN !!!!"); System.out.println(e); } diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/AggregationService.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/AggregationService.java index 341c37bc086dabb3a93dcd3b0f221dd91007b8b3..26ea02957fb013c61c4ee0c3e2f280b0b9b8c993 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/AggregationService.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/AggregationService.java @@ -4,8 +4,8 @@ import java.time.Duration; import java.util.concurrent.CompletableFuture; import org.apache.commons.configuration2.Configuration; import org.apache.kafka.streams.KafkaStreams; +import rocks.theodolite.benchmarks.commons.commons.configuration.ServiceConfigurations; import rocks.theodolite.benchmarks.commons.kstreams.ConfigurationKeys; -import titan.ccp.common.configuration.ServiceConfigurations; /** * A microservice that manages the history and, therefore, stores and aggregates incoming diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ChildParentsTransformer.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ChildParentsTransformer.java index bdc8fc7d4267fbdb427d8dc217ef296c0553da1b..d311ff009c138c6afe29cf9e95c323ea46a6bc0f 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ChildParentsTransformer.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ChildParentsTransformer.java @@ -10,10 +10,10 @@ import org.apache.kafka.streams.kstream.Transformer; import org.apache.kafka.streams.processor.ProcessorContext; import org.apache.kafka.streams.state.KeyValueIterator; import org.apache.kafka.streams.state.KeyValueStore; -import titan.ccp.configuration.events.Event; -import titan.ccp.model.sensorregistry.AggregatedSensor; -import titan.ccp.model.sensorregistry.Sensor; -import titan.ccp.model.sensorregistry.SensorRegistry; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.AggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.Sensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; /** * Transforms a {@link SensorRegistry} into key value pairs of Sensor identifiers and their parents' diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ChildParentsTransformerSupplier.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ChildParentsTransformerSupplier.java index 538643f0cdb119988e446f3eae793e2efcccadd6..734989af63b6b2a7fc97b368bb2651112c98fda5 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ChildParentsTransformerSupplier.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ChildParentsTransformerSupplier.java @@ -10,8 +10,8 @@ import org.apache.kafka.streams.kstream.TransformerSupplier; import org.apache.kafka.streams.state.KeyValueStore; import org.apache.kafka.streams.state.StoreBuilder; import org.apache.kafka.streams.state.Stores; -import titan.ccp.configuration.events.Event; -import titan.ccp.model.sensorregistry.SensorRegistry; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; /** * Supplier class for a {@link ChildParentsTransformer}. diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointFlatTransformer.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointFlatTransformer.java index 38cbca81d664ca72494525263d8a7ab3a7523bfc..06cbe1f40719fcbb6b9b8a22767ec415def3dc80 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointFlatTransformer.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointFlatTransformer.java @@ -9,7 +9,7 @@ import org.apache.kafka.streams.KeyValue; import org.apache.kafka.streams.kstream.Transformer; import org.apache.kafka.streams.processor.ProcessorContext; import org.apache.kafka.streams.state.KeyValueStore; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Transforms the join result of an {@link ActivePowerRecord} and the corresponding sensor parents diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointFlatTransformerSupplier.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointFlatTransformerSupplier.java index 2e635ec368bca87bdb882580b51f763abba8f32a..67efca0671ad347add9d5dcc1f255a9c8d9de09b 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointFlatTransformerSupplier.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointFlatTransformerSupplier.java @@ -9,7 +9,7 @@ import org.apache.kafka.streams.kstream.TransformerSupplier; import org.apache.kafka.streams.state.KeyValueStore; import org.apache.kafka.streams.state.StoreBuilder; import org.apache.kafka.streams.state.Stores; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * Supplier class for {@link JointFlatTransformerSupplier}. diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointRecordParents.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointRecordParents.java index 5892c6d3ac84c6d1ff56cfb440186e07fd9d9eb0..85b3a817564367098996196694994497b9db8793 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointRecordParents.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/JointRecordParents.java @@ -2,7 +2,7 @@ package rocks.theodolite.benchmarks.uc4.kstreams; import java.util.Objects; import java.util.Set; -import titan.ccp.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; /** * A joined pair of an {@link ActivePowerRecord} and its associated parents. Both the record and the diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/OptionalParentsSerde.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/OptionalParentsSerde.java index 3738fadd52b22abb8e13f20ae6066017112f0455..e5ff9c676b4ea539fb9605fc51c93920c3757fc8 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/OptionalParentsSerde.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/OptionalParentsSerde.java @@ -4,10 +4,10 @@ import java.util.HashSet; import java.util.Optional; import java.util.Set; import org.apache.kafka.common.serialization.Serde; -import titan.ccp.common.kafka.simpleserdes.BufferSerde; -import titan.ccp.common.kafka.simpleserdes.ReadBuffer; -import titan.ccp.common.kafka.simpleserdes.SimpleSerdes; -import titan.ccp.common.kafka.simpleserdes.WriteBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.BufferSerde; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.ReadBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.SimpleSerdes; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.WriteBuffer; /** * {@link Serde} factory for an optional {@link Set} of parent identifiers. diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ParentsSerde.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ParentsSerde.java index dac58c84bc1914b4e54fe5eb6da0930204e34eb5..b70df46325f60c82a3759219827e9ab54b17b57a 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ParentsSerde.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/ParentsSerde.java @@ -3,10 +3,10 @@ package rocks.theodolite.benchmarks.uc4.kstreams; import java.util.HashSet; import java.util.Set; import org.apache.kafka.common.serialization.Serde; -import titan.ccp.common.kafka.simpleserdes.BufferSerde; -import titan.ccp.common.kafka.simpleserdes.ReadBuffer; -import titan.ccp.common.kafka.simpleserdes.SimpleSerdes; -import titan.ccp.common.kafka.simpleserdes.WriteBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.BufferSerde; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.ReadBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.SimpleSerdes; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.WriteBuffer; /** * {@link Serde} factory for {@link Set} of parent identifiers. diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/RecordAggregator.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/RecordAggregator.java index d107dedbfdb58489a6f00e2baf248f15bb823db9..bbc6079521d38b75ae35ea49fda26e7504746b23 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/RecordAggregator.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/RecordAggregator.java @@ -1,8 +1,8 @@ package rocks.theodolite.benchmarks.uc4.kstreams; import org.apache.kafka.streams.kstream.Windowed; -import titan.ccp.model.records.ActivePowerRecord; -import titan.ccp.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; /** * Updates an {@link AggregatedActivePowerRecord} by a new {@link ActivePowerRecord}. diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/SensorParentKeySerde.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/SensorParentKeySerde.java index 80fd16f64c6f08e32a89bb3558b61d3f560be890..1beab6094bcc87bed0bbbedbc449edadf3523c19 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/SensorParentKeySerde.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/SensorParentKeySerde.java @@ -1,10 +1,10 @@ package rocks.theodolite.benchmarks.uc4.kstreams; import org.apache.kafka.common.serialization.Serde; -import titan.ccp.common.kafka.simpleserdes.BufferSerde; -import titan.ccp.common.kafka.simpleserdes.ReadBuffer; -import titan.ccp.common.kafka.simpleserdes.SimpleSerdes; -import titan.ccp.common.kafka.simpleserdes.WriteBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.BufferSerde; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.ReadBuffer; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.SimpleSerdes; +import rocks.theodolite.benchmarks.commons.kafka.simpleserdes.WriteBuffer; /** * {@link Serde} factory for {@link SensorParentKey}. diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/TopologyBuilder.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/TopologyBuilder.java index fbd3ed109965b103e4f1cdeb4324581bc6c82e8b..876e53422183306963cf07853939247bbb012464 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/TopologyBuilder.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/TopologyBuilder.java @@ -18,12 +18,12 @@ import org.apache.kafka.streams.kstream.Suppressed.BufferConfig; import org.apache.kafka.streams.kstream.TimeWindows; import org.apache.kafka.streams.kstream.Windowed; import org.apache.kafka.streams.kstream.WindowedSerdes; -import titan.ccp.common.kafka.avro.SchemaRegistryAvroSerdeFactory; -import titan.ccp.configuration.events.Event; -import titan.ccp.configuration.events.EventSerde; -import titan.ccp.model.records.ActivePowerRecord; -import titan.ccp.model.records.AggregatedActivePowerRecord; -import titan.ccp.model.sensorregistry.SensorRegistry; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.configuration.events.EventSerde; +import rocks.theodolite.benchmarks.commons.kafka.avro.SchemaRegistryAvroSerdeFactory; +import rocks.theodolite.benchmarks.commons.model.records.ActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.records.AggregatedActivePowerRecord; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; /** * Builds Kafka Stream Topology for the History microservice. diff --git a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/Uc4KafkaStreamsBuilder.java b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/Uc4KafkaStreamsBuilder.java index 4d2b96ccb751dbb804eab0806303312a88702dc0..209eb519f9e61b2aaa684686e391ccc11aa808e7 100644 --- a/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/Uc4KafkaStreamsBuilder.java +++ b/theodolite-benchmarks/uc4-kstreams/src/main/java/rocks/theodolite/benchmarks/uc4/kstreams/Uc4KafkaStreamsBuilder.java @@ -5,8 +5,8 @@ import java.util.Objects; import java.util.Properties; import org.apache.commons.configuration2.Configuration; import org.apache.kafka.streams.Topology; +import rocks.theodolite.benchmarks.commons.kafka.avro.SchemaRegistryAvroSerdeFactory; import rocks.theodolite.benchmarks.commons.kstreams.KafkaStreamsBuilder; -import titan.ccp.common.kafka.avro.SchemaRegistryAvroSerdeFactory; /** * Builder for the Kafka Streams configuration. diff --git a/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/ConfigPublisher.java b/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/ConfigPublisher.java index 98f470b0df1873766c3bf56fb7e6a8eae0019ce4..60c95321f05edff35681d8984baa03ca711f48da 100644 --- a/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/ConfigPublisher.java +++ b/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/ConfigPublisher.java @@ -7,8 +7,8 @@ import org.apache.kafka.clients.producer.Producer; import org.apache.kafka.clients.producer.ProducerConfig; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.common.serialization.StringSerializer; -import titan.ccp.configuration.events.Event; -import titan.ccp.configuration.events.EventSerde; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.configuration.events.EventSerde; /** * Class to publish a configuration to Kafka. diff --git a/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/LoadGenerator.java b/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/LoadGenerator.java index 2077de2d9918d46a7a3e671ae9820a7c7abadbfc..3f02a4b5ebf232e4dcb3ff236f656cf6fb485989 100644 --- a/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/LoadGenerator.java +++ b/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/LoadGenerator.java @@ -3,9 +3,9 @@ package rocks.theodolite.benchmarks.uc4.loadgenerator; import java.util.Objects; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import rocks.theodolite.benchmarks.commons.configuration.events.Event; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; import rocks.theodolite.benchmarks.loadgenerator.KeySpace; -import titan.ccp.configuration.events.Event; -import titan.ccp.model.sensorregistry.SensorRegistry; /** * Load generator for Theodolite use case UC4. diff --git a/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/SensorRegistryBuilder.java b/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/SensorRegistryBuilder.java index c69dffb6093f914111b8c74bc25f3ca3a0a34ae6..c9dcfa0af8676460c5cc59ed2f4f6b4641911525 100644 --- a/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/SensorRegistryBuilder.java +++ b/theodolite-benchmarks/uc4-load-generator/src/main/java/rocks/theodolite/benchmarks/uc4/loadgenerator/SensorRegistryBuilder.java @@ -1,8 +1,8 @@ package rocks.theodolite.benchmarks.uc4.loadgenerator; -import titan.ccp.model.sensorregistry.MutableAggregatedSensor; -import titan.ccp.model.sensorregistry.MutableSensorRegistry; -import titan.ccp.model.sensorregistry.SensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MutableAggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MutableSensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; /** * Builder for creating a nested {@link SensorRegistry} with {@code numNestedGroups} levels and diff --git a/theodolite-benchmarks/uc4-load-generator/src/test/java/rocks/theodolite/benchmarks/uc4/loadgenerator/SensorRegistryBuilderTest.java b/theodolite-benchmarks/uc4-load-generator/src/test/java/rocks/theodolite/benchmarks/uc4/loadgenerator/SensorRegistryBuilderTest.java index a169eddb10ac34b91b814a657bf327a79ae00ac4..037bd8119ef1ea93ed3dae346282538ff5399f25 100644 --- a/theodolite-benchmarks/uc4-load-generator/src/test/java/rocks/theodolite/benchmarks/uc4/loadgenerator/SensorRegistryBuilderTest.java +++ b/theodolite-benchmarks/uc4-load-generator/src/test/java/rocks/theodolite/benchmarks/uc4/loadgenerator/SensorRegistryBuilderTest.java @@ -5,10 +5,10 @@ import java.util.Set; import java.util.stream.Collectors; import org.junit.Assert; import org.junit.Test; -import titan.ccp.model.sensorregistry.AggregatedSensor; -import titan.ccp.model.sensorregistry.MachineSensor; -import titan.ccp.model.sensorregistry.Sensor; -import titan.ccp.model.sensorregistry.SensorRegistry; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.AggregatedSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.MachineSensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.Sensor; +import rocks.theodolite.benchmarks.commons.model.sensorregistry.SensorRegistry; public class SensorRegistryBuilderTest {