Skip to content

01 building tcamt from sources

Sukchan Lee edited this page Apr 10, 2020 · 11 revisions

This post explains how to compile and install TCAMT from the source code on macOS Catalina

Prerequisites

Install Xcode command-line tools

Apple’s XCode includes command-line tools that are required by brew, and is available for free on the App Store. Make sure you are running the latest version.

$ xcode-select --install

Install Homebrew

OSX does not include the Homebrew package by default.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Getting MySQL with importing data

Install MySQL with package manager. It is used as database for the user account of both TCAMT and old-IGAMT.

$ brew install [email protected]

Start MySQL-Server. Note that it is persistent after rebooting.

$ brew services start [email protected]

Make sure the MySQL-Server is started.

$ pf -ef | grep mysql
  501   415     1   0  5:15PM ??         0:00.03 /bin/sh /usr/local/opt/[email protected]/bin/mysqld_safe --datadir=/usr/local/var/mysql
  501   593   415   0  5:15PM ??         0:03.23 /usr/local/opt/[email protected]/bin/mysqld --basedir=/usr/local/opt/[email protected] --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/[email protected]/lib/plugin --log-error=Sukchanui-MacBookPro.local.err --pid-file=Sukchanui-MacBookPro.local.pid

Create the igl schema in MySQL.

$ export PATH="/usr/local/opt/[email protected]/bin:$PATH"
$ mysql -u root
mysql> create database igl;
mysql> quit

Go the original DB server, and export MySQL using mysqldump command.

$ mysqldump -u root -p igl > Dump20200404.sql

In your local machine, import a default data using MySQL-Client program mysql.

$ mysql -u root igl < Dump20200404.sql

Verify that the data has been moved correctly.

$ mysql -u root igl
mysql> select count(*) from Account;
+----------+
| count(*) |
+----------+
|        3 |
+----------+
1 row in set (0.01 sec)

mysql> quit

Getting MongoDB with importing data

Install MongoDB with package manager. It is the main database for IGAMT, old-IGAMT and TCAMT.

$ brew tap mongodb/brew
$ brew install [email protected]

Start MongoDB-Server. Note that it is persistent after rebooting.

$ brew services start [email protected]

Make sure the MongoDB-Server is started.

$ pf -ef | grep mongod
  501   399     1   0  5:15PM ??         0:43.48 /usr/local/opt/mongodb-community/bin/mongod --config /usr/local/etc/mongod.conf

Go the original DB server, and export MongoDB using mongodump command.

$ mongodump --out=/tmp/dump/

In your local machine, import a default data using MongoDB-Client program mongorestore.

$ mongorestore --db igamt-user /tmp/dump/igamt-user
$ mongorestore --db igamt /tmp/dump/igamt
$ mongorestore --db igamt-hl7 /tmp/dump/igamt-hl7
$ mongorestore --db tcl /tmp/dump/tcl

Verify that the data has been moved correctly.

$ mongo
> use igamt-user
> db.account.count();
1

Downloading source code from Github

Git clone.

$ git clone https://github.com/usnistgov/tcamt-2.git
$ cd tcamt-2

Frontend Development

The part of a website that user interacts with directly is termed as front end. It is also referred to as the client side of the application.

Install Node.js and NPM

Node.js is a JavaScript-based environment which you can use to create web-servers and networked applications. You can also use it to perform helpful tasks on your computer such as concatenating and minifying JavaScript files and compiling Sass files into CSS.

NPM is a package manager that makes installing Node packages fast and easy. A package, also called a module, is just a code library that extends Node by adding useful features. For example, the request module simplifies the process of making HTTP requests so you can easily get web resources from other sites.

NPM is installed when you install Node.js. Installing Node.js and NPM is pretty straightforward using Homebrew.

$ brew install node

Make sure you have Node and NPM installed by running simple command to see what version of each is installed:

$ node -v
v13.12.0
$ npm -v
6.14.4

Install Bower

Bower is a package manager for the web. To install bower open terminal and type the following command.

$ npm install -g bower

To check which version of bower is installed type the following command in the terminal.

$ bower -v
1.8.8

Install Ruby for using Compass

Compass is an open source CSS Authoring Framework and it is used by both old-IGAMT and TCAMT.

To use Compass, we need to install Ruby like the following:

$ brew install ruby

This should install the latest Ruby version.

Install Grunt

Grunt is the JavaScript Task Runner. Use the following command in the terminal to install Grunt globally.

$ npm install -g grunt-cli

Build Front-end Source Code

To build with Grunt:

$ cd tcamt-lite-client
$ bower install
$ npm install
$ gem install compass
$ grunt build

Backend Development

Backend is server side of the website. It stores and arranges data, and also makes sure everything on the client-side of the website works fine.

Install Java Development Kit(JDK)

Oracle’s recent changes to Java licensing have meant that many enterprises are re-evaluating their requirements for a stable Java distribution with reliable support at a reasonable cost.

Therefore, we install AdoptOpenJDK provided by an open community.

$ brew tap adoptopenjdk/openjdk
$ brew cask install adoptopenjdk8

Make sure java is installed.

$ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)

Install Apache Maven

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

Run the follwing command on Terminal

$ brew install maven

Check the version using mvn.

$ mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 13.0.2, vendor: N/A, runtime: /usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.4", arch: "x86_64", family: "mac"

Install Apache Tomcat

The Apache Tomcat software is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies. The Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket specifications are developed under the Java Community Process.

Install tomcat using package manager:

$ brew install tomcat

Configure the resource for the Tomcat to access MySQL. Add the JDBC resource configuration to the file located in /usr/local/Cellar/tomcat/9.0.33/libexec/conf/context.xml.

$ diff -u context_old.xml context_new.xml
--- context_old.xml	2020-04-07 11:38:56.668013873 -0400
+++ context_new.xml	2020-04-06 19:59:14.992543186 -0400
@@ -28,4 +28,9 @@
     <!--
     <Manager pathname="" />
     -->
+    <Resource name="jdbc/igl_jndi" auth="Container"
+        type="javax.sql.DataSource" maxActive="100"
+        maxIdle="30" maxWait="10000" username="root" password=""
+        driverClassName="com.mysql.jdbc.Driver"
+        url="jdbc:mysql://localhost:3306/igl"/>
 </Context>

Installing Eclipse-JEE

Eclipse is an integrated development environment (IDE) used in computer programming, and is the most widely used Java IDE. It contains a base workspace and an extensible plug-in system for customising the environment. Eclipse is written mostly in Java and its primary use is for developing Java applications, but it may also be used to develop applications in other programming languages via plug-ins.

The following is the single command required to install Eclipse IDE on macOS using Homebrew.

$ brew cask install eclipse-jee

Start building TCAMT from the source code

First, click on the icon to run eclpise-jee

1. Select the workspace directory and press the Launch Button.

IDE-launcher

2. Close the Welcome screen as shown below:

welcome

3. Choose File->Import

file-import

4. On Import Window, select Existing Maven Project.

existing-maven-project

5. Use the Browser button to select the github repository for TCAMT.

maven-browser project_open

6. Make sure all projects are selected and press the Finish button.

import-maven-project

7. Check Status Bar and wait for it.

wait-status-bar

8. Choose 7 Maven Install in the Project->Run As

maven-install

9. Make sure every project is SUCCESS.

check-maven-install

10. Click the link in the Server tab to start configuring Tomcat.

server-tab

11. Select Tomcat v9.0 Server and Press the Next Button.

new-server-next

12. Use the Browser button to specify where Tomcat is installed.

tomcat-brower tomcat-open tomcat-finish

13. Right clink on the added Tomcat v9.0 Server at localhost and select Add and Remove Button.

add-remove-server

14. Move tcamt-list-controller to the right to configure them on the server.

add-server add-server-finish

15. Start Tomcat Server

start-server check-server

16. Go to http://localhost:8080/tcamt using your web browser.

connect-to-server

17. Login with Username tcamt and Password Q1w2e3r4.

login

18. If your development environment is installed properly, Test Plans are displayed as follows.

check-ui

Uninstalling TCAMT on MacOSX

$ brew services stop [email protected]
$ brew uninstall [email protected]
$ rm -Rf /usr/local/var/mysql
$ rm -Rf /usr/local/etc/my.cnf*
$ brew services stop [email protected]
$ brew uninstall [email protected]
$ brew uninstall tomcat
$ brew uninstall maven
$ brew cask uninstall adoptopenjdk8
$ brew cask uninstall eclipse-jee
$ rm -Rf ~/.eclipse
$ rm -Rf ~/.m2
$ rm -Rf eclipse-workspace
Clone this wiki locally