Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * OfficeFloor - http://www.officefloor.net
   * Copyright (C) 2005-2011 Daniel Sagenschneider
   *
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package net.officefloor.compile.impl.officefloor;
 
Tests loading a net.officefloor.frame.api.execute.Task.

Author(s):
Daniel Sagenschneider
 
 public class LoadTaskTest extends AbstractOfficeFloorTestCase {

 
 	private final WorkFactory<WorkworkFactory = this.createMockWorkFactory();

 
 	private final TaskFactory<Work, ?, ?> taskFactory = this
Ensure can load a simple net.officefloor.frame.api.execute.Task.
 
 	public void testLoadSimpleTask() {
 
 		// Record loading the task
 		this.record_officefloor_addTeam("OFFICE_FLOOR_TEAM");
 		OfficeBuilder officeBuilder = this
 		officeBuilder.registerTeam("OFFICE_TEAM""OFFICE_FLOOR_TEAM");
 		this.record_office_addWork("SECTION.WORK"this.);
 		TaskBuilder<?, ?, ?> taskBuilder = this.record_work_addTask("TASK",
 				this.);
 		taskBuilder.setTeam("OFFICE_TEAM");
 
 		// Loads the office floor with a simple task
 		this.loadOfficeFloor(truenew OfficeFloorMaker() {
 			public void make(OfficeFloorMakerContext contextthrows Exception {
 				OfficeFloorDeployer deployer = context.getDeployer();
 
 				// Add an office with a team
 				DeployedOffice office = context.addOffice("OFFICE",
 						new OfficeMaker() {
 							public void make(OfficeMakerContext context) {
 								OfficeArchitect architect = context
 
 								// Add the section with a team
 								OfficeSection section = context.addSection(
 										"SECTION"new SectionMaker() {
 											public void make(
 													SectionMakerContext context) {
 												context.addTask("WORK",
 														"TASK",
 														null);
 											}
 										});
 
 								// Link in team responsible for task
 								architect.link(section.getOfficeTasks()[0]
 										.getTeamResponsible(), architect
 										.addOfficeTeam("OFFICE_TEAM"));
 							}
 						});
 
 				// Specify team responsible for task
 				deployer.link(office.getDeployedOfficeTeam("OFFICE_TEAM"),
						context.addTeam("OFFICE_FLOOR_TEAM"null));
			}
		});
	}
New to GrepCode? Check out our FAQ X