Added tests. Also bringing over sample, subsample, chemical analysis APIs from other repository.