Пример #1
0
  @Test
  public void testManifestEntries() throws Exception {
    Properties props = System.getProperties();
    String userDir = props.getProperty("build.lib");

    UnitTestLogger.LOGGER.trace("userDir is " + userDir);

    // The jar must be there
    File file = new File("build/jars", "hornetq-core.jar");
    Assert.assertTrue(file.exists());

    // Open the jar and load MANIFEST.MF
    JarFile jar = new JarFile(file);
    Manifest manifest = jar.getManifest();

    // Open a connection and get ConnectionMetaData
    Connection conn = null;

    try {
      HornetQServer server = HornetQServers.newHornetQServer(createBasicConfig());

      ConnectionMetaData meta = new HornetQConnectionMetaData(server.getVersion());

      // Compare the value from ConnectionMetaData and MANIFEST.MF
      Attributes attrs = manifest.getMainAttributes();

      Assert.assertEquals(meta.getProviderVersion(), attrs.getValue("HornetQ-Version"));
      // TODO fix this
      Assert.assertEquals(
          "https://svn.jboss.org/repos/hornetq/branches/Branch_2_2_EAP",
          attrs.getValue("HornetQ-SVN-URL"));
    } finally {
      if (conn != null) {
        conn.close();
      }
    }
  }
  public void testGetAttributes() throws Exception {
    HornetQServerControl serverControl = createManagementControl();

    Assert.assertEquals(server.getVersion().getFullVersion(), serverControl.getVersion());

    Assert.assertEquals(conf.isClustered(), serverControl.isClustered());
    Assert.assertEquals(
        conf.isPersistDeliveryCountBeforeDelivery(),
        serverControl.isPersistDeliveryCountBeforeDelivery());
    Assert.assertEquals(conf.isBackup(), serverControl.isBackup());
    Assert.assertEquals(conf.isSharedStore(), serverControl.isSharedStore());
    Assert.assertEquals(
        conf.getScheduledThreadPoolMaxSize(), serverControl.getScheduledThreadPoolMaxSize());
    Assert.assertEquals(conf.getThreadPoolMaxSize(), serverControl.getThreadPoolMaxSize());
    Assert.assertEquals(
        conf.getSecurityInvalidationInterval(), serverControl.getSecurityInvalidationInterval());
    Assert.assertEquals(conf.isSecurityEnabled(), serverControl.isSecurityEnabled());
    Assert.assertEquals(
        conf.isAsyncConnectionExecutionEnabled(),
        serverControl.isAsyncConnectionExecutionEnabled());
    Assert.assertEquals(
        conf.getInterceptorClassNames().size(), serverControl.getInterceptorClassNames().length);
    Assert.assertEquals(conf.getConnectionTTLOverride(), serverControl.getConnectionTTLOverride());
    // Assert.assertEquals(conf.getBackupConnectorName(), serverControl.getBackupConnectorName());
    Assert.assertEquals(
        conf.getManagementAddress().toString(), serverControl.getManagementAddress());
    Assert.assertEquals(
        conf.getManagementNotificationAddress().toString(),
        serverControl.getManagementNotificationAddress());
    Assert.assertEquals(conf.getIDCacheSize(), serverControl.getIDCacheSize());
    Assert.assertEquals(conf.isPersistIDCache(), serverControl.isPersistIDCache());
    Assert.assertEquals(conf.getBindingsDirectory(), serverControl.getBindingsDirectory());
    Assert.assertEquals(conf.getJournalDirectory(), serverControl.getJournalDirectory());
    Assert.assertEquals(conf.getJournalType().toString(), serverControl.getJournalType());
    Assert.assertEquals(
        conf.isJournalSyncTransactional(), serverControl.isJournalSyncTransactional());
    Assert.assertEquals(
        conf.isJournalSyncNonTransactional(), serverControl.isJournalSyncNonTransactional());
    Assert.assertEquals(conf.getJournalFileSize(), serverControl.getJournalFileSize());
    Assert.assertEquals(conf.getJournalMinFiles(), serverControl.getJournalMinFiles());
    if (AsynchronousFileImpl.isLoaded()) {
      Assert.assertEquals(conf.getJournalMaxIO_AIO(), serverControl.getJournalMaxIO());
      Assert.assertEquals(conf.getJournalBufferSize_AIO(), serverControl.getJournalBufferSize());
      Assert.assertEquals(
          conf.getJournalBufferTimeout_AIO(), serverControl.getJournalBufferTimeout());
    }
    Assert.assertEquals(conf.isCreateBindingsDir(), serverControl.isCreateBindingsDir());
    Assert.assertEquals(conf.isCreateJournalDir(), serverControl.isCreateJournalDir());
    Assert.assertEquals(conf.getPagingDirectory(), serverControl.getPagingDirectory());
    Assert.assertEquals(
        conf.getLargeMessagesDirectory(), serverControl.getLargeMessagesDirectory());
    Assert.assertEquals(conf.isWildcardRoutingEnabled(), serverControl.isWildcardRoutingEnabled());
    Assert.assertEquals(conf.getTransactionTimeout(), serverControl.getTransactionTimeout());
    Assert.assertEquals(conf.isMessageCounterEnabled(), serverControl.isMessageCounterEnabled());
    Assert.assertEquals(
        conf.getTransactionTimeoutScanPeriod(), serverControl.getTransactionTimeoutScanPeriod());
    Assert.assertEquals(
        conf.getMessageExpiryScanPeriod(), serverControl.getMessageExpiryScanPeriod());
    Assert.assertEquals(
        conf.getMessageExpiryThreadPriority(), serverControl.getMessageExpiryThreadPriority());
    Assert.assertEquals(
        conf.getJournalCompactMinFiles(), serverControl.getJournalCompactMinFiles());
    Assert.assertEquals(
        conf.getJournalCompactPercentage(), serverControl.getJournalCompactPercentage());
    Assert.assertEquals(conf.isPersistenceEnabled(), serverControl.isPersistenceEnabled());
    Assert.assertEquals(
        conf.isFailoverOnServerShutdown(), serverControl.isFailoverOnServerShutdown());
  }