Skip to content

Commit

Permalink
Fixed the state in ESMPTransportProfile
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Dec 10, 2023
1 parent 5f96b24 commit 6104c8d
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 44 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ They depend on several other libraries so I suggest you are going for the Maven

# News and noteworthy

* v9.1.3 - 2023-12-10
* Fixed the state in `ESMPTransportProfile`
* v9.1.2 - 2023-12-06
* Added new submodule `peppol-mlr`. It contains data structures to read and write Peppol Message Level Response messages.
* v9.1.1 - 2023-11-22
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,83 +36,53 @@ public enum ESMPTransportProfile implements ISMPTransportProfile
* The Peppol START transport profile
*/
@Deprecated (forRemoval = false)
TRANSPORT_PROFILE_START("busdox-transport-start", "START")
{
@Override
public boolean isDeprecated ()
{
return true;
}
},
TRANSPORT_PROFILE_START("busdox-transport-start", "START", ESMPTransportProfileState.DEPRECATED),

/**
* The Peppol AS2 transport profile v1 (SHA-1).<br>
* Updated with AS2 v2 on 2020-02-01<br>
* Removed from Peppol per 2023-02-24
*/
@Deprecated (forRemoval = false)
TRANSPORT_PROFILE_AS2("busdox-transport-as2-ver1p0", "Peppol AS2 v1")
{
@Override
public boolean isDeprecated ()
{
return true;
}
},
TRANSPORT_PROFILE_AS2("busdox-transport-as2-ver1p0", "Peppol AS2 v1", ESMPTransportProfileState.DEPRECATED),

/**
* The Peppol AS2 v2 transport profile v2 (SHA-256).<br>
* Mandatory (when using AS2) in Peppol since 2020-02-01.<br>
* Removed from Peppol per 2023-02-24
*/
@Deprecated (forRemoval = false)
TRANSPORT_PROFILE_AS2_V2("busdox-transport-as2-ver2p0", "Peppol AS2 v2")
{
@Override
public boolean isDeprecated ()
{
return true;
}
},
TRANSPORT_PROFILE_AS2_V2("busdox-transport-as2-ver2p0", "Peppol AS2 v2", ESMPTransportProfileState.DEPRECATED),

/** The AS4 transport profile - too unspecific. Don't use */
@Deprecated (forRemoval = false)
TRANSPORT_PROFILE_AS4("busdox-transport-ebms3-as4", "AS4")
{
@Override
public boolean isDeprecated ()
{
return true;
}
},
TRANSPORT_PROFILE_AS4("busdox-transport-ebms3-as4", "AS4", ESMPTransportProfileState.DEPRECATED),

/** The CEF AS4 transport profile */
TRANSPORT_PROFILE_BDXR_AS4 ("bdxr-transport-ebms3-as4-v1p0", "CEF AS4"),
TRANSPORT_PROFILE_BDXR_AS4 ("bdxr-transport-ebms3-as4-v1p0", "CEF AS4", ESMPTransportProfileState.ACTIVE),

/**
* The Peppol AS4 profile v1.
*
* @deprecated for {@link #TRANSPORT_PROFILE_PEPPOL_AS4_V2}
*/
@Deprecated (forRemoval = false)
TRANSPORT_PROFILE_PEPPOL_AS4("peppol-transport-as4-v1_0", "Peppol AS4 v1")
{
@Override
public boolean isDeprecated ()
{
return true;
}
},
TRANSPORT_PROFILE_PEPPOL_AS4("peppol-transport-as4-v1_0", "Peppol AS4 v1", ESMPTransportProfileState.DEPRECATED),

/** The Peppol AS4 profile v2 */
TRANSPORT_PROFILE_PEPPOL_AS4_V2 ("peppol-transport-as4-v2_0", "Peppol AS4 v2");
TRANSPORT_PROFILE_PEPPOL_AS4_V2 ("peppol-transport-as4-v2_0", "Peppol AS4 v2", ESMPTransportProfileState.ACTIVE);

private final String m_sID;
private final String m_sName;
private final ESMPTransportProfileState m_eState;

ESMPTransportProfile (@Nonnull @Nonempty final String sID, @Nonnull @Nonempty final String sName)
ESMPTransportProfile (@Nonnull @Nonempty final String sID,
@Nonnull @Nonempty final String sName,
@Nonnull final ESMPTransportProfileState eState)
{
m_sID = sID;
m_sName = sName;
m_eState = eState;
}

@Nonnull
Expand All @@ -135,6 +105,12 @@ public String getName ()
return m_sName;
}

@Nonnull
public ESMPTransportProfileState getState ()
{
return m_eState;
}

/**
* Find the pre-defined transport profile with the passed ID.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (C) 2015-2023 Philip Helger
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.peppol.smp;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import com.helger.commons.string.StringHelper;

/**
* Test class for class {@link ESMPTransportProfile}.
*
* @author Philip Helger
*/
public final class ESMPTransportProfileTest
{
@SuppressWarnings ("deprecation")
@Test
public void testBasic ()
{
for (final ESMPTransportProfile e : ESMPTransportProfile.values ())
{
assertTrue (StringHelper.hasText (e.getID ()));
assertSame (e, ESMPTransportProfile.getFromIDOrNull (e.getID ()));
}
assertSame (ESMPTransportProfileState.ACTIVE, ESMPTransportProfile.TRANSPORT_PROFILE_PEPPOL_AS4_V2.getState ());
assertFalse (ESMPTransportProfile.TRANSPORT_PROFILE_PEPPOL_AS4_V2.isDeprecated ());

assertSame (ESMPTransportProfileState.DEPRECATED, ESMPTransportProfile.TRANSPORT_PROFILE_AS4.getState ());
assertTrue (ESMPTransportProfile.TRANSPORT_PROFILE_AS4.isDeprecated ());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public void testBasic ()
assertEquals ("id", aTP.getID ());
assertEquals ("name", aTP.getName ());
CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aTP, new SMPTransportProfile ("id", "name"));
CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aTP, new SMPTransportProfile ("id2", "name"));
CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aTP,
new SMPTransportProfile ("id2", "name"));
CommonsTestHelper.testDefaultSerialization (aTP);
XMLTestHelper.testMicroTypeConversion (aTP);

Expand Down

0 comments on commit 6104c8d

Please sign in to comment.