.size());
}
@Test
public void testRegisterWithConsumerId() {
Consumer toSubmit = new Consumer(CONSUMER_NAME, USER_NAME, null,
standardSystemType);
toSubmit.setUuid("1023131");
toSubmit.getFacts().put(METADATA_NAME, METADATA_VALUE);
Consumer submitted = consumerResource.create(
toSubmit,
TestUtil.createPrincipal(someuser.getUsername(), owner, Access.ALL),
null, null, null);
assertNotNull(submitted);
assertEquals(toSubmit.getUuid(), submitted.getUuid());
assertNotNull(consumerCurator.find(submitted.getId()));
assertEquals(standardSystemType.getLabel(), submitted.getType()
.getLabel());
assertEquals(METADATA_VALUE, submitted.getFact(METADATA_NAME));
// now pass in consumer type with null id just like the client would
ConsumerType type = new ConsumerType(standardSystemType.getLabel());
assertNull(type.getId());
Consumer nulltypeid = new Consumer(CONSUMER_NAME, USER_NAME, null, type);
submitted = consumerResource.create(
nulltypeid,
TestUtil.createPrincipal(someuser.getUsername(), owner, Access.ALL),
null, null, null);
assertNotNull(submitted);
assertEquals(nulltypeid.getUuid(), submitted.getUuid());
assertNotNull(submitted.getType().getId());
}