本文整理汇总了Java中org.glassfish.embeddable.Deployer类的典型用法代码示例。如果您正苦于以下问题:Java Deployer类的具体用法?Java Deployer怎么用?Java Deployer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Deployer类属于org.glassfish.embeddable包,在下文中一共展示了Deployer类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startGlassFish
import org.glassfish.embeddable.Deployer; //导入依赖的package包/类
@BeforeClass
public static void startGlassFish() throws Exception {
File loginConf = new File("target/test-classes/login.conf");
assertTrue(loginConf.exists());
System.setProperty("java.security.auth.login.config", loginConf.getAbsolutePath());
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, SerialInitContextFactory.class.getName());
System.setProperty(Context.URL_PKG_PREFIXES, SerialInitContextFactory.class.getPackage().getName());
System.setProperty(Context.STATE_FACTORIES, JNDIStateFactoryImpl.class.getName());
GlassFishProperties properties = new GlassFishProperties();
properties.setProperty(ACTIVATE_DEFAULT_PRINCIPAL_TO_ROLE_MAPPING_PROPERTY, "true");
glassFish = GlassFishRuntime.bootstrap().newGlassFish(properties);
Logger.getLogger("").getHandlers()[0].setLevel(Level.WARNING);
Logger.getLogger("javax.enterprise.system.tools.deployment").setLevel(Level.SEVERE);
Logger.getLogger("javax.enterprise.system").setLevel(Level.SEVERE);
glassFish.start();
Deployer deployer = glassFish.getDeployer();
ScatteredArchive archive = new ScatteredArchive("contacts", ScatteredArchive.Type.WAR);
archive.addClassPath(new File("target", "test-classes"));
createUser("admin", "admin");
createUser("John", "user");
createUser("Mary", "user");
deployer.deploy(archive.toURI());
login("admin");
Context context = new InitialContext();
testData = (ContactsTestData)context.lookup("java:global/contacts/ContactsTestData");
testData.createTestData();
new ProgrammaticLogin().logout();
contactsDao = (LocalContactsDao)context.lookup(LOCAL_CONTACTS_DAO_JNDI_NAME);
}
示例2: getDeployerServiceFromGlassFishInstance
import org.glassfish.embeddable.Deployer; //导入依赖的package包/类
private static void getDeployerServiceFromGlassFishInstance() throws GlassFishException {
LOG.info("Trying to receive the deployer service from the glassfish instance...");
deployer = glassFish.getService(Deployer.class);
LOG.info("Deployer service successfully received.");
}