logger.log(Level.INFO, "Loading config from {0} ...", localDir); ConfigTO configTO = ConfigHelper.loadConfigTO(localDir); RepoTO repoTO = ConfigHelper.loadRepoTO(localDir, configTO);
@Override public GenlinkOperationResult execute() throws Exception { logger.log(Level.INFO, ""); logger.log(Level.INFO, "Running 'GenLink'"); logger.log(Level.INFO, "--------------------------------------------"); if (configTO == null) { configTO = ConfigHelper.loadConfigTO(config.getLocalDir()); } ApplicationLink applicationLink = new ApplicationLink(configTO.getTransferSettings(), options.isShortUrl()); if (configTO.getMasterKey() != null) { String encryptedLinkStr = applicationLink.createEncryptedLink(configTO.getMasterKey()); return new GenlinkOperationResult(encryptedLinkStr, true); } else { String plaintextLinkStr = applicationLink.createPlaintextLink(); return new GenlinkOperationResult(plaintextLinkStr, false); } } }
@Test public void testConfigHelperLoadConfigTO() throws Exception { // Setup Config testConfig = TestConfigUtil.createTestLocalConfig(); // Run ConfigTO loadedConfigTO = ConfigHelper.loadConfigTO(testConfig.getLocalDir()); // Test assertNotNull(loadedConfigTO); assertEquals(testConfig.getDisplayName(), loadedConfigTO.getDisplayName()); assertEquals(testConfig.getMachineName(), loadedConfigTO.getMachineName()); assertEquals(testConfig.getMasterKey(), loadedConfigTO.getMasterKey()); // Tear down TestConfigUtil.deleteTestLocalConfigAndData(testConfig); }
ConfigTO loadedConfigTO = ConfigHelper.loadConfigTO(testConfig.getLocalDir()); RepoTO repoConfigTO = ConfigHelper.loadRepoTO(testConfig.getLocalDir(), loadedConfigTO);