use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class TrackedContentDTOTest method assertRoundTrip.
private void assertRoundTrip(final TrackedContentDTO in, final Consumer<TrackedContentDTO> extraAssertions) throws IOException {
IndyObjectMapper mapper = new IndyObjectMapper(true);
String json = mapper.writeValueAsString(in);
TrackedContentDTO out = mapper.readValue(json, TrackedContentDTO.class);
assertThat(out, notNullValue());
assertThat(out.getKey(), equalTo(in.getKey()));
if (extraAssertions != null) {
extraAssertions.accept(out);
}
assertThat(out, equalTo(in));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class TrackedContentEntryDTOTest method assertRoundTrip.
private void assertRoundTrip(final TrackedContentEntryDTO in, final Consumer<TrackedContentEntryDTO> extraAssertions) throws IOException {
IndyObjectMapper mapper = new IndyObjectMapper(true);
String json = mapper.writeValueAsString(in);
TrackedContentEntryDTO out = mapper.readValue(json, TrackedContentEntryDTO.class);
assertThat(out, notNullValue());
assertThat(out.getStoreKey(), equalTo(in.getStoreKey()));
assertThat(out.getPath(), equalTo(in.getPath()));
if (extraAssertions != null) {
extraAssertions.accept(out);
}
assertThat(out, equalTo(in));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class ContentExpirationTest method roundTrip.
@Test
public void roundTrip() throws Exception {
final ContentExpiration exp = new ContentExpiration(new StoreKey(StoreType.remote, "test"), "/path/to/something.good");
final IndyObjectMapper mapper = new IndyObjectMapper(false);
final String json = mapper.writeValueAsString(exp);
System.out.println(json);
final ContentExpiration result = mapper.readValue(json, ContentExpiration.class);
assertThat(result, equalTo(exp));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class DataFileTCKFixtureProvider method before.
@Override
protected void before() throws Throwable {
super.before();
configDir = newFolder("db");
final IndyObjectMapper serializer = new IndyObjectMapper(true);
dataManager = new TestFlatFileDataManager(new DataFileConfiguration().withDataBasedir(configDir), serializer);
dataManager.install();
dataManager.clear(new ChangeSummary(ChangeSummary.SYSTEM_USER, "Setting up test"));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class HttpProxyTest method setup.
@Before
public void setup() throws Exception {
contentMetadata.clear();
core.initGalley();
final TransportManager transports = new TransportManagerImpl(new HttpClientTransport(new HttpImpl(new MemoryPasswordManager())));
core.withTransportManager(transports);
core.initMissingComponents();
final HttproxConfig config = new HttproxConfig();
config.setEnabled(true);
proxyPort = config.getPort();
final BootOptions bootOpts = new BootOptions();
bootOpts.setBind(HOST);
storeManager = new MemoryStoreDataManager(true);
final IndyObjectMapper mapper = new IndyObjectMapper(true);
final DownloadManager downloadManager = new DefaultDownloadManager(storeManager, core.getTransferManager(), core.getLocationExpander(), new MockInstance<>(new MockContentAdvisor()));
DirectContentAccess dca = new DefaultDirectContentAccess(downloadManager, Executors.newSingleThreadExecutor());
ContentDigester contentDigester = new DefaultContentDigester(dca, new CacheHandle<String, TransferMetadata>("content-metadata", contentMetadata));
final ContentManager contentManager = new DefaultContentManager(storeManager, downloadManager, mapper, new SpecialPathManagerImpl(), new MemoryNotFoundCache(), contentDigester, Collections.<ContentGenerator>emptySet());
DataFileManager dfm = new DataFileManager(temp.newFolder(), new DataFileEventManager());
final TemplatingEngine templates = new TemplatingEngine(new GStringTemplateEngine(), dfm);
final ContentController contentController = new ContentController(storeManager, contentManager, templates, mapper, new MimeTyper());
KeycloakConfig kcConfig = new KeycloakConfig();
kcConfig.setEnabled(false);
final KeycloakProxyAuthenticator auth = new KeycloakProxyAuthenticator(kcConfig, config);
ScriptEngine scriptEngine = new ScriptEngine(dfm);
proxy = new HttpProxy(config, bootOpts, new ProxyAcceptHandler(config, storeManager, contentController, auth, core.getCache(), scriptEngine));
proxy.start();
}
Aggregations