Skip to content

Commit d00f5c2

Browse files
authored
Fix Cassandra store manager toArtifactStore pathstyle missing issue (#2019)
1 parent fbedb42 commit d00f5c2

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

db/cassandra/src/main/java/org/commonjava/indy/cassandra/data/CassandraStoreDataManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.commonjava.indy.model.core.ArtifactStore;
2525
import org.commonjava.indy.model.core.Group;
2626
import org.commonjava.indy.model.core.HostedRepository;
27+
import org.commonjava.indy.model.core.PathStyle;
2728
import org.commonjava.indy.model.core.RemoteRepository;
2829
import org.commonjava.indy.model.core.StoreKey;
2930
import org.commonjava.indy.model.core.StoreType;
@@ -412,6 +413,7 @@ private ArtifactStore toArtifactStore( final DtxArtifactStore dtxArtifactStore )
412413
store.setPathMaskPatterns( dtxArtifactStore.getPathMaskPatterns() );
413414
store.setDisableTimeout( dtxArtifactStore.getDisableTimeout() );
414415
store.setAuthoritativeIndex( dtxArtifactStore.getAuthoritativeIndex() );
416+
store.setPathStyle( PathStyle.valueOf( dtxArtifactStore.getPathStyle() ) );
415417
}
416418
return store;
417419
}

models/core-java/src/test/java/org/commonjava/indy/model/model/RemoteRepositoryTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
import org.commonjava.indy.model.core.io.IndyObjectMapper;
2323
import org.junit.Test;
2424

25+
import java.io.IOException;
2526
import java.lang.reflect.InvocationTargetException;
2627
import java.util.Collections;
2728
import java.util.stream.Stream;
2829

2930
import static org.hamcrest.CoreMatchers.equalTo;
3031
import static org.junit.Assert.assertThat;
32+
import static org.junit.Assert.assertTrue;
3133
import static org.junit.Assert.fail;
3234

3335
/**
@@ -61,6 +63,23 @@ public void serializeRemoteWithKeyPemAndPassword()
6163
System.out.println( json );
6264
}
6365

66+
@Test
67+
public void serializeRemoteWithPathStyle() throws IOException
68+
{
69+
RemoteRepository remote = new RemoteRepository( "generic-http", "test", "http://test.com/repo" );
70+
remote.setPathStyle( PathStyle.hashed );
71+
IndyObjectMapper mapper = new IndyObjectMapper( true );
72+
mapper.init();
73+
74+
String json = mapper.writeValueAsString( remote );
75+
76+
System.out.println( json );
77+
78+
RemoteRepository ret = mapper.readValue( json.getBytes(), RemoteRepository.class );
79+
System.out.println( ret.getPathStyle() );
80+
assertTrue( ret.getPathStyle() == PathStyle.hashed );
81+
}
82+
6483
@Test
6584
public void copyFidelity()
6685
{

0 commit comments

Comments
 (0)