Skip to main content

Tech Conversant Weekly Feb 20 - Feb 25

Topic: General                                                                                                                Level: All

Welcome to the world of cutting-edge technology! Every week, we bring you the latest and greatest advancements in the tech industry that are sure to leave you feeling inspired and empowered.

Stay ahead of the game and be the first to know about the newest innovations shaping our world. Discover new ways to improve your daily life, become more efficient, and enjoy new experiences.

This week, we've got some exciting news to share with you!

Running unit tests ensures the particular functionality works as expected, and running integration tests ensures the state of data in an end-to-end flow context of the application remains intact.
However, running consecutive sequences of tests would alter the data state between tests, to ensure fair and accurate execution of all tests the data for the tests should be baselined to an appropriate state before execution.
This can be attained by purging the database state between the tests like,
1. Junit5 BeforeEach with JdbcTestUtils to clear the data state changes before the actual test execution 
2. BeforeEach with Flyway clean and migrate stages which will be disabled by default and requires to be overridden in the test properties.
Given the number of database migration scripts, there would be a delay in the execution of each test which needs to be moved to a parent test class or possibly a nested test class.
With BeforeEachCallback we can proxy intercept the BeforeEach test invocation and set flyway clean and migrate ensuring parent execution

ThreadLocal API provides data sharing between multiple threads enabling the mutability of the data on the thread that accesses the shared state. The data on the thread is retained throughout the lifetime of the thread until the remove method is invoked.
This mutable data scope that is extended across the threads leaves thread data changes untraceable, worse in the case of inheritance.
With Scoped values, data is immutable and bound to the thread scope, by where clause taking the scoped value as key and object to be bound as value and run method to scope the thread to which this binding would be valid for the invoking method. 
From this method, we can access the data via the get method until the scope of the run method and post which the binding is destroyed.
Immutability ensures that the callee can make it a constant to its callers in the same thread without sharing the data. And if it requires to be shared it requires rebinding to the callers of the callee with new scoped values.
For cross-thread data sharing, StructuredConcurrency with StructuredTaskScope and scoped values are automatically inherited by all child threads created via it.

Rely on the factory methods of the Comparator interface for creating comparators.
Comparator.comparing, thenComparing, thenComparingXXX for primitive wrappers, reversed, naturalOrder, nullIsLast, nullIsFirst
For primitives, use wrappers class factory methods for comparing.
Integer::compare method reference 
Use immutable objects when using a comparator or don't mutate the objects under comparison

SQL Window function applies to an aggregate function over specified column data for partitioning, meaning that you can apply operations over the resultant query table rows as a dataset.
JPQL Hibernate 6, provides an implementation identical to the SQL Window function with aggregate function taking in the partition by clause for applying the function with over clause, returning List<Object[]>. This return can be modified for convenience by using DTO projections and replacing the query with a constructor mapping or setting a typed custom tuple transformer.
For Hibernate 5, JPQL provides nativeQueries defining the SQL Window function syntax returning List<Object[]>, again this can be transformed by using SqlResultSetMapping with constructor mapping on DTO projection or we can use ResultTransformer.

The Java programming language provides cryptography support via Java Security API with Java Cryptography Architecture (JCA) framework. The JCA standard specification is implemented by several Security providers namely., SunPKCS11, SunMSCAPI (Windows), BouncyCastle, RSA JSAFE, SafeNet further we can specify other types of security providers as well via., placing provider classes on the CLASSPATH, java.security configuration file with the provider, programmatically with the Security API addProvider and insertProviderAt factory methods.
Symmetric key encryption can be achieved by generating a shared key, specifying an initialization vector(IV) for encryption of plain block sequence, and Block ciper for plaintext to ciphertext taking in the key and the IV, final resulting in a byte[] of encrypted or decrypted text.
Asymmetric key encryption provides a key-pair ie., public key and private key for decryption and encryption respectively, along with MessageDigest confirming the integrity of the content of the message in transit by using, KeyPairGenerator with key generation algorithm, key size, ciper for encryption/decryption based on private key/public key and message digest hashed byte[] applied on the ciper for encryption for digital signature generation followed by verification of the decrypted message with the digital signature 

Disclaimer: 
This is a personal blog. Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in a professional or personal capacity, unless explicitly stated. Any views or opinions are not intended to malign any religion, ethnic group, club, organization, company, or individual. All content provided on this blog is for informational purposes only. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.
Downloadable Files and ImagesAny downloadable file, including but not limited to pdfs, docs, jpegs, pngs, is provided at the user’s own risk. The owner will not be liable for any losses, injuries, or damages resulting from a corrupted or damaged file.
  • Comments are welcome. However, the blog owner reserves the right to edit or delete any comments submitted to this blog without notice due to :
  • Comments deemed to be spam or questionable spam.
  • Comments including profanity.
  • Comments containing language or concepts that could be deemed offensive.
  • Comments containing hate speech, credible threats, or direct attacks on an individual or group.
The blog owner is not responsible for the content in the comments. This blog disclaimer is subject to change at any time.

Comments

Popular posts from this blog

Tech Conversant Weekly Jul 03 - Jul 15

Topic: General                                                                                                                                              Level: All Welcome to the world of cutting-edge technology! Every bi-week, we bring you the latest and most incredible advancements in the tech industry that are sure to leave you feeling inspired and empowered. Stay ahead of the game and be the first to know about the newest innovations shaping our world. Discover new ways to improve your daily life, become more efficient, and enjoy new experiences. This time, we've got some exciting news to share with you! Boosting Java startup with Class Data Sharing (CDS) https://www.youtube.com/watch?v=vvlQv1Dh-HU JDK21 LTS Maintenance and Support https://www.youtube.com/watch?v=3bfR22iv8Pc Health checking of multiple cloud applications with Spring Cloud Gateway https://spring.io/blog/2023/07/05/active-health-check-strategies-with-spring-cloud-gateway Functional Style Non-reactive HTTP clie

Tech Conversant Weekly Jun 19 - Jul 01

Topic: General                                                                                                                                              Level: All Welcome to the world of cutting-edge technology! Every bi-week, we bring you the latest and most incredible advancements in the tech industry that are sure to leave you feeling inspired and empowered. Stay ahead of the game and be the first to know about the newest innovations shaping our world. Discover new ways to improve your daily life, become more efficient, and enjoy new experiences. This time, we've got some exciting news to share with you! Modelling common behaviors between the List and the Set interface has been partially provided by LinkedHashSet. Now from JDK21 with the new interface SequencedCollection extending the Collection interface and is also extended by the List, SortedSet via SequencedSet (for reversal operation), Deque. The SequencedMap interface extends the Map interface by providing the below me

Microservices - Design Patterns

Topic: Software Design                                                                                                        Level: Intermediate Microservices - What? Microservice is a software design methodology, delegated to perform an isolated decoupled single functionality (following the Single-Responsibility Principle from object-oriented SOLID design principles).  Moreover, microservices by design, are decoupled making it easy to develop, test, maintain, deploy, configure, monitor and scale modules independently. Microservices - Why? Having one microservice would not be helpful without it being able to interact with other microservices, to aid in bringing an end-to-end business solution. So arises a question, how can I design a software system that is resilient, decentralized, fault-tolerant, scalable, maintainable, and extensible that complies with the microservice architecture? Design Patterns - What? Design patterns are solutions for commonly occurring problems within a given