@Test public void testUpdateAmsEnvContent() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { Method updateAmsEnvContent = UpgradeCatalog220.class.getDeclaredMethod("updateAmsEnvContent", String.class); UpgradeCatalog220 upgradeCatalog220 = new UpgradeCatalog220(injector); String oldContent = "some_content"; String expectedContent = "some_content" + "\n" + "# AMS Collector GC options\n" + "export AMS_COLLECTOR_GC_OPTS=\"-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=70 " + "-XX:+UseCMSInitiatingOccupancyOnly -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps " + "-XX:+UseGCLogFileRotation -XX:GCLogFileSize=10M " + "-Xloggc:{{ams_collector_log_dir}}/collector-gc.log-`date +'%Y%m%d%H%M'`\"\n" + "export AMS_COLLECTOR_OPTS=\"$AMS_COLLECTOR_OPTS $AMS_COLLECTOR_GC_OPTS\"\n"+ "\n" + "# HBase normalizer enabled\n" + "export AMS_HBASE_NORMALIZER_ENABLED={{ams_hbase_normalizer_enabled}}\n" + "\n" + "# HBase compaction policy enabled\n" + "export AMS_HBASE_FIFO_COMPACTION_ENABLED={{ams_hbase_fifo_compaction_enabled}}\n"; String result = (String) updateAmsEnvContent.invoke(upgradeCatalog220, oldContent); Assert.assertEquals(expectedContent, result); }
protected String updateAmsEnvContent(String content) { if (content == null) { return null; } if (!content.contains("AMS_COLLECTOR_GC_OPTS")) { content += "\n" + "# AMS Collector GC options\n" + "export AMS_COLLECTOR_GC_OPTS=\"-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=70 " + "-XX:+UseCMSInitiatingOccupancyOnly -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps " + "-XX:+UseGCLogFileRotation -XX:GCLogFileSize=10M " + "-Xloggc:{{ams_collector_log_dir}}/collector-gc.log-`date +'%Y%m%d%H%M'`\"\n" + "export AMS_COLLECTOR_OPTS=\"$AMS_COLLECTOR_OPTS $AMS_COLLECTOR_GC_OPTS\"\n"; } if (!content.contains("AMS_HBASE_NORMALIZER_ENABLED")) { content += "\n" + "# HBase normalizer enabled\n" + "export AMS_HBASE_NORMALIZER_ENABLED={{ams_hbase_normalizer_enabled}}\n"; } if (!content.contains("AMS_HBASE_FIFO_COMPACTION_ENABLED")) { content += "\n" + "# HBase compaction policy enabled\n" + "export AMS_HBASE_FIFO_COMPACTION_ENABLED={{ams_hbase_fifo_compaction_enabled}}\n"; } return content; }
UpgradeCatalog220 extends AbstractUpgradeCatalog { protected String updateAmsEnvContent(String content) { if (content == null) { return null; } if (!content.contains("AMS_COLLECTOR_GC_OPTS")) { content += "\n" + "# AMS Collector GC options\n" + "export AMS_COLLECTOR_GC_OPTS=\"-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=70 " + "-XX:+UseCMSInitiatingOccupancyOnly -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps " + "-XX:+UseGCLogFileRotation -XX:GCLogFileSize=10M " + "-Xloggc:{{ams_collector_log_dir}}/collector-gc.log-`date +'%Y%m%d%H%M'`\"\n" + "export AMS_COLLECTOR_OPTS=\"$AMS_COLLECTOR_OPTS $AMS_COLLECTOR_GC_OPTS\"\n"; } if (!content.contains("AMS_HBASE_NORMALIZER_ENABLED")) { content += "\n" + "# HBase normalizer enabled\n" + "export AMS_HBASE_NORMALIZER_ENABLED={{ams_hbase_normalizer_enabled}}\n"; } if (!content.contains("AMS_HBASE_FIFO_COMPACTION_ENABLED")) { content += "\n" + "# HBase compaction policy enabled\n" + "export AMS_HBASE_FIFO_COMPACTION_ENABLED={{ams_hbase_fifo_compaction_enabled}}\n"; } return content; } }
UpgradeCatalog220 extends AbstractUpgradeCatalog { protected String updateAmsEnvContent(String content) { if (content == null) { return null; } if (!content.contains("AMS_COLLECTOR_GC_OPTS")) { content += "\n" + "# AMS Collector GC options\n" + "export AMS_COLLECTOR_GC_OPTS=\"-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=70 " + "-XX:+UseCMSInitiatingOccupancyOnly -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps " + "-XX:+UseGCLogFileRotation -XX:GCLogFileSize=10M " + "-Xloggc:{{ams_collector_log_dir}}/collector-gc.log-`date +'%Y%m%d%H%M'`\"\n" + "export AMS_COLLECTOR_OPTS=\"$AMS_COLLECTOR_OPTS $AMS_COLLECTOR_GC_OPTS\"\n"; } if (!content.contains("AMS_HBASE_NORMALIZER_ENABLED")) { content += "\n" + "# HBase normalizer enabled\n" + "export AMS_HBASE_NORMALIZER_ENABLED={{ams_hbase_normalizer_enabled}}\n"; } if (!content.contains("AMS_HBASE_FIFO_COMPACTION_ENABLED")) { content += "\n" + "# HBase compaction policy enabled\n" + "export AMS_HBASE_FIFO_COMPACTION_ENABLED={{ams_hbase_fifo_compaction_enabled}}\n"; } return content; } @Inject  UpgradeCatalog220(Injector injector); }
UpgradeCatalog220 extends AbstractUpgradeCatalog { protected String updateAmsEnvContent(String content) { if (content == null) { return null; } if (!content.contains("AMS_COLLECTOR_GC_OPTS")) { content += "\n" + "# AMS Collector GC options\n" + "export AMS_COLLECTOR_GC_OPTS=\"-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=70 " + "-XX:+UseCMSInitiatingOccupancyOnly -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps " + "-XX:+UseGCLogFileRotation -XX:GCLogFileSize=10M " + "-Xloggc:{{ams_collector_log_dir}}/collector-gc.log-`date +'%Y%m%d%H%M'`\"\n" + "export AMS_COLLECTOR_OPTS=\"$AMS_COLLECTOR_OPTS $AMS_COLLECTOR_GC_OPTS\"\n"; } if (!content.contains("AMS_HBASE_NORMALIZER_ENABLED")) { content += "\n" + "# HBase normalizer enabled\n" + "export AMS_HBASE_NORMALIZER_ENABLED={{ams_hbase_normalizer_enabled}}\n"; } if (!content.contains("AMS_HBASE_FIFO_COMPACTION_ENABLED")) { content += "\n" + "# HBase compaction policy enabled\n" + "export AMS_HBASE_FIFO_COMPACTION_ENABLED={{ams_hbase_fifo_compaction_enabled}}\n"; } return content; } @Inject  UpgradeCatalog220(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); @Transactional void bootstrapRepoVersionForHDP21(); }
UpgradeCatalog220 extends AbstractUpgradeCatalog { protected String updateAmsEnvContent(String content) { if (content == null) { return null; } if (!content.contains("AMS_COLLECTOR_GC_OPTS")) { content += "\n" + "# AMS Collector GC options\n" + "export AMS_COLLECTOR_GC_OPTS=\"-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=70 " + "-XX:+UseCMSInitiatingOccupancyOnly -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps " + "-XX:+UseGCLogFileRotation -XX:GCLogFileSize=10M " + "-Xloggc:{{ams_collector_log_dir}}/collector-gc.log-`date +'%Y%m%d%H%M'`\"\n" + "export AMS_COLLECTOR_OPTS=\"$AMS_COLLECTOR_OPTS $AMS_COLLECTOR_GC_OPTS\"\n"; } if (!content.contains("AMS_HBASE_NORMALIZER_ENABLED")) { content += "\n" + "# HBase normalizer enabled\n" + "export AMS_HBASE_NORMALIZER_ENABLED={{ams_hbase_normalizer_enabled}}\n"; } if (!content.contains("AMS_HBASE_FIFO_COMPACTION_ENABLED")) { content += "\n" + "# HBase compaction policy enabled\n" + "export AMS_HBASE_FIFO_COMPACTION_ENABLED={{ams_hbase_fifo_compaction_enabled}}\n"; } return content; } @Inject  UpgradeCatalog220(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); @Transactional void bootstrapRepoVersionForHDP21(); static final String UPGRADE_PACKAGE_COL; static final String UPGRADE_TYPE_COL; static final String REPO_VERSION_TABLE; }