Examples of MockHost


Examples of com.cloud.simulator.MockHost

    }

    @Override
    public StoragePoolInfo getLocalStorage(String hostGuid) {
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
        MockHost host = null;
        MockStoragePoolVO storagePool = null;
        try {
            txn.start();
            host = _mockHostDao.findByGuid(hostGuid);
            storagePool = _mockStoragePoolDao.findByHost(hostGuid);
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Unable to find host " + hostGuid, ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
        }

        if (storagePool == null) {
            String uuid = UUID.randomUUID().toString();
            storagePool = new MockStoragePoolVO();
            storagePool.setUuid(uuid);
            storagePool.setMountPoint("/mnt/" + uuid + File.separator);
            storagePool.setCapacity(DEFAULT_HOST_STORAGE_SIZE);
            storagePool.setHostGuid(hostGuid);
            storagePool.setStorageType(StoragePoolType.Filesystem);
            txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
            try {
                txn.start();
                storagePool = _mockStoragePoolDao.persist(storagePool);
                txn.commit();
            } catch (Exception ex) {
                txn.rollback();
                throw new CloudRuntimeException("Error when saving storagePool " + storagePool, ex);
            } finally {
                txn.close();
                txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
                txn.close();
            }
        }
        return new StoragePoolInfo(storagePool.getUuid(), host.getPrivateIpAddress(), storagePool.getMountPoint(),
                storagePool.getMountPoint(), storagePool.getPoolType(), storagePool.getCapacity(), 0);
    }
View Full Code Here

Examples of com.cloud.simulator.MockHost

    }

    @Override
    public StoragePoolInfo getLocalStorage(String hostGuid, Long storageSize) {
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
        MockHost host = null;
        try {
            txn.start();
            host = _mockHostDao.findByGuid(hostGuid);
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Unable to find host " + hostGuid, ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
        }
        if (storageSize == null) {
            storageSize = DEFAULT_HOST_STORAGE_SIZE;
        }
        txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
        MockStoragePoolVO storagePool = null;
        try {
            txn.start();
            storagePool = _mockStoragePoolDao.findByHost(hostGuid);
            txn.commit();
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error when finding storagePool " + storagePool, ex);
        } finally {
            txn.close();
            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
            txn.close();
        }
        if (storagePool == null) {
            String uuid = UUID.randomUUID().toString();
            storagePool = new MockStoragePoolVO();
            storagePool.setUuid(uuid);
            storagePool.setMountPoint("/mnt/" + uuid + File.separator);
            storagePool.setCapacity(storageSize);
            storagePool.setHostGuid(hostGuid);
            storagePool.setStorageType(StoragePoolType.Filesystem);
            txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
            try {
                txn.start();
                storagePool = _mockStoragePoolDao.persist(storagePool);
                txn.commit();
            } catch (Exception ex) {
                txn.rollback();
                throw new CloudRuntimeException("Error when saving storagePool " + storagePool, ex);
            } finally {
                txn.close();
                txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
                txn.close();
            }
        }
        return new StoragePoolInfo(storagePool.getUuid(), host.getPrivateIpAddress(), storagePool.getMountPoint(),
                storagePool.getMountPoint(), storagePool.getPoolType(), storagePool.getCapacity(), 0);
    }
View Full Code Here

Examples of org.jboss.as.web.session.mocks.MockHost

        factory.getLockManagerInjector().inject(((ExtendedCacheManager) cacheContainer).getLockManager());
       
        Engine engine = new MockEngine();
        engine.setName("jboss.web");
        engine.setJvmRoute(jvmRoute);
        Host host = new MockHost();
        host.setName("localhost");
        engine.addChild(host);
        StandardContext context = new StandardContext();
        context.setName(warName);
        context.setDomain(jvmRoute);
        host.addChild(context);

        try {
            DistributableSessionManager<OutgoingDistributableSessionData> manager = new DistributableSessionManager<OutgoingDistributableSessionData>(factory, context, metaData, new ContextClassResolver()) {
                @Override
                public void start() throws LifecycleException {
View Full Code Here

Examples of org.jboss.as.web.session.mocks.MockHost

     */
    @Test
    public void testNewSessionIsOutdated() throws Exception {
        Engine engine = new MockEngine();
        engine.setName("jboss.web");
        Host host = new MockHost();
        host.setName("localhost");
        engine.addChild(host);
        StandardContext context = new StandardContext();
        context.setName("test");
        host.addChild(context);
       
        DistributableSessionManager<?> mgr = new DistributableSessionManager<OutgoingDistributableSessionData>(new MockDistributedCacheManagerFactory(), context, SessionTestUtil.createWebMetaData(10), new ContextClassResolver());
        context.setManager(mgr);
        mgr.start();

View Full Code Here

Examples of org.jboss.as.web.session.mocks.MockHost

    }

    private Context getContext(String contextPath, String cookiePath, String cookieComment, String cookieDomain,
            boolean httpOnly, boolean secure) {
        MockEngine engine = new MockEngine();
        MockHost host = new MockHost();
        host.setName("localhost");
        engine.addChild(host);
        StandardContext container = new StandardContext();
        container.setPath(contextPath);
        host.addChild(container);

        SessionCookie cookie = container.getSessionCookie();
        if (cookiePath != null)
            cookie.setPath(cookiePath);
        if (cookieComment != null)
View Full Code Here

Examples of org.jboss.test.cluster.web.mocks.MockHost

      DataSourcePersistentManager mgr = new DataSourcePersistentManager(getDataSource());
      mgr.setSnapshotMode(SnapshotMode.INSTANT);
     
      MockEngine engine = new MockEngine();
      engine.setJvmRoute(jvmRoute);
      MockHost host = new MockHost();
      host.setName("localhost");
      engine.addChild(host);
      StandardContext container = new StandardContext();
      container.setName(warName);
      host.addChild(container);
      container.setManager(mgr);
     
      // Do this after assigning the manager to the container, or else
      // the container's setting will override ours
      // Can't just set the container as their config is per minute not per second
View Full Code Here

Examples of org.jboss.test.cluster.web.mocks.MockHost

   private Context getContext(String contextPath, String cookiePath,
                              String cookieComment, String cookieDomain,
                              boolean httpOnly, boolean secure)
   {
      MockEngine engine = new MockEngine();
      MockHost host = new MockHost();
      host.setName("localhost");
      engine.addChild(host);
      StandardContext container = new StandardContext();
      container.setPath(contextPath);
      host.addChild(container);
     
      SessionCookie cookie = container.getSessionCookie();
      if (cookiePath != null)
         cookie.setPath(cookiePath);
      if (cookieComment != null)
View Full Code Here

Examples of org.jboss.test.cluster.web.mocks.MockHost

   public static void setupContainer(String warName, String jvmRoute, Manager mgr)
   {
      MockEngine engine = new MockEngine();
      engine.setName("jboss.web");
      engine.setJvmRoute(jvmRoute);
      MockHost host = new MockHost();
      host.setName("localhost");
      engine.addChild(host);
      StandardContext container = new StandardContext();
      container.setName(warName);
      host.addChild(container);
      container.setManager(mgr);
   }
View Full Code Here

Examples of org.jboss.test.cluster.web.mocks.MockHost

      JBossCacheManager jbcm = new JBossCacheManager(distributedManagerFactory);
      jbcm.setSnapshotMode(SnapshotMode.INSTANT);
     
      MockEngine engine = new MockEngine();
      engine.setJvmRoute(jvmRoute);
      MockHost host = new MockHost();
      engine.addChild(host);
      host.setName("localhost");
      StandardContext container = new StandardContext();
      container.setName(warName);
      host.addChild(container);
      container.setManager(jbcm);
     
      // Do this after assigning the manager to the container, or else
      // the container's setting will override ours
      // Can't just set the container as their config is per minute not per second
View Full Code Here

Examples of org.jboss.test.cluster.web.mocks.MockHost

  
   private Manager getSessionManager(String contextName)
   {
      StandardManager mgr = new StandardManager();
      MockEngine engine = new MockEngine();
      MockHost host = new MockHost();
      engine.addChild(host);
      host.setName("localhost");
      StandardContext container = new StandardContext();
      container.setName(contextName);
      host.addChild(container);
      container.setManager(mgr);
     
      return mgr;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.