@Test public void testAdapt_hostedRepository() throws Exception { Repository repository = createRepository(new HostedType(), "bionic", "asdf", null, null); AptHostedApiRepository hostedRepository = (AptHostedApiRepository) underTest.adapt(repository); assertRepository(hostedRepository, "hosted", true); assertThat(hostedRepository.getApt().getDistribution(), is("bionic")); assertThat(hostedRepository.getAptSigning(), nullValue()); repository.getConfiguration().attributes("apt").set("passphrase", "mypass"); hostedRepository = (AptHostedApiRepository) underTest.adapt(repository); assertThat(hostedRepository.getAptSigning().getKeypair(), is("asdf")); assertThat(hostedRepository.getAptSigning().getPassphrase(), nullValue()); }
@Override public AbstractApiRepository adapt(final Repository repository) { boolean online = repository.getConfiguration().isOnline(); String name = repository.getName(); String url = repository.getUrl(); switch (repository.getType().toString()) { case HostedType.NAME: return new AptHostedApiRepository(name, url, online, getHostedStorageAttributes(repository), getCleanupPolicyAttributes(repository), createAptHostedRepositoriesAttributes(repository), createAptSigningRepositoriesAttributes(repository)); case ProxyType.NAME: return new AptProxyApiRepository(name, url, online, getHostedStorageAttributes(repository), getCleanupPolicyAttributes(repository), createAptProxyRepositoriesAttributes(repository), getProxyAttributes(repository), getNegativeCacheAttributes(repository), getHttpClientAttributes(repository), getRoutingRuleName(repository)); } return null; }
AptApiRepositoryAdapter extends SimpleApiRepositoryAdapter { @Override public AbstractApiRepository adapt(final Repository repository) { boolean online = repository.getConfiguration().isOnline(); String name = repository.getName(); String url = repository.getUrl(); switch (repository.getType().toString()) { case HostedType.NAME: return new AptHostedApiRepository(name, url, online, getHostedStorageAttributes(repository), getCleanupPolicyAttributes(repository), createAptHostedRepositoriesAttributes(repository), createAptSigningRepositoriesAttributes(repository)); case ProxyType.NAME: return new AptProxyApiRepository(name, url, online, getHostedStorageAttributes(repository), getCleanupPolicyAttributes(repository), createAptProxyRepositoriesAttributes(repository), getProxyAttributes(repository), getNegativeCacheAttributes(repository), getHttpClientAttributes(repository), getRoutingRuleName(repository)); } return null; } }
AptApiRepositoryAdapter extends SimpleApiRepositoryAdapter { @Override public AbstractApiRepository adapt(final Repository repository) { boolean online = repository.getConfiguration().isOnline(); String name = repository.getName(); String url = repository.getUrl(); switch (repository.getType().toString()) { case HostedType.NAME: return new AptHostedApiRepository(name, url, online, getHostedStorageAttributes(repository), getCleanupPolicyAttributes(repository), createAptHostedRepositoriesAttributes(repository), createAptSigningRepositoriesAttributes(repository)); case ProxyType.NAME: return new AptProxyApiRepository(name, url, online, getHostedStorageAttributes(repository), getCleanupPolicyAttributes(repository), createAptProxyRepositoriesAttributes(repository), getProxyAttributes(repository), getNegativeCacheAttributes(repository), getHttpClientAttributes(repository), getRoutingRuleName(repository)); } return null; } @Inject  AptApiRepositoryAdapter(final RoutingRuleStore routingRuleStore); }
AptApiRepositoryAdapter extends SimpleApiRepositoryAdapter { @Override public AbstractApiRepository adapt(final Repository repository) { boolean online = repository.getConfiguration().isOnline(); String name = repository.getName(); String url = repository.getUrl(); switch (repository.getType().toString()) { case HostedType.NAME: return new AptHostedApiRepository(name, url, online, getHostedStorageAttributes(repository), getCleanupPolicyAttributes(repository), createAptHostedRepositoriesAttributes(repository), createAptSigningRepositoriesAttributes(repository)); case ProxyType.NAME: return new AptProxyApiRepository(name, url, online, getHostedStorageAttributes(repository), getCleanupPolicyAttributes(repository), createAptProxyRepositoriesAttributes(repository), getProxyAttributes(repository), getNegativeCacheAttributes(repository), getHttpClientAttributes(repository), getRoutingRuleName(repository)); } return null; } @Inject  AptApiRepositoryAdapter(final RoutingRuleStore routingRuleStore); @Override AbstractApiRepository adapt(final Repository repository); }
AptApiRepositoryAdapter extends SimpleApiRepositoryAdapter { @Override public AbstractApiRepository adapt(final Repository repository) { boolean online = repository.getConfiguration().isOnline(); String name = repository.getName(); String url = repository.getUrl(); switch (repository.getType().toString()) { case HostedType.NAME: return new AptHostedApiRepository(name, url, online, getHostedStorageAttributes(repository), getCleanupPolicyAttributes(repository), createAptHostedRepositoriesAttributes(repository), createAptSigningRepositoriesAttributes(repository)); case ProxyType.NAME: return new AptProxyApiRepository(name, url, online, getHostedStorageAttributes(repository), getCleanupPolicyAttributes(repository), createAptProxyRepositoriesAttributes(repository), getProxyAttributes(repository), getNegativeCacheAttributes(repository), getHttpClientAttributes(repository), getRoutingRuleName(repository)); } return null; } @Inject  AptApiRepositoryAdapter(final RoutingRuleStore routingRuleStore); @Override AbstractApiRepository adapt(final Repository repository);  }