当前位置: 首页>>代码示例>>Java>>正文


Java Deployer类代码示例

本文整理汇总了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);
}
 
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:30,代码来源:EjbContactsTest.java

示例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.");
}
 
开发者ID:MilchUndHonig,项目名称:permissions-project,代码行数:6,代码来源:PermissionsWebappStarter.java


注:本文中的org.glassfish.embeddable.Deployer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。