Search in sources :

Example 6 with AttributesKey

use of de.metas.material.event.commons.AttributesKey in project metasfresh-webui-api by metasfresh.

the class AvailableToPromiseAdapterTests method extractType_attributeSet.

@Test
public void extractType_attributeSet() {
    final AttributesKey attributesKey = AttributesKey.ofAttributeValueIds(12345);
    final Group.Type type = availableToPromiseAdapter.extractType(attributesKey);
    assertThat(type).isSameAs(Type.ATTRIBUTE_SET);
}
Also used : Group(de.metas.ui.web.material.adapter.AvailableToPromiseResultForWebui.Group) AttributesKey(de.metas.material.event.commons.AttributesKey) Type(de.metas.ui.web.material.adapter.AvailableToPromiseResultForWebui.Group.Type) Test(org.junit.Test)

Example 7 with AttributesKey

use of de.metas.material.event.commons.AttributesKey in project metasfresh-webui-api by metasfresh.

the class AvailableToPromiseAdapterTests method extractAttributeSetFromStorageAttributesKey.

@Test
public void extractAttributeSetFromStorageAttributesKey() {
    final I_M_Attribute attr1 = attributesTestHelper.createM_Attribute("attr1", X_M_Attribute.ATTRIBUTEVALUETYPE_List, true);
    final I_M_AttributeValue attributeValue1 = attributesTestHelper.createM_AttributeValue(attr1, "value1");
    final I_M_Attribute attr2 = attributesTestHelper.createM_Attribute("attr2", X_M_Attribute.ATTRIBUTEVALUETYPE_List, true);
    final I_M_AttributeValue attributeValue2 = attributesTestHelper.createM_AttributeValue(attr2, "value2");
    // invoke the method under test
    final AttributesKey attributesKey = AttributesKey.ofAttributeValueIds(attributeValue1.getM_AttributeValue_ID(), attributeValue2.getM_AttributeValue_ID());
    final List<I_M_AttributeValue> result = availableToPromiseAdapter.extractAttributeSetFromStorageAttributesKey(attributesKey);
    assertThat(result).hasSize(2);
    assertThat(result).anySatisfy(attributeValue -> {
        assertThatModel(attributeValue).hasSameIdAs(attributeValue1);
        assertThat(attributeValue.getValue()).isEqualTo("value1");
    });
    assertThat(result).anySatisfy(attributeValue -> {
        assertThatModel(attributeValue).hasSameIdAs(attributeValue2);
        assertThat(attributeValue.getValue()).isEqualTo("value2");
    });
}
Also used : AttributesKey(de.metas.material.event.commons.AttributesKey) I_M_Attribute(org.compiere.model.I_M_Attribute) I_M_AttributeValue(org.compiere.model.I_M_AttributeValue) Test(org.junit.Test)

Aggregations

AttributesKey (de.metas.material.event.commons.AttributesKey)7 Test (org.junit.Test)3 Type (de.metas.ui.web.material.adapter.AvailableToPromiseResultForWebui.Group.Type)2 I_M_AttributeValue (org.compiere.model.I_M_AttributeValue)2 ImmutableList (com.google.common.collect.ImmutableList)1 DimensionSpecGroup (de.metas.dimension.DimensionSpecGroup)1 I_M_Warehouse (de.metas.handlingunits.model.I_M_Warehouse)1 I_MD_Cockpit (de.metas.material.cockpit.model.I_MD_Cockpit)1 I_MD_Stock (de.metas.material.cockpit.model.I_MD_Stock)1 Quantity (de.metas.quantity.Quantity)1 Group (de.metas.ui.web.material.adapter.AvailableToPromiseResultForWebui.Group)1 GroupBuilder (de.metas.ui.web.material.adapter.AvailableToPromiseResultForWebui.Group.GroupBuilder)1 MaterialCockpitRow (de.metas.ui.web.material.cockpit.MaterialCockpitRow)1 CreateRowsRequest (de.metas.ui.web.material.cockpit.rowfactory.MaterialCockpitRowFactory.CreateRowsRequest)1 Timestamp (java.sql.Timestamp)1 IAttributeSetInstanceBL (org.adempiere.mm.attributes.api.IAttributeSetInstanceBL)1 I_M_Attribute (org.compiere.model.I_M_Attribute)1 I_M_AttributeSetInstance (org.compiere.model.I_M_AttributeSetInstance)1