use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.
the class AffectedStoreRecordTest method recordUploadsSorted.
@Test
public void recordUploadsSorted() throws Exception {
final StoreType type = StoreType.group;
final String name = "test-group";
final AffectedStoreRecord record = new AffectedStoreRecord(new StoreKey(type, name));
record.add("/path/two", StoreEffect.UPLOAD);
record.add("/path/one", StoreEffect.UPLOAD);
assertThat(record.getUploadedPaths().iterator().next(), equalTo("/path/one"));
}
use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.
the class AffectedStoreRecordTest method dontRecordNullDownload.
@Test
public void dontRecordNullDownload() throws Exception {
final StoreType type = StoreType.group;
final String name = "test-group";
final AffectedStoreRecord record = new AffectedStoreRecord(new StoreKey(type, name));
record.add(null, StoreEffect.DOWNLOAD);
assertThat(record.getDownloadedPaths(), nullValue());
}
use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.
the class TrackedContentEntryV1 method readExternal.
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
trackingKey = (TrackingKey) in.readObject();
final String storeKeyName = (String) in.readObject();
final StoreType storeType = StoreType.get((String) in.readObject());
storeKey = new StoreKey(storeType, storeKeyName);
final String accessChannelStr = (String) in.readObject();
accessChannel = "".equals(accessChannelStr) ? null : AccessChannel.valueOf(accessChannelStr);
final String pathStr = (String) in.readObject();
path = "".equals(pathStr) ? null : pathStr;
final String originUrlStr = (String) in.readObject();
originUrl = "".equals(originUrlStr) ? null : originUrlStr;
final String effectStr = (String) in.readObject();
effect = "".equals(effectStr) ? null : StoreEffect.valueOf(effectStr);
final String md5Str = (String) in.readObject();
md5 = "".equals(md5Str) ? null : md5Str;
final String sha1Str = (String) in.readObject();
sha1 = "".equals(sha1Str) ? null : sha1Str;
final String sha256Str = (String) in.readObject();
sha256 = "".equals(sha256Str) ? null : sha256Str;
size = (Long) in.readObject();
index = in.readLong();
}
use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.
the class ScheduleKey method readExternal.
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
final String storeKeyName = (String) in.readObject();
final StoreType storeType = StoreType.get((String) in.readObject());
final String packageType = (String) in.readObject();
storeKey = new StoreKey(packageType, storeType, storeKeyName);
final String typeStr = (String) in.readObject();
type = "".equals(typeStr) ? null : typeStr;
final String nameStr = (String) in.readObject();
name = "".equals(nameStr) ? null : nameStr;
groupName = ScheduleManagerUtils.groupName(storeKey, type);
}
use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.
the class ScheduleDBManager method storeKeyFrom.
public static StoreKey storeKeyFrom(final String group) {
final String[] parts = group.split("#");
if (parts.length > 1) {
final Logger logger = LoggerFactory.getLogger(ScheduleDBManager.class);
StoreKey storeKey = null;
try {
storeKey = StoreKey.fromString(parts[0]);
} catch (IllegalArgumentException e) {
logger.warn("Not a store key for string: {}", parts[0]);
}
// TODO this part of code may be obsolete, will need further check then remove
if (storeKey == null) {
logger.info("Not a store key for string: {}, will parse as store type", parts[0]);
final StoreType type = StoreType.get(parts[0]);
if (type != null) {
storeKey = new StoreKey(MavenPackageTypeDescriptor.MAVEN_PKG_KEY, type, parts[1]);
}
}
return storeKey;
}
return null;
}
Aggregations