Continuous Enterprise Development in Java

Continuous Enterprise Development in Java

by Andrew Lee Rubinger, Aslak Knutsen


View All Available Formats & Editions
Choose Expedited Shipping at checkout for delivery by Tuesday, August 10


Learn a use-case approach for developing Java enterprise applications in a continuously test-driven fashion. With this hands-on guide, authors and JBoss project leaders Andrew Lee Rubinger and Aslak Knutsen show you how to build high-level components, from persistent storage to the user interface, using the Arquillian testing platform and several other JBoss projects and tools.

Through the course of the book, you’ll build a production-ready software conference tracker called GeekSeek, using source code from GitHub. Rubinger and Knutsen demonstrate why testing is the very foundation of development—essential for ensuring that code is consumable, complete, and correct.

  • Bootstrap an elementary Java EE project from start to finish before diving into the full-example application, GeekSeek
  • Use both relational and NoSQL storage models to build and test GeekSeek’s data persistence layers
  • Tackle testable business logic development and asynchronous messaging with an SMTP service
  • Expose enterprise services as a RESTful interface, using Java EE’s JAX-RS framework
  • Implement OAuth authentication with JBoss’s PicketLink identity management service
  • Validate the UI by automating interaction in the browser and reading the rendered page
  • Perform full-scale integration testing on the final deployable archive

Related collections and offers

Product Details

ISBN-13: 9781449328290
Publisher: O'Reilly Media, Incorporated
Publication date: 04/07/2014
Pages: 256
Product dimensions: 6.90(w) x 9.10(h) x 0.60(d)

About the Author

As Senior Software Engineer at JBoss, a Division of Red Hat, Andrew Lee Rubinger is primarily responsible for development of the company's EJB 3.x implementation. He was an early adopter of Java EE technologies and an active contributor in the tech community.

Aslak Knutsen, the project lead of Arquillian, is a Senior SoftwareEngineer at JBoss, by Red Hat. He’s involved in projects such asArquillian, ShrinkWrap, Weld and Seam 3, one of the founders of theJBoss Testing initiative and a speaker at major industry conferencesincluding Devoxx, JavaOne, Jazoon, JFokus, and Geecon.

Table of Contents

Foreword vii

Preface ix

1 Continuity 1

The Zen of Prevention 1

Reactive Error Handling 1

Proactive Quality Policies 2

Software Development Processes 2

Serial Models 3

Iterative Models 3

Testing Is Development 5

Levels of Testing 5

Unit 6

Integration 7

Foundation Test Frameworks 8

JUnit 10

TestNG 12

Continuous Development 13

2 Enabling Technologies 15

Bootstrapping 15

Apache Maven 16

JBoss Forge 17

Version Control 18

Git 19

A Test Platform for Java EE 20

Arquillian 21

ShrinkWrap 22

ShrinkWrap Resolvers 27

Experimental Features 35

Runtime 37

WildFly 37

OpenShift 38

On to the Code 38

3 Scratch to Production 39

The Development Environment 39

A New Project 40

Writing Our First Integration Test with Arquillian 48

Running the Application Locally 51

Running the Arquillian Integration Test 53

Deploying to OpenShift via JBoss Developer Studio 55

4 Requirements and the Example Application 63

Introducing GeekSeek 64

Featureset 64

Conceptual Data Model 65

Logical Data Model 66

Obtaining, Building, Testing, and Running GeekSeek 68

Use Cases and Chapter Guide 73

Chapter 5 Java Persistence and Relational Data 73

Chapter 6 NoSQL: Data Grids and Graph Databases 73

Chapter 7 Business Logic and the Services Layer 74

Chapter 8 REST and Addressable Services 74

Chapter 9 Security 74

Chapter 10 UI 75

Chapter 11 Assembly and Deployment 75

5 Java Persistence and Relational Data 77

The Relational Database Model 79

The Java Persistence API 81

POJO Entities 82

Use Cases and Requirements 83

User Perspective 84

Technical Concerns 84

Implementation 85

Entity Objects 86

Repository EJBs 91

Requirement Test Scenarios 93

Test Setup 93

CRUD Tests 95

6 NoSQL: Data Grids and Graph Databases 101

RDBMS: Bad at Binary Data 102

Data Grids 103

RDBMS: Bad at Relationships 104

Graph Theory 105

Use Cases and Requirements 107

Implementation 107

Attachment 107

Relation 111

Requirement Test Scenarios 119

Attachment CRUD Tests 120

Transactional Integrity of Attachment Persistence 123

Validating Relationships 127

7 Business Logic and the Services Layer 131

Use Cases and Requirements 132

Send Email on New User Signup 133

Implementation 134

Requirement Test Scenarios 139

A Test-Only SMTP Server 140

The Test 142

8 REST and Addressable Services 149

REST in Enterprise Java: The JAX-RS Specification 152

Use Cases and Requirements 154

Implementation 157

Repository Resources 157

The Representation Converter 151

The @ResourceModel 153

LinkableRepresentation 154

ResourceLink 157

Requirement Test Scenarios 168

A Black-Box Test 159

Validating the HTTP Contracts with Warp 171

Arquillian Warp 171

Test Harness Setup 173

The HTTP Contracts Test 174

9 Security 177

Use Cases and Requirements 178

Implementation 178

Supporting Software 178

Requirement Test Scenarios 186

Overview 187

Setup 187

Security Tests 188

10 The User Interface 197

Use Cases and Requirements 197

Implementation 198

Requirement Test Scenarios 201

Pure JavaScript 201

Functional Behavior 203

11 Assembly and Deployment 211

Obtaining JBoss EAP 211

Running Against JBoss EAP 213

Using the EAP Remote Container 213

Using the EAP Managed Container 215

Continuous Integration and the Authoritative Build Server 218

Configuring the GeekSeek Build on CloudBees 218

Populating CloudBees Jenkins with the EAP Repository 220

Automatic Building on Git Push Events 223

Pushing to Staging and Production 224

Setting Up the OpenShift Application 224

Removing the Default OpenShift Application 227

Pushing from the CI Build Job to OpenShift 227

12 Epilogue 231

Index 233

Customer Reviews