hhuijser/liferay-portal — pull request #1545 by daledotshan (2013-10-12 07:23:04+00:00)
Title: LPS-29125 - add unit test

Hey Hugo,
For testValidVirtualHost method I use @Ignore instead of @Transactional since if I use @Transactional it will cause the field _virtualHostname of CompanyImpl class can not be updated, thus it cause the unit test fail. But I did not add any annotation for testValidVirtualHost, the unit test will pass test, but I worry this will leave garbage data in database thus I add a @Ignore annotation

My thoughts, probably there is a bug with @Transactional annotation or some bug in cache implementation of CompanyImpl class

Here is the code snippet of getVirtualHostname method of CompanyImpl class

@Override
public String getVirtualHostname() {
if (_virtualHostname != null) {
return _virtualHostname;
}

VirtualHost virtualHost = null;

try {
virtualHost = VirtualHostLocalServiceUtil.fetchVirtualHost(
getCompanyId(), 0);
}
catch (Exception e) {
}

if (virtualHost == null) {
return StringPool.BLANK;
}

_virtualHostname = virtualHost.getHostname();

return _virtualHostname;
}

If I removed following code
if (_virtualHostname != null) {
return _virtualHostname;
}