示例#1
0
 def __init__(self, server):
     self.client = IngesterPlatformAPI(server, None)
from jcudc24ingesterapi.models.data_entry import DataEntry
from jcudc24ingesterapi.ingester_platform_api import IngesterPlatformAPI
from jcudc24ingesterapi.authentication import CredentialsAuthentication
from jcudc24ingesterapi.models.metadata import MetadataEntry
from jcudc24ingesterapi.schemas.metadata_schemas import DataEntryMetadataSchema, DatasetMetadataSchema
from jcudc24ingesterapi.models.sampling import RepeatSampling, PeriodicSampling, CustomSampling
from jcudc24ingesterapi.ingester_exceptions import UnsupportedSchemaError, InvalidObjectError, UnknownObjectError, AuthenticationError
from jcudc24ingesterapi.schemas.data_entry_schemas import DataEntrySchema

if len(sys.argv) > 1:
    tree_url = sys.argv[1]
else:
    tree_url = "http://emu.hpc.jcu.edu.au/tree/split/"

auth = CredentialsAuthentication("casey", "password")
ingester_platform = IngesterPlatformAPI("http://localhost:8080/api", auth)

# Setup the file storage schema
file_schema = DataEntrySchema("arduino_file")
file_schema.addAttr(FileDataType("file"))
file_schema = ingester_platform.post(file_schema)

temp_schema = DataEntrySchema("temperature_reading")
temp_schema.addAttr(Double("temp"))
temp_schema = ingester_platform.post(temp_schema)

# Setup the location
loc = Location(-19.34427, 146.784197, "Mt Stuart", 100, None)
loc = ingester_platform.post(loc)

# Create the dataset to store the data in
 def setUp(self):
     self.auth = CredentialsAuthentication("casey", "password")
     self.ingester_platform = IngesterPlatformAPI(
         "http://localhost:8080/api", self.auth)
     self.cleanup_files = []