Sei sulla pagina 1di 2

DEVELOPMENT TEAM EXERCISES

Senior JEE Developer Exercise


Use Case: Auditing is an important cross cutting services in most enterprise web applications. The
purpose of this exercise is to demonstrate your knowledge of JSF and EJBs to implement a very simple
audit inceptor that logs the user who made a change to a database record. The JBoss Application Server
Wildfly and MySQL must be used to complete this exercise. Project must be deployed on RedHat open
shift. Once complete, you will conduct a 30 minute Webex to present solution at your convenience.

You will build and deploy a very simple web application that contains two JSF forms.

A login form (login.xhtml) which collects a username and password.


A hobby form (userhobby.xhtml) that collects a users name and their hobby and stores it in the
database.

You will create user and userrole tables in the MySQL database. These tables contains the users
username and password required to login. You must configure JBoss AS to use form based login to
authenticate a user. If the user supplies a valid username and password create a session scoped
UserContext object which contains the users username, email and their roles. Use this object to provide
information to an audit inceptor that is used to log the user that inserts a hobby object in the database.

Note: An Interceptor must be used to complete this exercise.

Software Required: To complete this exercise the following software is required.

JBoss Developer Studio 9+


JBoss Wildfly 10 Application Server
MySQL 5.7

Task: The activities below describe the task to be performed.

Using MySQL Implement three tables. The SQL script is provided below.
create table user (
user_id bigint auto_increment,
email varchar(40),
username varchar(12),
password varchar(20)
);
primary key(user_id);
create table userrole (
role_id bigint auto_increment,
user_id bigint not null,
rolename varchar(20) not null,
);
primary key (role_id);
foreign key (user_id) references user (user_id);
create table userhobby (

COPYRIGHT 2016 ATWORK SYSTEMS, INC. 1


DEVELOPMENT TEAM EXERCISES

id bigint auto_increment,
name varchar(10) not null,
hobby varchar(20) not null,
createdBy varchar(40) not null,
createdOn DateTime not null,
);
primary key (id);
Create sample data for the user and userrole tables and insert it into the database.
Configure the JBoss application server to implement a security realm using the user and userrole
database tables.
Configure the JBoss application server to implement form based login.
Create the login.xhtml and userhobby.xhtml forms and the server side components that will be
required to process them.
Deploy the web application to the application server.
Launch the login form, collect the username and password and submit the form. When a user
successfully logins by providing a valid username and password, create a session scoped
UserContext EJB that contains the users username, email and list of roles. This information must
be obtained from the database user and userroles tables.
Launch the hobby form, collect and submit the form which saves this data in the database.
During the process of saving the hobby object implement a simple audit Inceptor that examines
the UserContext and populates the createdBy and createdOn columns of the hobby table.

Time Limit: This task should be completed in 4 hours or less.

Deliverable: An eclipse project which demonstrates this functionality checked in to Github.

COPYRIGHT 2016 ATWORK SYSTEMS, INC. 2

Potrebbero piacerti anche