Search in sources :

Example 36 with DataFile

use of org.commonjava.indy.subsys.datafile.DataFile in project indy by Commonjava.

the class LegacyDataMigrationActionTest method dataFileMigrationForExistingHostedRepoJSON.

@Test
public void dataFileMigrationForExistingHostedRepoJSON() throws Exception {
    final DataFile dir = dfm.getDataFile(INDY_STORE, hosted.singularEndpointName());
    dir.mkdirs();
    final DataFile old = dfm.getDataFile(INDY_STORE, hosted.singularEndpointName(), "test.json");
    final DataFile migrated = dfm.getDataFile(INDY_STORE, MAVEN_PKG_KEY, hosted.singularEndpointName(), "test.json");
    String srcJson = "{\"name\": \"test\", \"type\" : \"hosted\", \"packageType\": \"maven\", \"key\": \"maven:hosted:test\"}";
    old.writeString(srcJson, new ChangeSummary(ChangeSummary.SYSTEM_USER, "test repo creation"));
    migrated.writeString(srcJson, new ChangeSummary(ChangeSummary.SYSTEM_USER, "test repo creation"));
    final boolean result = action.migrate();
    assertThat(result, equalTo(false));
}
Also used : DataFile(org.commonjava.indy.subsys.datafile.DataFile) ChangeSummary(org.commonjava.indy.audit.ChangeSummary) Test(org.junit.Test)

Aggregations

DataFile (org.commonjava.indy.subsys.datafile.DataFile)36 ChangeSummary (org.commonjava.indy.audit.ChangeSummary)21 IOException (java.io.IOException)16 Test (org.junit.Test)14 IndyDataException (org.commonjava.indy.data.IndyDataException)5 StoreKey (org.commonjava.indy.model.core.StoreKey)5 File (java.io.File)3 HashMap (java.util.HashMap)3 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)3 StoreType (org.commonjava.indy.model.core.StoreType)3 ValidationRuleMapping (org.commonjava.indy.promote.validate.model.ValidationRuleMapping)3 DataFileEvent (org.commonjava.indy.subsys.datafile.change.DataFileEvent)3 Logger (org.slf4j.Logger)3 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 CompilationFailedException (org.codehaus.groovy.control.CompilationFailedException)2 IndyLifecycleException (org.commonjava.indy.action.IndyLifecycleException)2 ValidationRuleSet (org.commonjava.indy.promote.model.ValidationRuleSet)2 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)2 Template (groovy.text.Template)1