Posts

A quick intro to MongoDB

Image
  In this blogpost we are going to take a quick look at one of the most popular peaces of modern technology, MongoDB. What is MongoDB? MongoDB is an open source, NoSql, non-relational, schema-less, document-oriented data base. In Mongo, data is organised in a Binary Json document format which is called a Collection. The basic differences between Mongo and a relational data base such as PostgreSQL can be summarised as: Collections INSTEAD OF Tables Documents INSTEAD OF Rows Fields INSTEAD OF columns Installation and Interface. MongoDB can be downloaded from their official website . If you are on a Mac, you can easily use the Homebrew  package manager.  Once the installation is completed just start the MongoDB service to initiate a local DB server. Connecting to the DataBase. To start using my database, I'm going to use a client called RoboMongo (Robo 3T) which can be downloaded from this link Once the client is installed, we can begin by connecting to our DataBase. To initiate a new

Introducing - the DOM

Image
  No, not that one... That one! If you are into UI automation like myself, then you probably heard about this DOM thingy everyone is talking about, right? Well, In this article we are going to take a slightly deeper look into what is known as the Document Object Model. A quick introduction Quite often we address the DOM in terms of the page source of our AUT (Application under test). But, DOM is actually a language -independant interface for treating XML and HTML documents. That Interface offers the document as a tree of objects. Well, we are into the Test-Automation stuff, so let's stick to the HTML part. In the WEB world, the DOM would be referred to as the browsers programatic representation of the web page. An API if you will, for dealing with and manipulating the HTML without actually going in and changing it manually. The interface specification is standartized by the W3C. Using this API we can build, navigate through, add or modify a document and its content. For example, wh

Access modifiers in Java

Image
  "Which access modifiers are you familiar with and what is the difference between them?" This is a very common interview question, that can at times catch a candidate off guard. In this post, we will discuss the different access modifiers available in Java, and the differences between them. In Java, there are 4 main access modifiers that are basically reserved keyword which allow us to control access to fields, methods and classes from other entities. Confused? Let's see if we can clear things up a bit. Public The public keyword means that this class/member/method can be accessed from anywhere. And by anywhere I mean that any class, package, method can access the field defined as public. Private The private modifier limits the access of a particular member/method to the specific class where it was initialised or declared. The private keyword cannot be applied to classes. Protected Protected means that the member will be accessible within that paticular class, within the

Build your own REST API from scratch - Part 2

Image
In the previous article we have created a basic skeleton for our RESTful API.  In this part we are going to crack it up a notch by building an actual useful endpoint, status codes, change the static message to a better mechanism, build our controllers, and see how we can retrieve actual useful data via an API call. Ready? Let's keep coding. For starters, let's change focus by deciding that we are building an Ice Cream shop API.  WOW, just the thought of that made me hungry... Oh well, back to work. so the first thing we want to do is to change the static hello message we retrieved to some actual content. For that, we are going to: Create a JSON data file Our JSON file will contain an array of objects containing our menu items. We will place this file in a sub-directory in our project which we will call menu_data. Next up, let's create a separate module to handle our Ice cream menu get method. I will call it iceCream.js and place in an additional directory in our project whi

Build and publish your own Image with Docker and Artifactory

Image
The true power of docker, having the ability to pack and ship your application, so others could run unlimited amount of containers based on our Image that contains our application code. In this post we are going to build our own docker image from scratch, and publish it to a remote repository. Define the flow A standard flow of packaging and shipping our app would look something like this: 1. Create a Dockerfile which will contain our set of layers and "instructions" for designing our image. 2. Build the image which will serve as a "Master template" for our application containers. 3. Publish our build to a repository so others could pull and run containers from our Image.  (In our example we are going to uje JFrog Artifactory.) Let's get to work... 1. Create a Dockerfile. A Dokcerfile is basically a text file that contains a set of commands which will assemble our Image. (An Image is much like a base template). For this example, we will build a simple "Hell