# Terminology * SmallRye - Out the box implementation of MicroProfiles, using JBoss stuff for getting up and running, basically "plugins", IBM competitor is openliberty * MicroProfile - Eclipse MicroProfile, microservice framework composed of made up of (bare min) * JAX-RS - API for creating REST APIs * JSON-P - API for processing JSON * CDI 2.0 - Glue JAX-RS and JSON-P together dependency injection using java beans, share a class and manage its lifecycle * JSON-B - JSON binding (similar to jackson databind) * Open Tracing - standardise tracing/logging/profile metadata across a distributed service, provides wire protocol api spec and impl etc * Other stuff like Metrics (prometheus), watchdogs, retry, circuit breakers etc * Loom - Virtual threads approach to non-blocking IO (as opposed to event-loop) * Quarkus * ArC - CDI (injection framework), developed from Weld * Command mode - terminates exits after run as opposed to normal operation (wait for systemexit or pod to be killed) * Jandex - Java annotations indexer (Jason Green dev) * mod_cluster - undertow based Load Balancer * Hotspot vs Native * Hotspot JVM (JIT) (Andrew Dinn in the office... well when theres not a global pandemic) * Native via GraalVM (AOT) * Testing frameworks * JUnit - Main Java testing framework * Rest-assured - Test REST APIs * Awaitility - Java DSL test framework for async systems * FitNesse - A fork of Fit (Framework for Integrated Test) Acceptance testing framework * Testing methodologies * Smoke testing - Simple tests for build verification eg. does it run without segfault/strack trace * Unit testing - Testing class/methods * Integration testing - Testing application framed by user scenarios * System testing - Holistic blackbox testing between integration components * Acceptance testing - * User acceptance testing - Factory acceptance testing (FAT), Site acceptance testing (SAT) * Operational acceptance testing - Things that allow a system to be maintained, checking of backups, checking of patching mechanisms etc * Contractural and regulation acceptance testing - Test against criteria as documented (Prod gatechecks for example) * Debugging (not actually testing but relevent experience, from gdb on ChibiOS to intelij) # General Notes Quarkus built upon VERT-X for non-blocking IO, VERT-X mostly built upon netty, Vert-X provides a 80+ connectors for non-blocking IO like Kafka, mongodb, AMQP etc Quarkus two main deploy modes - native (graalvm) and jvm, some things dont do so well natively ```java //Mutiny async construct, onItem <- the result, onFailure <- Failed calls Uni uni uni.onItem() .onFailure() ``` # The Job spec * Implement test scenarios and develop enterpirse applications for testing * Design and develop testing frameworks in Java for various environments, like cloud, multiple operating systems, large clusters, and containers * Provide root cause analysis for complex bugs reported by our customers and communicate the impact of these bugs to customers, developers, and support specialists * Participate in defining testing strategies * Analyze and prioritize the quality risks posed by Red Hat products and determine the tests required to mitigate these risks * Serve as an internal advocate for our customers to ensure that the product goes to customers without usability or user experience issues; properly document relevant information * Document new bugs and work with project managers and developers on prioritization and a fix * Mentor junior team members * Constantly learn new things and maintain an overview of current technologies like Java, MicroProfile, and Reactive programming ## Technical Job specs * Practical experience with Java EE, MicroProfile, or Spring development * Experience with testing in Junit or TestNG beyond unit tests * Experience with Maven, Git, Jenkins, continuous integration, and pipelines * Debugging and performance tuning skills * Ability to install and maintain Red Hat Enterprise Linux (RHEL) or UNIX-like operating systems; basic administration skills of Jenkins nodes ### Main technologies to learn about * Microprofile + SmallRye * JUnit * TestNG - Many of its features on the roadmap for JUnit 5.x anyway * Jenkins, CI, piplines Blue Ocean * Maven - Already know most of this * Have fixed bugs in maven plugins * Used maven extensively in productisation * Good knowledge of prod proccess ### JUnit5 [Architecture](https://www.youtube.com/watch?v=1xRcRYKOTHs&list=PLqq-6Pq4lTTa4ad5JISViSb2FVG8Vwa4o&index=5) * Platform - Test engine itself * Jupiter - JUnit5 API/Annotations * Vintage - API for older JUnit4 tests * Ext - 3rd Party extensions (custom API aka SPI) "No news is good news" - We only care for failures * `@Test` annotation to highlight test method we'd like to run as part of JUnit tests * Common assert methods ```java assertEquals(expected, actual, "Description of failure") // Asserts both values are equal assertArrayEquals(expectedArray, actualArray) //Verifies each item in the array are equal in the right position/order assertIterableEquals(expectedArray, actualArray) // Verifies iterables, again equal and in the right position/order fail() //Always fail... duh assertAll( () -> assertEquals(expected, actual), //() -> ... ) ``` Surefire plugin in maven to run JUnit tests (thing we always disabled in Prod :wink:) * Test lifecycle annotations ```java @BeforeAll //needs to be static method @AfterAll //needs to be a static method @BeforeEach @AfterEach //eg init a new pojo for each test class Foo { SomePojo pojo; @BeforeEach void init() { pojo = new SomePojo(); } } ``` * Nested ```java class Foo { @Nested class Bar { @Test @DisplayName("Test Description") void dosomething() { assertEquals(expected, pojo.method(x,y), "Test description"); assertEquals(Somethinexpected, pojo.method(x), "Test description 2" } void dosomethingelse() { assertEquals(expected, pojo.method(x,y), "Test description"); assertEquals(Somethinexpected, pojo.method(x), "Test description 2" } } } ``` * Lambda for lazy tests ```java assertEquals(expected, actual, () -> "big bad string: " + expected + "actual: " + actual) //Will only execute lambda if assert fires ``` * Repeated test `@RepeatedTest(n)` - Repeat a test multiple times (n number of times) has [RepetitionInfo](https://junit.org/junit5/docs/5.0.0/api/org/junit/jupiter/api/RepetitionInfo.html) * `@Tag` annotation allows running of many or few of multiple tags * JUnit provides many providers (injected) eg. `RepetitionInfo` or `testInfo` ### QE tests [Github](https://github.com/quarkus-qe) * Quarkus-startstop - Measures time and memory usage * Did something similar when working on opensplice DDS, combined a demo application with measurement output, used to track metrics not perfect as it didn't account for multiple tests/threads running, sort of solved with CPU pinning * Quarkus jenkinsfiles - Jenkins pipelines, based on Groovy * Experience with groovy https://github.com/jboss-fuse/fuse-build-yaml/blob/7.x.redhat-7-x/src/main/groovy/formatYaml.groovy (all my groovy looks like java) * I've created Jenkins while in prod to do a number of tasks, namely * Interogating brew build root * Assembling various maven repository sets * Creating reports (build from source %) * Templates for email, html, Jira * Used a mixture of bash and python at the time but this is what prod tooling used at the time * Openshift test suite - Integration tests for services on openshift * Deploys service via openshift YAML e.g. AMQ then tests quarkus application against it * Experience with deploying own openshift cluster and apps (Old laptop... still running now just cant access it!) * Experience with managing openshift cluster (Qucklabs) * Beefy-scenarios - # The plan - [ ] Understand technologies and terminologies - [ ] Fire up Quarkus example (hello world) - [ ] Design an LED conversion proxy for front porch - [ ] Listen to MQTT broker - [ ] Possibly use camel k to write mqtt to file or something - [ ] "Translate" and passthrough to porchLED - [ ] Write TestNG tests - [ ] Mockquito # Refs * [What is microprofile](https://www.youtube.com/watch?v=TDhRcKFRlq8) * [What is SmallRye](https://www.youtube.com/watch?v=T3sh8M0t7yM) * [CDI explained](https://www.youtube.com/watch?v=Q8jHRDu9Fbo) * [Mutiny lib/Vert-X](https://www.youtube.com/watch?v=uTK73fpPznQ) * [Weld](http://weld.cdi-spec.org/) * [Quickstart hello world](https://quarkus.io/guides/getting-started) & [Building native image](https://quarkus.io/guides/building-native-image) - Used multistage build * [Awaitility](https://github.com/awaitility/awaitility)