io.elsci.signals.mock.assets.TestObjectsFactory Maven / Gradle / Ivy
package io.elsci.signals.mock.assets;
import io.elsci.signals.sdk.assets.Asset;
import io.elsci.signals.sdk.assets.AssetType;
import io.elsci.signals.sdk.attributes.Attribute;
import io.elsci.signals.sdk.attributes.AttributeType;
import io.qala.datagen.RandomValue;
import org.bson.types.ObjectId;
import java.time.LocalDateTime;
import java.util.List;
import static io.qala.datagen.RandomShortApi.*;
public class TestObjectsFactory {
public static Asset protein() {
LocalDateTime createdAt = LocalDateTime.now();
return new Asset("asset:" + new ObjectId().toHexString(),
"ELSCI-PRT-" + numeric(6),
blankOr(alphanumeric(1, 20)), AssetType.PROTEIN,
createdAt, createdAt
);
}
public static Attribute projects(String attributeName, List projectNames) {
return new Attribute(
"attribute:" + positiveLong(),
attributeName,
AttributeType.options,
alphanumeric(0, 100),
projectNames
);
}
public static Attribute projects(String attributeName, int numOfProjects) {
return new Attribute(
"attribute:" + positiveLong(),
attributeName,
AttributeType.options,
alphanumeric(0, 100),
RandomValue.between(numOfProjects, numOfProjects).alphanumerics()
);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy