creating adjudicators in a war computer science innovations, llc
Post on 16-Jan-2016
221 Views
Preview:
TRANSCRIPT
Creating Adjudicators in a WAR
Computer Science Innovations, LLC
Setup
Make sure /cloud project is downloaded Start up eclipse and open it in cloud directory
(something like /home/scott/cloud) ssh -X ubuntu@123.45.111 to be able to open X
sessions if doing this on cloud [Screenshot]
Setup (Eclipse)
Close front window and right click on left to open a New Project
[Screenshot]
Setup (Eclipse)
Title the project cloud and hit Finish [Screenshot]
Setup (Eclipse)
Screen should look like below [Screenshot]
Setup (Eclipse)
Click Yes to include java perspective [Screenshot]
Setup (Eclipse)
Go to util/src/cloud/LoadRestfulWebService.java
[Screenshot]
LoadRestfulWebService Explained
Typical protocols
– Http, https, REST, JSON, 1-way SSL (https), 2-way SSL (https with identity assertion)
LoadRestfulWebService
– Uses RESTful service to load users, groups, and roles
– Calls cloud application and loads data into SOLR
LoadRestfulWebService Explained
Main() adds roles, groups, and users AddUser(), AddRoles(), AddGroups()
– Gets properties from properties file
– Gets URI information to fill in user data• Category is 'table name'
– Sends data to servlet that writes to SOLR GetProperties()
– Gets data from load.properties
– Files are either on the web or off the classpath, load.properties is off classpath
JSONUpdateServlet
Go to cloud-war/src/java/cloud/servlets/JSONUpdateServlet.java
[Screenshot]
JSONUpdateServlet
Takes data from URI that is sent RESTfully and writes it to SOLR
WriteToSOLR() already exists and should be used to write to SOLR
Where to Start?
Cloud-functional-tests/src/TestAdd.java [Screenshot]
TestAdd.java
Test program that goes to SOLR, makes a request
– JUNIT test uses asserts to see if the test passes or fails. If assert line is true, test works, if not, then test does not work.
Seeing if cloud works
Go to cloud/cloud/solr.solr.home/collection1/data and do an rm -rf *
Go to terminal, start tomcat with 'st' In other window, cd to /cloud/cloud and type:
ant deploy [Screenshot]
Seeing if cloud works
In cloud/cloud do:
ant run-clear-index
ant run-load-web-service In browser go to:
localhost:8080/cloud/select?q=*:*&rows=100
[Screenshot]
Cloud Project Continued
You have to add a login module to cloud
– Already added in for you Files to take from adjudicator_software folder
in content.scottstreit.com/compsec
– Jaas.config goes in tomcat config directory
– RolePrincipal.java
– SolrLoginModule.java• It gets called in web.xml
– There are security constraints and login-configs in web.xml
SolrLoginModule
SolrLoginModule.java• It gets called in web.xml
– There are security constraints and login-configs in web.xml
– <auth-method>BASIC</auth-method> for login-config
Cloud Project Continued
You have to add a login module to cloud
– Already added in for you Files to take from adjudicator_software folder
in content.scottstreit.com/compsec
– Jaas.config goes in tomcat config directory
– RolePrincipal.java
– SolrLoginModule.java• It gets called in web.xml
– There are security constraints and login-configs in web.xml
JUNIT Test Attempt
In cloud/cloud run the following:
ant run-tests [Screenshot]
JUNIT Test Attempt
Go to /cloud/cloud/cloud-functional-tests/classes and open the TestAdd.xml file inside the folder
[Screenshot]
top related