Skip to content

Commit

Permalink
- push products to alberta - camel unit test
Browse files Browse the repository at this point in the history
refs: #10818
  • Loading branch information
cp-ps committed Mar 22, 2021
1 parent b917c97 commit 965ec0f
Show file tree
Hide file tree
Showing 22 changed files with 906 additions and 86 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package de.metas.externalsystem.model;

import javax.annotation.Nullable;
import org.adempiere.model.ModelColumn;

import javax.annotation.Nullable;

/** Generated Interface for ExternalSystem_Config
* @author metasfresh (generated)
*/
Expand Down Expand Up @@ -57,7 +58,7 @@ public interface I_ExternalSystem_Config
* <br>Mandatory: true
* <br>Virtual Column: false
*/
void setCamelURL (java.lang.String CamelURL);
void setCamelURL (String CamelURL);

/**
* Get Camel-URL.
Expand All @@ -66,7 +67,7 @@ public interface I_ExternalSystem_Config
* <br>Mandatory: true
* <br>Virtual Column: false
*/
java.lang.String getCamelURL();
String getCamelURL();

ModelColumn<I_ExternalSystem_Config, Object> COLUMN_CamelURL = new ModelColumn<>(I_ExternalSystem_Config.class, "CamelURL", null);
String COLUMNNAME_CamelURL = "CamelURL";
Expand Down Expand Up @@ -103,7 +104,7 @@ public interface I_ExternalSystem_Config
* <br>Mandatory: false
* <br>Virtual Column: false
*/
void setDescription (@Nullable java.lang.String Description);
void setDescription (@Nullable String Description);

/**
* Get Description.
Expand All @@ -112,7 +113,7 @@ public interface I_ExternalSystem_Config
* <br>Mandatory: false
* <br>Virtual Column: false
*/
@Nullable java.lang.String getDescription();
@Nullable String getDescription();

ModelColumn<I_ExternalSystem_Config, Object> COLUMN_Description = new ModelColumn<>(I_ExternalSystem_Config.class, "Description", null);
String COLUMNNAME_Description = "Description";
Expand Down Expand Up @@ -168,7 +169,7 @@ public interface I_ExternalSystem_Config
* <br>Mandatory: true
* <br>Virtual Column: false
*/
void setName (java.lang.String Name);
void setName (String Name);

/**
* Get Name.
Expand All @@ -177,7 +178,7 @@ public interface I_ExternalSystem_Config
* <br>Mandatory: true
* <br>Virtual Column: false
*/
java.lang.String getName();
String getName();

ModelColumn<I_ExternalSystem_Config, Object> COLUMN_Name = new ModelColumn<>(I_ExternalSystem_Config.class, "Name", null);
String COLUMNNAME_Name = "Name";
Expand All @@ -190,7 +191,7 @@ public interface I_ExternalSystem_Config
* <br>Mandatory: true
* <br>Virtual Column: false
*/
void setType (java.lang.String Type);
void setType (String Type);

/**
* Get Type.
Expand All @@ -200,7 +201,7 @@ public interface I_ExternalSystem_Config
* <br>Mandatory: true
* <br>Virtual Column: false
*/
java.lang.String getType();
String getType();

ModelColumn<I_ExternalSystem_Config, Object> COLUMN_Type = new ModelColumn<>(I_ExternalSystem_Config.class, "Type", null);
String COLUMNNAME_Type = "Type";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Generated Model - DO NOT CHANGE
package de.metas.externalsystem.model;

import javax.annotation.Nullable;
import java.sql.ResultSet;
import java.util.Properties;
import javax.annotation.Nullable;

/** Generated Model for ExternalSystem_Config
* @author metasfresh (generated)
Expand All @@ -12,7 +12,7 @@
public class X_ExternalSystem_Config extends org.compiere.model.PO implements I_ExternalSystem_Config, org.compiere.model.I_Persistent
{

private static final long serialVersionUID = 483096565L;
private static final long serialVersionUID = 1716702547L;

/** Standard Constructor */
public X_ExternalSystem_Config (final Properties ctx, final int ExternalSystem_Config_ID, @Nullable final String trxName)
Expand All @@ -35,25 +35,25 @@ protected org.compiere.model.POInfo initPO(final Properties ctx)
}

@Override
public void setCamelURL (final java.lang.String CamelURL)
public void setCamelURL (final String CamelURL)
{
set_Value (COLUMNNAME_CamelURL, CamelURL);
}

@Override
public java.lang.String getCamelURL()
public String getCamelURL()
{
return get_ValueAsString(COLUMNNAME_CamelURL);
}

@Override
public void setDescription (final @Nullable java.lang.String Description)
public void setDescription (final @Nullable String Description)
{
set_Value (COLUMNNAME_Description, Description);
}

@Override
public java.lang.String getDescription()
public String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
Expand All @@ -74,13 +74,13 @@ public int getExternalSystem_Config_ID()
}

@Override
public void setName (final java.lang.String Name)
public void setName (final String Name)
{
set_Value (COLUMNNAME_Name, Name);
}

@Override
public java.lang.String getName()
public String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
Expand All @@ -94,14 +94,16 @@ public java.lang.String getName()
public static final String TYPE_Alberta = "A";
/** Shopware6 = S6 */
public static final String TYPE_Shopware6 = "S6";
/** Other = Other */
public static final String TYPE_Other = "Other";
@Override
public void setType (final java.lang.String Type)
public void setType (final String Type)
{
set_Value (COLUMNNAME_Type, Type);
}

@Override
public java.lang.String getType()
public String getType()
{
return get_ValueAsString(COLUMNNAME_Type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
public enum ExternalSystemType implements ReferenceListAwareEnum
{
Alberta(X_ExternalSystem_Config.TYPE_Alberta, "Alberta", InvokeAlbertaAction.class.getName()),
Shopware6(X_ExternalSystem_Config.TYPE_Shopware6, "Shopware6", InvokeShopware6Action.class.getName());
Shopware6(X_ExternalSystem_Config.TYPE_Shopware6, "Shopware6", InvokeShopware6Action.class.getName()),
Other(X_ExternalSystem_Config.TYPE_Other, "Other", null)
;

@Getter
private final String code;
Expand Down
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)
;

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());
}
}
8 changes: 8 additions & 0 deletions backend/de.metas.vertical.healthcare.alberta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
<version>${metasfresh.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>de.metas.adempiere.adempiere</groupId>
<artifactId>de.metas.adempiere.adempiere.base</artifactId>
<version>${metasfresh.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down

0 comments on commit 965ec0f

Please sign in to comment.