本文整理汇总了Java中org.apache.tapestry5.ioc.services.SymbolSource类的典型用法代码示例。如果您正苦于以下问题:Java SymbolSource类的具体用法?Java SymbolSource怎么用?Java SymbolSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SymbolSource类属于org.apache.tapestry5.ioc.services包,在下文中一共展示了SymbolSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGenerator
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
@Before
public void createGenerator() {// Setup
generator = new TriangleLoadGenerator(
LoggerFactory.getLogger(TriangleLoadGenerator.class),
"TriangleLoadGenerator",
registry.getService(TypeCoercer.class),
registry.getService(SymbolSource.class).valueForSymbol(
IterSymbolsNames.TRACEGENERATOR_URL),
"http://www.inf.usi.ch/phd/gambi/attachments/autocles/doodle-clients.jmx",
"", // ampliBounds - 50 to 100 clients
50.0, 100.0,
// period Bounds - 1 to 5 minutes
60.0, 300, //
100, // nBins
new RandomInputSampler(), 300);
}
示例2: setup
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
@Before
public void setup() throws MatlabConnectionException,
MatlabInvocationException {
// I suspect that this will open a new matlab !
dao = new MatlabControlImpl(
LoggerFactory.getLogger(MatlabControlImpl.class),
registry.getService(RegistryShutdownHub.class), registry
.getService(SymbolSource.class).valueForSymbol(
IterSymbolsNames.GPML_DIR), registry
.getService(SymbolSource.class).valueForSymbol(
IterSymbolsNames.ITER_DIR), 10, 0.00001,
0.0001, new double[] { 0.0, 0.0, 0.0, 0.0 }, new double[] {
10.0, 10.0, 10.0, 10.0 }, 10,
"src/test/resources/iter-matlab.log");
}
示例3: setupOctaveEngine
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
@BeforeClass
public static void setupOctaveEngine() {
RegistryBuilder builder = new RegistryBuilder();
// IOCUtilities.addDefaultModules(builder);
builder.add(IterModule.class);
registry = builder.build();
registry.performRegistryStartup();
//
typeCoercer = registry.getService(TypeCoercer.class);
traceGeneratorWebService = registry.getService(SymbolSource.class)
.valueForSymbol(IterSymbolsNames.TRACEGENERATOR_URL);
loadGenerator = new SinusLoadGenerator(
LoggerFactory.getLogger(LoadGenerator.class),
"SinusLoadGenerator", typeCoercer, traceGeneratorWebService,
testFile, manifestFile, 0.0, 30.0, 0.0, 0.01, //
100, // nBins
registry.getService("RandomSinusLoadGenerator",
InputSampler.class), 300);
dataCollectionService = registry
.getService(DataCollectionService.class);
mathEngineDao = registry.getService("matlab", MathEngineDao.class);
}
示例4: addApplicationConfigModule
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
@Contribute(ModuleManager.class)
public static void addApplicationConfigModule(
final MappedConfiguration<String, JavaScriptModuleConfiguration> configuration, final SymbolSource symbolSource,
@Symbol(SymbolConstants.PRODUCTION_MODE) final boolean productionMode) {
final JSONObject config = new JSONObject();
for (String symbolName : new String[] { SymbolConstants.CONTEXT_PATH, SymbolConstants.EXECUTION_MODE,
SymbolConstants.PRODUCTION_MODE, SymbolConstants.START_PAGE_NAME, SymbolConstants.TAPESTRY_VERSION,
SymbolConstants.SUPPORTED_LOCALES }) {
String value = symbolSource.valueForSymbol(symbolName);
config.put(symbolName, value);
}
config.put("react-api-path", ReactAPIFilter.path);
StringBuilder sb = new StringBuilder();
sb.append("define(");
sb.append(config.toString(productionMode));
sb.append(");");
final byte[] bytes = sb.toString().getBytes(StandardCharsets.UTF_8);
configuration.add("eddyson/react/application-config", new JavaScriptModuleConfiguration(new VirtualResource() {
@Override
public InputStream openStream() throws IOException {
return new ByteArrayInputStream(bytes);
}
@Override
public String getFile() {
return "application-config.js";
}
@Override
public URL toURL() {
return null;
}
}));
}
示例5: BootstrapJavaScriptStack
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
public BootstrapJavaScriptStack(final AssetSource assetSource, final SymbolSource symbolSource) {
this.jsStack = CollectionFactory.newList();
jsStack.add(0, assetSource.getContextAsset("scripts/jquery.noconflict.js", null));
jsStack.add(0, assetSource.getClasspathAsset("classpath:/META-INF/resources/webjars/jquery/1.8.3/jquery.min.js"));
jsStack.add(assetSource.getClasspathAsset("classpath:/META-INF/resources/webjars/bootstrap/3.0.2/js/bootstrap.min.js"));
jsStack.add(assetSource.getContextAsset("scripts/lib/plugins/jquery.cookie.js", null));
jsStack.add(assetSource.getContextAsset("scripts/script.js", null));
this.cssStack = CollectionFactory.newList();
cssStack.add(new StylesheetLink(assetSource.getClasspathAsset("classpath:/META-INF/resources/webjars/bootswatch/3.0.0/spacelab/bootstrap.min.css")));
cssStack.add(new StylesheetLink(assetSource.getContextAsset("styles/style.css", null)));
cssStack.add(new StylesheetLink(assetSource.getContextAsset("styles/t5-override.css", null)));
}
示例6: contributePropertiesFileAsSymbols
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
@Contribute(SymbolSource.class)
public void contributePropertiesFileAsSymbols(
OrderedConfiguration<SymbolProvider> configuration) {
configuration.add("DatabaseConfiguration",
new ClasspathResourceSymbolProvider("database.properties"),
"after:SystemProperties", "before:ApplicationDefaults");
}
示例7: createGenerator
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
@Before
public void createGenerator() {// Setup
generator = new SinusLoadGenerator(
LoggerFactory.getLogger(SinusLoadGenerator.class),
"SinusLoadGenerator",
registry.getService(TypeCoercer.class),
registry.getService(SymbolSource.class).valueForSymbol(
IterSymbolsNames.TRACEGENERATOR_URL),
"http://www.inf.usi.ch/phd/gambi/attachments/autocles/doodle-clients.jmx",
"", 1.0, 30.0, 0.0, 0.001, //
100, // nBins
new RandomInputSampler(), 300);
}
示例8: createGenerator
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
@Before
public void createGenerator() {// Setup
generator = new ConstantLoadGenerator(
LoggerFactory.getLogger(ConstantLoadGenerator.class),
"ConstantLoadGenerator",
registry.getService(TypeCoercer.class),
registry.getService(SymbolSource.class).valueForSymbol(
IterSymbolsNames.TRACEGENERATOR_URL),
"http://www.inf.usi.ch/phd/gambi/attachments/autocles/doodle-clients.jmx",
"", 10.0, 400.0,//
100, // nBins
new RandomInputSampler(), 300);
}
示例9: generateSinusTestCase
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
@Test
public void generateSinusTestCase() {
generator = new SinusLoadGenerator(
LoggerFactory.getLogger(LoadGenerator.class),
"SinusLoadGenerator",
registry.getService(TypeCoercer.class),
registry.getService(SymbolSource.class).valueForSymbol(
IterSymbolsNames.TRACEGENERATOR_URL),
"http://www.inf.usi.ch/phd/gambi/attachments/autocles/doodle-clients.jmx",
"", 1.0, 30.0, 0.0, 0.001, //
100, // nBins
registry.getService("RandomSinusLoadGenerator",
InputSampler.class), 300);
generator.generateRandomCase();
}
示例10: contributeCLIParser
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
/**
* Define the CLI Options for ITER. Configurations for LOADGenerator are in
* the load generator module.
*
* @category Contribution
*/
public void contributeCLIParser(SymbolSource symbolSource,
Configuration<CLIOption> configuration) {
configuration.add(new CLIOption("c", "customer-name", 1, true,
"Customer name."));
configuration.add(new CLIOption("s", "service-name", 1, true,
"Service name"));
configuration.add(new CLIOption("m", "service-manifest-URL", 1, true,
"URL of the Service manifest file"));
configuration.add(new CLIOption("j", "jmeter-clients-URL", 1, true,
"URL of the JMeter file"));
// Test Execution setting. With defaults
CLIOption nParallelTests = new CLIOption("N", "n-parallel-tests", 1,
false, "Maximum number of parallel test executions.");
nParallelTests.setDefaultValue("1");
configuration.add(nParallelTests);
CLIOption nInitialRandomTests = new CLIOption("r",
"n-initial-random-tests", 1, false,
"Number of initial random tests.");
nInitialRandomTests.setDefaultValue("0");
configuration.add(nInitialRandomTests);
// Search configuration
CLIOption nBestTests = new CLIOption("n", "n-best-tests", 1, false,
"Maximum number of best expected improvement");
nBestTests.setDefaultValue("1");
configuration.add(nBestTests);
configuration.add(new CLIOption("b", "bootstrap", 0, false,
"Enable boostrap from input file."));
// Note this trick! Using the empty string is a good default for having
// not mandatory options. At least from the point of view of the
// Registry startup
CLIOption inputFile = new CLIOption("i", "input-file", 1, false,
"Input file.");
inputFile.setDefaultValue(symbolSource
.valueForSymbol(IterSymbolsNames.INPUT_FILE));
configuration.add(inputFile);
CLIOption outputFile = new CLIOption("o", "output-file", 1, false,
"The result file produced as output.");
outputFile.setDefaultValue(symbolSource
.valueForSymbol(IterSymbolsNames.TEST_RESULTS_FILE));
configuration.add(outputFile);
CLIOption evolveWith = new CLIOption("e", "evolve-with", 1, false,
"The name of the Strategy used to evolve the test suite.");
evolveWith.setDefaultValue("default");
configuration.add(evolveWith);
}
示例11: buildMatlabControl
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
/**
* @category Build matlab Singleton
*/
@Scope(ScopeConstants.DEFAULT)
@ServiceId("matlab")
public MathEngineDao buildMatlabControl(
Logger logger,
// Force the LoadGenerator to be injected BEFORE the matlab is
// constructed !!
@InjectService("CommandLineLoadGenerator") LoadGenerator loadGenerator,
RegistryShutdownHub registryShutdownHub, SymbolSource symbolSource,
TypeCoercer typeCoercer,
@Symbol(IterSymbolsNames.GPML_DIR) String gpmlDir,
@Symbol(IterSymbolsNames.ITER_DIR) String iterDir,
@Symbol(IterSymbolsNames.PROBLEM_SIZE) int problemSize,
@Symbol(IterSymbolsNames.TOLERANCE) double tol,
@Symbol(IterSymbolsNames.MIN_EI) double minEI,
@Symbol(IterSymbolsNames.N_BINS) int nBins,
@Symbol(IterSymbolsNames.MATLAB_LOG_FILE) String matlabLogFile
) throws MatlabConnectionException, MatlabInvocationException {
// TODO We need this trick because load generator NEEDS a couple of
// symbols BEFORE this service gets instantiated
// so Injecting those symbols before hand won't work. Maybe a
// ShadowProperty is the best approach, but for the moment we adopt the
// following
// 1) Force the proxy to instantiate the object by invoking some method
// on it
loadGenerator.generateRandomCase();
// 2) Use the inject SymbolSource (not the SYMBOLS!) and TypeCoercer to
// recover the values we are looking for
double[] LB = typeCoercer.coerce(
symbolSource.valueForSymbol(IterSymbolsNames.LB),
double[].class);
double[] UB = typeCoercer.coerce(
symbolSource.valueForSymbol(IterSymbolsNames.UB),
double[].class);
// TODO Not sure this is really required... but we need to force the
// proxy to
// instantiate the object for real
return new MatlabControlImpl(logger, registryShutdownHub, gpmlDir,
iterDir, problemSize, tol, minEI, LB, UB, nBins, matlabLogFile);
}
示例12: main
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
public static void main(String[] args) throws MalformedURLException {
System.getProperties().put(CloudSymbolConstants.CONFIGURATION_FILE,
"src/test/resources/cloud.properties");
// TODO Auto-generated constructor stub
RegistryBuilder builder = new RegistryBuilder();
// Load all the modules in the cp
IOCUtilities.addDefaultModules(builder);
// Load all the local modules
builder.add(IterModule.class);
Registry registry = builder.build();
registry.performRegistryStartup();
LoadGeneratorSource generatorSource = registry
.getService(LoadGeneratorSource.class);
// Setup
LoadGenerator loadGenerator = new SinusLoadGenerator(
LoggerFactory.getLogger(LoadGenerator.class),
"SinusLoadGenerator",
registry.getService(TypeCoercer.class),
registry.getService(SymbolSource.class).valueForSymbol(
IterSymbolsNames.TRACEGENERATOR_URL),
"http://www.inf.usi.ch/phd/gambi/attachments/autocles/doodle-clients.jmx",
"http://www.inf.usi.ch/phd/gambi/attachments/autocles/doodle-manifest.xml",
0.0, 30.0, 0.0, 0.01, //
100, // nBins
registry.getService("RandomSinusLoadGenerator",
InputSampler.class), 300);
File bootstrapFile = new File(registry.getService(SymbolSource.class)
.valueForSymbol(IterSymbolsNames.INPUT_FILE));
File testResultsFile = new File(registry.getService(SymbolSource.class)
.valueForSymbol(IterSymbolsNames.TEST_RESULTS_FILE));
IterImpl iter = new IterImpl(
// Resources
LoggerFactory.getLogger(IterTest.class),
// User inputs
"ale",
"bbv",
// Experiment setup
1,
1,
// Input-output
testResultsFile,
bootstrapFile,
// Experimental Environment
registry.getService(TypeCoercer.class).coerce(
registry.getService(SymbolSource.class).valueForSymbol(
IterSymbolsNames.JOPERA_URL), URL.class),
// Experiment setup
DEFAULT_TIMEOUT,
true, // Bootstrap
// Other services
loadGenerator, registry.getService(RegistryShutdownHub.class),
registry.getService(TypeCoercer.class),
registry.getService(AssertionService.class),
registry.getService(DataCollectionService.class),
new StopTestSuiteEvolution(), generatorSource);
try {
iter.bootstrap();
} catch (TestExecutionException e) {
e.printStackTrace();
}
;
}
示例13: AbstractIncludeWorker
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
public AbstractIncludeWorker(SymbolSource symbolSource, AssetSource assetSource) {
this.symbolSource = symbolSource;
this.assetSource = assetSource;
}
示例14: IncludeJavaScriptLibraryWorker
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
public IncludeJavaScriptLibraryWorker(final JavaScriptSupport javascriptSupport, SymbolSource symbolSource, AssetSource assetSource) {
super(symbolSource, assetSource);
this.javascriptSupport = javascriptSupport;
}
示例15: IncludeStylesheetWorker
import org.apache.tapestry5.ioc.services.SymbolSource; //导入依赖的package包/类
public IncludeStylesheetWorker(final JavaScriptSupport javascriptSupport, SymbolSource symbolSource, AssetSource assetSource) {
super(symbolSource, assetSource);
this.javascriptSupport = javascriptSupport;
}