use of com.iggroup.oss.sample.domain.Sample in project RESTdoclet by IG-Group.
the class AbstractSampleServiceTest method getAvailableRef.
/**
* Find an available reference by adding 1 to the largest existing reference
* number
*
* @return unique reference
*/
private String getAvailableRef() {
Long availRef = new Long(0);
List<Sample> samples = service.findAllSamples();
for (Sample s : samples) {
Long ref = Long.valueOf(s.getReference());
if (ref >= availRef) {
availRef = ref + 1;
}
}
return new SampleReference(availRef).toString();
}
use of com.iggroup.oss.sample.domain.Sample in project RESTdoclet by IG-Group.
the class AbstractSampleServiceTest method testGetSampleByReference.
/**
* Success test case for getSampleByReference
*/
@Test
public void testGetSampleByReference() {
try {
Sample sample = service.getSampleByReference("00001");
assertTrue(sample.getReference().equalsIgnoreCase("00001"));
} catch (Exception se) {
assertTrue(false);
}
}
use of com.iggroup.oss.sample.domain.Sample in project RESTdoclet by IG-Group.
the class AbstractSampleServiceTest method testCreateSample.
/**
* Success test case for createSample
*/
@Test
public void testCreateSample() {
try {
service.createSample(new Sample(getAvailableRef(), "New Sample", SampleType.BOOK));
assertTrue(true);
} catch (Exception e) {
assertTrue(false);
}
}
use of com.iggroup.oss.sample.domain.Sample in project RESTdoclet by IG-Group.
the class AbstractSampleServiceTest method testDeleteSample.
/**
* Success test case for deleteSample
*/
@Test
public void testDeleteSample() {
String tempRef = getAvailableRef();
try {
service.createSample(new Sample(tempRef, "New Sample", SampleType.BOOK));
service.deleteSample(tempRef);
} catch (Exception e) {
assertTrue(false);
}
try {
service.getSampleByReference(tempRef);
assertTrue(false);
} catch (Exception e) {
assertTrue(true);
}
}
use of com.iggroup.oss.sample.domain.Sample in project RESTdoclet by IG-Group.
the class SampleServiceImpl method getSampleByReference.
@Profiled
@Override
public Sample getSampleByReference(String reference) {
Sample sample;
sample = sampleDAO.loadSample(reference);
return sample;
}
Aggregations