當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。