Posts

Showing posts with the label GCP

GCP Datastore : Integration Testing using Spring Boot

In this article, I'll show you how you can create an in-memory datastore used by your tests. Configuring a Datastore Profile Testing Spring 3.1 introduced the bean definition profiles which can help us implementing an appropriate configuration for testing datastore staff. So, we'll have a specific profile for the GCP Datastore environment. Basically, the GCPDatastoreTester() class helps us saving data to the local in-memory datastore. Custom Annotation In order to support the population of test data for each test case, we will create an annotation in which you can add the JSON file name as argument. In the test execution listener, we'll check for the existence of the annotation and load the data accordingly. We'll use the annotation as follow : Implementing Custom TestExecutionListener The TestExecutionListener interface in the spring-test module defines a listener API for intercepting the events of the test case execution.  Process : ...

How to Deploy Microservices on Google Cloud

Today, I'll show you how you can deploy a multi module project on GAE using Maven. Because the EAR file is not allowed, we basically wrap our microservices inside a parent module (pom). Parent Module The parent module has its packaging tag set to  pom . All shared configuration will be placed inside the parent pom.xml via dependencyManagement or pluginManagement . As you probably know Maven provides the notion of aggregation by declaring submodules explicitly in the parent pom.xml. In the above configuration, I've declared 3 submodules (war). You can create the parent project with the following cmd: mvn archetype:generate -DgroupId=com.vedrax -DartifactId=parent-project PS: I'll soon register an archetype to generate the configuration as presented above with the required submodules. Submodules You can in the parent's directory run the following cmd: mvn archetype:generate -DgroupId=com.vedrax -DartifactId=company-service mvn archety...

Deploy Angular 2+ to GAE using Maven

Image
For a big project we have in my company, we needed to deploy an angular application (version 6) to the google cloud infrastructure (GAE). I'll show you step by step how you can deploy an angular application to the GAE by using Maven. My configuration: Java 8 and Maven 3.5 1. Create a GCP project Create a Google Cloud Project (GCP) through your Google Cloud Console . You will need the app ID for the following steps. You will need also to install the latest version of the App Engine SDK and add the directory to your PATH 2. Create a new project using maven command Go to the directory where you want to build the project and open a terminal at this location. On your terminal invoque this maven command to create an empty App Engine project: When prompted, you should accept default values (archetype, version...) and enter the groupId (your namespace), the artifactId (project name), version (accept default), package (accept default). When your project success...