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


Java Ilves类代码示例

本文整理汇总了Java中org.bubblecloud.ilves.Ilves的典型用法代码示例。如果您正苦于以下问题:Java Ilves类的具体用法?Java Ilves怎么用?Java Ilves使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Ilves类属于org.bubblecloud.ilves包,在下文中一共展示了Ilves类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.bubblecloud.ilves.Ilves; //导入依赖的package包/类
/**
 * Main method for Ilves seed project.
 *
 * @param args the commandline arguments
 * @throws Exception if exception occurs in jetty startup.
 */
public static void main(final String[] args) throws Exception {
    // Configure logging.
    DOMConfigurator.configure("log4j.xml");

    // Construct jetty server.
    final Server server = Ilves.configure(PROPERTIES_FILE_PREFIX, LOCALIZATION_BUNDLE_PREFIX, PERSISTENCE_UNIT);

    // Initialize modules
    Ilves.initializeModule(AuditModule.class);
    Ilves.initializeModule(CustomerModule.class);
    Ilves.initializeModule(ContentModule.class);
    Ilves.initializeModule(ReviewModule.class);
    Ilves.initializeModule(TranslationModule.class);

    Ilves.setDefaultPage("dashboard");

    // Start server.
    server.start();


    final TranslationSynchronizer translationSynchronizer = new TranslationSynchronizer(
            DefaultSiteUI.getEntityManagerFactory().createEntityManager());

    Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
            try {
                translationSynchronizer.shutdown();
            } catch (final Throwable t) {
                LOGGER.error("Error in synchronizer shutdown.", t);
            }
        }
    });

    // Wait for exit of the Jetty server.
    server.join();
}
 
开发者ID:tlaukkan,项目名称:groom-code-review-site,代码行数:43,代码来源:GroomMain.java

示例2: testApi

import org.bubblecloud.ilves.Ilves; //导入依赖的package包/类
@Test
@Ignore
public void testApi() throws Exception {
    // Construct jetty server.
    final Server server = Ilves.configure(PROPERTIES_FILE_PREFIX, LOCALIZATION_BUNDLE_PREFIX, PERSISTENCE_UNIT);

    // Initialize modules
    Ilves.initializeModule(AuditModule.class);
    Ilves.initializeModule(CustomerModule.class);
    Ilves.initializeModule(ContentModule.class);

    Ilves.addApi(SecurityApi.class, SecurityApiImpl.class);
    Ilves.addApi(ApiMock.class, ApiMockImpl.class);

    // Start server.
    server.start();

    final EntityManager entityManager = DefaultSiteUI.getEntityManagerFactory().createEntityManager();
    final Company company = CompanyDao.getCompany(entityManager, "*");
    company.setSelfRegistration(true);
    entityManager.getTransaction().begin();
    entityManager.persist(company);
    entityManager.getTransaction().commit();

    final JsonRpcHttpClient apiMockClient = new JsonRpcHttpClient(
            new URL("http://localhost:8080/api/apimock"));

    final ApiMock apiMock = ProxyUtil.createClientProxy(
            getClass().getClassLoader(),
            ApiMock.class, apiMockClient);

    final SecurityApi security = ProxyUtil.createClientProxy(
            getClass().getClassLoader(),
            SecurityApi.class,
            new JsonRpcHttpClient(
                    new URL("http://localhost:8080/api/securityapi")));

    Assert.assertTrue(security.selfRegisterUser("test", "user", "[email protected]", "+123", "password"));
    final RequestAccessTokenResult result = security.requestAccessToken("[email protected]", "password");

    final Map<String, String> headers = new HashMap<>();
    headers.put("Authorization", "Bearer " + new String(result.getAccessToken()));

    apiMockClient.setHeaders(headers);

    Assert.assertEquals("[user]:test", apiMock.testMethod("test"));

    server.stop();
}
 
开发者ID:bubblecloud,项目名称:ilves,代码行数:50,代码来源:ApiTest.java

示例3: main

import org.bubblecloud.ilves.Ilves; //导入依赖的package包/类
/**
 * Main method for tutorial site.
 *
 * @param args the commandline arguments
 * @throws Exception if exception occurs in jetty startup.
 */
public static void main(final String[] args) throws Exception {
    // Configure logging.
    DOMConfigurator.configure("log4j.xml");

    // Construct jetty server.
    final Server server = Ilves.configure(PROPERTIES_FILE_PREFIX, LOCALIZATION_BUNDLE_PREFIX, PERSISTENCE_UNIT);

    // Initialize modules
    Ilves.initializeModule(AuditModule.class);
    Ilves.initializeModule(CustomerModule.class);
    Ilves.initializeModule(ContentModule.class);

    // Get default site descriptor.
    final SiteDescriptor siteDescriptor = DefaultSiteUI.getContentProvider().getSiteDescriptor();

    HootFields.initialize();

    final String dashboardPage = "dashboard";
    // Describe custom view.
    final ViewDescriptor commentView = new ViewDescriptor(dashboardPage, DefaultValoView.class);
    commentView.setViewerRoles("administrator");
    siteDescriptor.getViewDescriptors().add(commentView);
    // Place example viewlet to content slot in the view.
    commentView.setViewletClass(Slot.CONTENT, EntryFlowViewlet.class);

    // Add custom view to navigation.
    final NavigationVersion navigationVersion = siteDescriptor.getNavigationVersion();
    navigationVersion.setDefaultPageName(dashboardPage);
    navigationVersion.addRootPage(0, dashboardPage);

    Ilves.setDefaultPage("dashboard");

    // Start server.
    server.start();

    final HootSynchronizer translationSynchronizer = new HootSynchronizer(
            DefaultSiteUI.getEntityManagerFactory().createEntityManager());

    Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
            try {
                translationSynchronizer.shutdown();
            } catch (final Throwable t) {
                LOGGER.error("Error in synchronizer shutdown.", t);
            }
        }
    });

    // Join this main thread to the Jetty server thread.
    server.join();
}
 
开发者ID:bubblecloud,项目名称:hoot-bundle-translation-site,代码行数:58,代码来源:HootMain.java


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