All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.elsci.signals.mock.assets.TestObjectsFactory Maven / Gradle / Ivy

There is a newer version: 20231025.1145-36
Show newest version
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