-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- push products to alberta - camel unit test
refs: #10818
- Loading branch information
Showing
22 changed files
with
906 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ql/postgresql/system/80-de.metas.externalsystem/5583210_sys_gh10818_ExportAudit_Index.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
-- 2021-03-21T12:00:17.968Z | ||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Ref_List_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value,ValueName) VALUES (0,0,542351,541255,TO_TIMESTAMP('2021-03-21 14:00:17','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Other',TO_TIMESTAMP('2021-03-21 14:00:17','YYYY-MM-DD HH24:MI:SS'),100,'Other','Other') | ||
; | ||
|
||
-- 2021-03-21T12:00:17.978Z | ||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Ref_List_ID=542351 AND NOT EXISTS (SELECT 1 FROM AD_Ref_List_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Ref_List_ID=t.AD_Ref_List_ID) | ||
; | ||
|
||
-- 2021-03-21T12:30:15.218Z | ||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
INSERT INTO AD_Index_Table (AD_Client_ID,AD_Index_Table_ID,AD_Org_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsUnique,Name,Processing,Updated,UpdatedBy) VALUES (0,540576,0,541603,TO_TIMESTAMP('2021-03-21 14:30:15','YYYY-MM-DD HH24:MI:SS'),100,'U','Y','N','idx_ExternalSystemExportAudit_RecordId_TableId_System','N',TO_TIMESTAMP('2021-03-21 14:30:15','YYYY-MM-DD HH24:MI:SS'),100) | ||
; | ||
|
||
-- 2021-03-21T12:30:15.221Z | ||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
INSERT INTO AD_Index_Table_Trl (AD_Language,AD_Index_Table_ID, ErrorMsg, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Index_Table_ID, t.ErrorMsg, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Index_Table t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Index_Table_ID=540576 AND NOT EXISTS (SELECT 1 FROM AD_Index_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Index_Table_ID=t.AD_Index_Table_ID) | ||
; | ||
|
||
-- 2021-03-21T12:30:33.074Z | ||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
INSERT INTO AD_Index_Column (AD_Client_ID,AD_Column_ID,AD_Index_Column_ID,AD_Index_Table_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,573189,541071,540576,0,TO_TIMESTAMP('2021-03-21 14:30:32','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',10,TO_TIMESTAMP('2021-03-21 14:30:32','YYYY-MM-DD HH24:MI:SS'),100) | ||
; | ||
|
||
-- 2021-03-21T12:30:41.849Z | ||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
INSERT INTO AD_Index_Column (AD_Client_ID,AD_Column_ID,AD_Index_Column_ID,AD_Index_Table_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,573190,541072,540576,0,TO_TIMESTAMP('2021-03-21 14:30:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',20,TO_TIMESTAMP('2021-03-21 14:30:41','YYYY-MM-DD HH24:MI:SS'),100) | ||
; | ||
|
||
-- 2021-03-21T12:30:57.850Z | ||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
INSERT INTO AD_Index_Column (AD_Client_ID,AD_Column_ID,AD_Index_Column_ID,AD_Index_Table_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,573194,541073,540576,0,TO_TIMESTAMP('2021-03-21 14:30:57','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',30,TO_TIMESTAMP('2021-03-21 14:30:57','YYYY-MM-DD HH24:MI:SS'),100) | ||
; | ||
|
||
-- 2021-03-21T12:31:01.783Z | ||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
UPDATE AD_Index_Table SET EntityType='D',Updated=TO_TIMESTAMP('2021-03-21 14:31:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Index_Table_ID=540576 | ||
; | ||
|
||
-- 2021-03-21T12:31:05.296Z | ||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
CREATE INDEX idx_ExternalSystemExportAudit_RecordId_TableId_System ON ExternalSystem_ExportAudit (Record_ID,AD_Table_ID,ExternalSystemType) | ||
; | ||
|
83 changes: 83 additions & 0 deletions
83
...ystem/src/test/java/de/metas/externalsystem/audit/ExternalSystemExportAuditRepoTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* #%L | ||
* de.metas.externalsystem | ||
* %% | ||
* Copyright (C) 2021 metas GmbH | ||
* %% | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, either version 2 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. If not, see | ||
* <http://www.gnu.org/licenses/gpl-2.0.html>. | ||
* #L% | ||
*/ | ||
|
||
package de.metas.externalsystem.audit; | ||
|
||
import de.metas.dlm.model.I_AD_Table; | ||
import de.metas.externalsystem.ExternalSystemType; | ||
import de.metas.process.PInstanceId; | ||
import de.metas.security.RoleId; | ||
import de.metas.user.UserId; | ||
import org.adempiere.model.InterfaceWrapperHelper; | ||
import org.adempiere.test.AdempiereTestHelper; | ||
import org.adempiere.util.lang.impl.TableRecordReference; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.Instant; | ||
|
||
import static org.assertj.core.api.Assertions.*; | ||
|
||
public class ExternalSystemExportAuditRepoTests | ||
{ | ||
private ExternalSystemExportAuditRepo externalSystemExportAuditRepo; | ||
|
||
@BeforeEach | ||
void beforeEach() | ||
{ | ||
AdempiereTestHelper.get().init(); | ||
externalSystemExportAuditRepo = new ExternalSystemExportAuditRepo(); | ||
} | ||
|
||
@Test | ||
public void createESExportAuditTest() | ||
{ | ||
//given | ||
final I_AD_Table testTable = InterfaceWrapperHelper.newInstance(I_AD_Table.class); | ||
testTable.setName("TestTable"); | ||
testTable.setTableName("TestTable"); | ||
InterfaceWrapperHelper.saveRecord(testTable); | ||
|
||
final CreateExportAuditRequest createExportAuditRequest = CreateExportAuditRequest.builder() | ||
.tableRecordReference(TableRecordReference.of(testTable.getAD_Table_ID(), 100)) | ||
.pInstanceId(PInstanceId.ofRepoId(1)) | ||
.exportTime(Instant.now()) | ||
.exportUserId(UserId.ofRepoId(1)) | ||
.exportRoleId(RoleId.ofRepoId(2)) | ||
.exportParameters("ExportParameters") | ||
.externalSystemType(ExternalSystemType.Shopware6) | ||
.build(); | ||
|
||
//when | ||
final ExternalSystemExportAudit audit = externalSystemExportAuditRepo.createESExportAudit(createExportAuditRequest); | ||
|
||
//then | ||
assertThat(audit).isNotNull(); | ||
assertThat(audit.getExportParameters()).isEqualTo(createExportAuditRequest.getExportParameters()); | ||
assertThat(audit.getExportTime()).isEqualTo(createExportAuditRequest.getExportTime()); | ||
assertThat(audit.getExportRoleId()).isEqualTo(createExportAuditRequest.getExportRoleId()); | ||
assertThat(audit.getExportUserId()).isEqualTo(createExportAuditRequest.getExportUserId()); | ||
assertThat(audit.getExternalSystemType()).isEqualTo(createExportAuditRequest.getExternalSystemType()); | ||
assertThat(audit.getPInstanceId()).isEqualTo(createExportAuditRequest.getPInstanceId()); | ||
assertThat(audit.getTableRecordReference()).isEqualTo(createExportAuditRequest.getTableRecordReference()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.