示例#1
0
  @Test
  public void testDynamicQueryByProjectionExisting() throws Exception {
    ExportImportConfiguration newExportImportConfiguration = addExportImportConfiguration();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(
            ExportImportConfiguration.class, ExportImportConfiguration.class.getClassLoader());

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("exportImportConfigurationId"));

    Object newExportImportConfigurationId =
        newExportImportConfiguration.getExportImportConfigurationId();

    dynamicQuery.add(
        RestrictionsFactoryUtil.in(
            "exportImportConfigurationId", new Object[] {newExportImportConfigurationId}));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Object existingExportImportConfigurationId = result.get(0);

    Assert.assertEquals(existingExportImportConfigurationId, newExportImportConfigurationId);
  }
  @Override
  protected void doDelete(Object obj) throws Exception {
    ExportImportConfiguration exportImportConfiguration = (ExportImportConfiguration) obj;

    deleteDocument(
        exportImportConfiguration.getCompanyId(),
        exportImportConfiguration.getExportImportConfigurationId());
  }
示例#3
0
  @Test
  public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
    ExportImportConfiguration newExportImportConfiguration = addExportImportConfiguration();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(
            ExportImportConfiguration.class, ExportImportConfiguration.class.getClassLoader());

    dynamicQuery.add(
        RestrictionsFactoryUtil.eq(
            "exportImportConfigurationId",
            newExportImportConfiguration.getExportImportConfigurationId()));

    List<ExportImportConfiguration> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    ExportImportConfiguration existingExportImportConfiguration = result.get(0);

    Assert.assertEquals(existingExportImportConfiguration, newExportImportConfiguration);
  }
示例#4
0
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    ExportImportConfiguration newExportImportConfiguration = _persistence.create(pk);

    newExportImportConfiguration.setMvccVersion(ServiceTestUtil.nextLong());

    newExportImportConfiguration.setGroupId(ServiceTestUtil.nextLong());

    newExportImportConfiguration.setCompanyId(ServiceTestUtil.nextLong());

    newExportImportConfiguration.setUserId(ServiceTestUtil.nextLong());

    newExportImportConfiguration.setUserName(ServiceTestUtil.randomString());

    newExportImportConfiguration.setCreateDate(ServiceTestUtil.nextDate());

    newExportImportConfiguration.setModifiedDate(ServiceTestUtil.nextDate());

    newExportImportConfiguration.setName(ServiceTestUtil.randomString());

    newExportImportConfiguration.setDescription(ServiceTestUtil.randomString());

    newExportImportConfiguration.setType(ServiceTestUtil.nextInt());

    newExportImportConfiguration.setSettings(ServiceTestUtil.randomString());

    newExportImportConfiguration.setStatus(ServiceTestUtil.nextInt());

    newExportImportConfiguration.setStatusByUserId(ServiceTestUtil.nextLong());

    newExportImportConfiguration.setStatusByUserName(ServiceTestUtil.randomString());

    newExportImportConfiguration.setStatusDate(ServiceTestUtil.nextDate());

    _persistence.update(newExportImportConfiguration);

    ExportImportConfiguration existingExportImportConfiguration =
        _persistence.findByPrimaryKey(newExportImportConfiguration.getPrimaryKey());

    Assert.assertEquals(
        existingExportImportConfiguration.getMvccVersion(),
        newExportImportConfiguration.getMvccVersion());
    Assert.assertEquals(
        existingExportImportConfiguration.getExportImportConfigurationId(),
        newExportImportConfiguration.getExportImportConfigurationId());
    Assert.assertEquals(
        existingExportImportConfiguration.getGroupId(), newExportImportConfiguration.getGroupId());
    Assert.assertEquals(
        existingExportImportConfiguration.getCompanyId(),
        newExportImportConfiguration.getCompanyId());
    Assert.assertEquals(
        existingExportImportConfiguration.getUserId(), newExportImportConfiguration.getUserId());
    Assert.assertEquals(
        existingExportImportConfiguration.getUserName(),
        newExportImportConfiguration.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingExportImportConfiguration.getCreateDate()),
        Time.getShortTimestamp(newExportImportConfiguration.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingExportImportConfiguration.getModifiedDate()),
        Time.getShortTimestamp(newExportImportConfiguration.getModifiedDate()));
    Assert.assertEquals(
        existingExportImportConfiguration.getName(), newExportImportConfiguration.getName());
    Assert.assertEquals(
        existingExportImportConfiguration.getDescription(),
        newExportImportConfiguration.getDescription());
    Assert.assertEquals(
        existingExportImportConfiguration.getType(), newExportImportConfiguration.getType());
    Assert.assertEquals(
        existingExportImportConfiguration.getSettings(),
        newExportImportConfiguration.getSettings());
    Assert.assertEquals(
        existingExportImportConfiguration.getStatus(), newExportImportConfiguration.getStatus());
    Assert.assertEquals(
        existingExportImportConfiguration.getStatusByUserId(),
        newExportImportConfiguration.getStatusByUserId());
    Assert.assertEquals(
        existingExportImportConfiguration.getStatusByUserName(),
        newExportImportConfiguration.getStatusByUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingExportImportConfiguration.getStatusDate()),
        Time.getShortTimestamp(newExportImportConfiguration.getStatusDate()));
  }