Tomas Tulka's Blog
Random thoughts about programming and other stuff.
Talking about serverless microservices, functions are the basic building blocks of the service functionality. How to design them from the code and deployment perspektive?
Designing a system architecture is always about making tradeoffs. Microservices resp. serverless architecture has a lot of benefits, but some drawbacks as well. One of them is testing. Testing serverless systems is hard. In this article I will discuss some practices which work for my project.
Let's image an external standalone program producing a big amount of binary data. Good example is a files converter (images, mp3s, documents, etc).
How to design such a program and what are the pitfalls of the approach?
When one-thread-access is too restrictive, and we want to allow more threads to our resource then come semaphores on the stage.
But there is one important difference in these approaches.
It's recommended to avoid any asynchrony within the scope of test, but this is unfortunaly not possible everywhere. In some systems the caller must wait for another thread or transaction to be completed.
Testing asynchrony could be pretty tricky, not always is clear how long must a test wait for a result to be delivered - if it's too little the test fails event when the tested functionality works, if it's too long the test is just wasting time (so expensive especially in the commit stage).
So, how to deal with this problem?
Not everywhere could be immutable objects used to ensure thread-safe code.
Everyone knows the operation systems package manager like dpkg (from Debian) or RPM Package Manager (from RedHat).
Sometimes there is a need of such a management system in our own use.
The environment doesn't have to be an operation system, but for instance a web server or just a container application.
The manager must be able to manage package dependencies, versions and installation to the environment system.
This article will show you how to implement an Ant task which consume a sequence of sub-task and call them with a parameter of the result from the execution.
As an example we can consider a task taking a path to a directory as a parameter, fetching files in the directory and running a sequence of sub-task for each file.
The task will be implemented as a Java library.
I know, Ant is not the most modern technology, but there are still Ant-based systems we have to maintenance.
In the case of generic beans sometimes you need to get the generic type value for some specific reasons. A typical example could be parsing some data into the type.