Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
This file is part of Port@l Port@l 3.0 - Portal Engine and Management System Copyright (C) 2010 Isotrol, SA. http://www.isotrol.com Port@l 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. Port@l 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 Port@l. If not, see <http://www.gnu.org/licenses/>.
 
 
 package com.isotrol.impe3.test;
 
 
 import java.util.UUID;
 
 
IMPE3 Test Information Architecture.

Author(s):
Andres Rodriguez
 
 public final class TestContext extends AbstractTestModel {
 	private static final TestContext EMPTY = new TestIABuilder().get().get();
 
 	private final FileLoader fileLoader;
 	private final URIGenerator uriGenerator;
 
 	public static TestContext empty() {
 		return ;
 	}

Tries to loads and start a module in a empty context with fake dependencies.

Parameters:
module Module interface.
Returns:
The started module.
 
 	public static <T extends Module> T fakeStart(Class<T> module) {
 		final ModuleTester<T> tester = empty().getModule(module);
 		return tester.fakeStart();
 	}

Default constructor.

Parameters:
builder Builder.
 
 		super(builder.getPortal(), builder.getDevice(), builder.getLocale(), builder.getNodeRepositories());
 		final ImmutableMap<UUIDFileDatafiles = builder.getFiles();
 		this. = new AbstractFileLoader() {
 			protected FileData doLoad(UUID id) {
 				if (!files.containsKey(id)) {
 					throw new IllegalArgumentException();
 				}
 				return files.get(id);
 			}
 		};
 	}

Returns the file loader.
 
 	public FileLoader getFileLoader() {
 		return ;
 	}

Returns the URI generator.
 
 		return ;
 	}

Create a module tester for a type of module

Parameters:
<T> module class type
module module class
Returns:
module tester
 
 	public <T extends ModuleModuleTester<T> getModule(Class<T> module) {
		return new ModuleTester<T>(modulethis);
	}

Tries to autowire a module and access its provisions.

Parameters:
module Module class
	public <T extends Modulevoid autowireModule(Class<T> module) {
		final ModuleTester<T> tester = getModule(module);
		final ModuleDefinition<T> md = tester.getModuleDefinition();
		// If invalid, nothing to do
		if (md.getModuleType() == .) {
			return;
		}
		// Provide null dependencies.
			tester.put(d.getBeanName(), Proxies.alwaysNull(d.getType()));
		}
		// Provide null configuration
		}
		// Start module
		tester.start();
		// If a connector, we access services...
				try {
catch (RuntimeException e) {
					..println("Unable to access connector " + p.getBeanName());
					throw e;
				}
			}
else {
			// Components
				try {
catch (RuntimeException e) {
					..println("Unable to access component " + p.getBeanName());
					throw e;
				}
			}
			// Actions
			for (String action : md.getActions()) {
				try {
					tester.getAction(action);
catch (RuntimeException e) {
					..println("Unable to access action " + action);
					throw e;
				}
			}
		}
	}
New to GrepCode? Check out our FAQ X