use of com.ctrip.framework.apollo.biz.entity.Audit in project apollo by ctripcorp.
the class AdminServiceTest method testCreateNewApp.
@Test
public void testCreateNewApp() {
String appId = "someAppId";
App app = new App();
app.setAppId(appId);
app.setName("someAppName");
String owner = "someOwnerName";
app.setOwnerName(owner);
app.setOwnerEmail("someOwnerName@ctrip.com");
app.setDataChangeCreatedBy(owner);
app.setDataChangeLastModifiedBy(owner);
app.setDataChangeCreatedTime(new Date());
app = adminService.createNewApp(app);
Assert.assertEquals(appId, app.getAppId());
List<Cluster> clusters = clusterService.findParentClusters(app.getAppId());
Assert.assertEquals(1, clusters.size());
Assert.assertEquals(ConfigConsts.CLUSTER_NAME_DEFAULT, clusters.get(0).getName());
List<Namespace> namespaces = namespaceService.findNamespaces(appId, clusters.get(0).getName());
Assert.assertEquals(1, namespaces.size());
Assert.assertEquals(ConfigConsts.NAMESPACE_APPLICATION, namespaces.get(0).getNamespaceName());
List<Audit> audits = auditService.findByOwner(owner);
Assert.assertEquals(4, audits.size());
}
use of com.ctrip.framework.apollo.biz.entity.Audit in project apollo by ctripcorp.
the class AuditService method audit.
@Transactional
void audit(String entityName, Long entityId, Audit.OP op, String owner) {
Audit audit = new Audit();
audit.setEntityName(entityName);
audit.setEntityId(entityId);
audit.setOpName(op.name());
audit.setDataChangeCreatedBy(owner);
auditRepository.save(audit);
}
Aggregations