Skip to content

Commit

Permalink
Replaced deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Jul 6, 2023
1 parent ab32bed commit 9bcba07
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void testBasic ()
assertNotNull (aSGPeppol.getExtension ());
aSGPeppol.setServiceMetadataReferenceCollection (new com.helger.xsds.peppol.smp1.ServiceMetadataReferenceCollectionType ());

final Document aDoc = new SMPMarshallerServiceGroupType (true).getAsDocument (aSGPeppol);
final Document aDoc = new SMPMarshallerServiceGroupType ().getAsDocument (aSGPeppol);
assertNotNull (aDoc);
}

Expand Down Expand Up @@ -90,7 +90,7 @@ public void testBDXRExtension ()
aSGBDXR.setServiceMetadataReferenceCollection (new com.helger.xsds.bdxr.smp1.ServiceMetadataReferenceCollectionType ());
assertEquals (2, aSGBDXR.getExtension ().size ());

final Document aDoc = new BDXR1MarshallerServiceGroupType (true).getAsDocument (aSGBDXR);
final Document aDoc = new BDXR1MarshallerServiceGroupType ().getAsDocument (aSGBDXR);
assertNotNull (aDoc);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void testCreateAndDeleteServiceInformationJerseyClient ()
aSM.setServiceInformation (aSI);

if (false)
LOGGER.info (new SMPMarshallerServiceMetadataType (true).getAsString (aSM));
LOGGER.info (new SMPMarshallerServiceMetadataType ().getAsString (aSM));

final WebTarget aTarget = ClientBuilder.newClient ().target (m_aRule.getFullURL ());
Response aResponseMsg;
Expand All @@ -172,8 +172,8 @@ public void testCreateAndDeleteServiceInformationJerseyClient ()
try
{
// PUT ServiceGroup
aResponseMsg = _addCredentials (aTarget.path (sPI_LC)
.request ()).put (Entity.xml (m_aObjFactory.createServiceGroup (aSG)));
aResponseMsg = _addCredentials (aTarget.path (sPI_LC).request ()).put (Entity.xml (m_aObjFactory
.createServiceGroup (aSG)));
_testResponseJerseyClient (aResponseMsg, 200);

// Read both
Expand All @@ -188,19 +188,15 @@ public void testCreateAndDeleteServiceInformationJerseyClient ()
try
{
// PUT 1 ServiceInformation
aResponseMsg = _addCredentials (aTarget.path (sPI_LC)
.path ("services")
.path (sDT)
.request ()).put (Entity.xml (m_aObjFactory.createServiceMetadata (aSM)));
aResponseMsg = _addCredentials (aTarget.path (sPI_LC).path ("services").path (sDT).request ()).put (Entity
.xml (m_aObjFactory.createServiceMetadata (aSM)));
_testResponseJerseyClient (aResponseMsg, 200);
assertNotNull (SMPMetaManager.getServiceInformationMgr ()
.getSMPServiceInformationOfServiceGroupAndDocumentType (aServiceGroup, aDT));

// PUT 2 ServiceInformation
aResponseMsg = _addCredentials (aTarget.path (sPI_LC)
.path ("services")
.path (sDT)
.request ()).put (Entity.xml (m_aObjFactory.createServiceMetadata (aSM)));
aResponseMsg = _addCredentials (aTarget.path (sPI_LC).path ("services").path (sDT).request ()).put (Entity
.xml (m_aObjFactory.createServiceMetadata (aSM)));
_testResponseJerseyClient (aResponseMsg, 200);
assertNotNull (SMPMetaManager.getServiceInformationMgr ()
.getSMPServiceInformationOfServiceGroupAndDocumentType (aServiceGroup, aDT));
Expand Down Expand Up @@ -398,8 +394,8 @@ public void testCreateAndDeleteRedirectJerseyClient ()
try
{
// PUT ServiceGroup
aResponseMsg = _addCredentials (aTarget.path (sPI_LC)
.request ()).put (Entity.xml (m_aObjFactory.createServiceGroup (aSG)));
aResponseMsg = _addCredentials (aTarget.path (sPI_LC).request ()).put (Entity.xml (m_aObjFactory
.createServiceGroup (aSG)));
_testResponseJerseyClient (aResponseMsg, 200);

assertNotNull (aTarget.path (sPI_LC).request ().get (ServiceGroupType.class));
Expand All @@ -413,19 +409,15 @@ public void testCreateAndDeleteRedirectJerseyClient ()
try
{
// PUT 1 ServiceInformation
aResponseMsg = _addCredentials (aTarget.path (sPI_LC)
.path ("services")
.path (sDT)
.request ()).put (Entity.xml (m_aObjFactory.createServiceMetadata (aSM)));
aResponseMsg = _addCredentials (aTarget.path (sPI_LC).path ("services").path (sDT).request ()).put (Entity
.xml (m_aObjFactory.createServiceMetadata (aSM)));
_testResponseJerseyClient (aResponseMsg, 200);
assertNotNull (SMPMetaManager.getRedirectMgr ()
.getSMPRedirectOfServiceGroupAndDocumentType (aServiceGroup, aDT));

// PUT 2 ServiceInformation
aResponseMsg = _addCredentials (aTarget.path (sPI_LC)
.path ("services")
.path (sDT)
.request ()).put (Entity.xml (m_aObjFactory.createServiceMetadata (aSM)));
aResponseMsg = _addCredentials (aTarget.path (sPI_LC).path ("services").path (sDT).request ()).put (Entity
.xml (m_aObjFactory.createServiceMetadata (aSM)));
_testResponseJerseyClient (aResponseMsg, 200);
assertNotNull (SMPMetaManager.getRedirectMgr ()
.getSMPRedirectOfServiceGroupAndDocumentType (aServiceGroup, aDT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
{
// Unspecified extension
final com.helger.xsds.peppol.smp1.CompleteServiceGroupType ret = new SMPServerAPI (aDataProvider).getCompleteServiceGroup (sPathServiceGroupID);
aBytes = new SMPMarshallerCompleteServiceGroupType (XML_SCHEMA_VALIDATION).getAsBytes (ret);
aBytes = new SMPMarshallerCompleteServiceGroupType ().setUseSchema (XML_SCHEMA_VALIDATION).getAsBytes (ret);
break;
}
case OASIS_BDXR_V1:
{
// Unspecified extension
final com.helger.xsds.bdxr.smp1.CompleteServiceGroupType ret = new BDXR1ServerAPI (aDataProvider).getCompleteServiceGroup (sPathServiceGroupID);
aBytes = new BDXR1MarshallerCompleteServiceGroupType (XML_SCHEMA_VALIDATION).getAsBytes (ret);
aBytes = new BDXR1MarshallerCompleteServiceGroupType ().setUseSchema (XML_SCHEMA_VALIDATION).getAsBytes (ret);
break;
}
// Not supported with OASIS BDXR v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
case PEPPOL:
{
final com.helger.xsds.peppol.smp1.ServiceGroupType ret = new SMPServerAPI (aDataProvider).getServiceGroup (sPathServiceGroupID);
aBytes = new SMPMarshallerServiceGroupType (XML_SCHEMA_VALIDATION).getAsBytes (ret);
aBytes = new SMPMarshallerServiceGroupType ().setUseSchema (XML_SCHEMA_VALIDATION).getAsBytes (ret);
break;
}
case OASIS_BDXR_V1:
{
final com.helger.xsds.bdxr.smp1.ServiceGroupType ret = new BDXR1ServerAPI (aDataProvider).getServiceGroup (sPathServiceGroupID);
aBytes = new BDXR1MarshallerServiceGroupType (XML_SCHEMA_VALIDATION).getAsBytes (ret);
aBytes = new BDXR1MarshallerServiceGroupType ().setUseSchema (XML_SCHEMA_VALIDATION).getAsBytes (ret);
break;
}
case OASIS_BDXR_V2:
{
final com.helger.xsds.bdxr.smp2.ServiceGroupType ret = new BDXR2ServerAPI (aDataProvider).getServiceGroup (sPathServiceGroupID);
aBytes = new BDXR2MarshallerServiceGroup (XML_SCHEMA_VALIDATION).getAsBytes (ret);
aBytes = new BDXR2MarshallerServiceGroup ().setUseSchema (XML_SCHEMA_VALIDATION).getAsBytes (ret);
break;
}
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
{
case PEPPOL:
{
final com.helger.xsds.peppol.smp1.ServiceGroupType aServiceGroup = new SMPMarshallerServiceGroupType (XML_SCHEMA_VALIDATION).read (aServiceGroupDoc);
final com.helger.xsds.peppol.smp1.ServiceGroupType aServiceGroup = new SMPMarshallerServiceGroupType ().setUseSchema (XML_SCHEMA_VALIDATION)
.read (aServiceGroupDoc);
if (aServiceGroup != null)
{
new SMPServerAPI (aDataProvider).saveServiceGroup (sPathServiceGroupID,
Expand All @@ -90,7 +91,8 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
}
case OASIS_BDXR_V1:
{
final com.helger.xsds.bdxr.smp1.ServiceGroupType aServiceGroup = new BDXR1MarshallerServiceGroupType (XML_SCHEMA_VALIDATION).read (aServiceGroupDoc);
final com.helger.xsds.bdxr.smp1.ServiceGroupType aServiceGroup = new BDXR1MarshallerServiceGroupType ().setUseSchema (XML_SCHEMA_VALIDATION)
.read (aServiceGroupDoc);
if (aServiceGroup != null)
{
new BDXR1ServerAPI (aDataProvider).saveServiceGroup (sPathServiceGroupID,
Expand All @@ -103,7 +105,8 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
}
case OASIS_BDXR_V2:
{
final com.helger.xsds.bdxr.smp2.ServiceGroupType aServiceGroup = new BDXR2MarshallerServiceGroup (XML_SCHEMA_VALIDATION).read (aServiceGroupDoc);
final com.helger.xsds.bdxr.smp2.ServiceGroupType aServiceGroup = new BDXR2MarshallerServiceGroup ().setUseSchema (XML_SCHEMA_VALIDATION)
.read (aServiceGroupDoc);
if (aServiceGroup != null)
{
new BDXR2ServerAPI (aDataProvider).saveServiceGroup (sPathServiceGroupID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
sPathDocumentTypeID);

// Convert to DOM document
final SMPMarshallerSignedServiceMetadataType aMarshaller = new SMPMarshallerSignedServiceMetadataType ();
// Disable XSD check, because Signature is added later
final SMPMarshallerSignedServiceMetadataType aMarshaller = new SMPMarshallerSignedServiceMetadataType (false);
aMarshaller.setUseSchema (false);
aDoc = aMarshaller.getAsDocument (ret);
break;
}
Expand All @@ -84,8 +85,9 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
sPathDocumentTypeID);

// Convert to DOM document
final BDXR1MarshallerSignedServiceMetadataType aMarshaller = new BDXR1MarshallerSignedServiceMetadataType ();
// Disable XSD check, because Signature is added later
final BDXR1MarshallerSignedServiceMetadataType aMarshaller = new BDXR1MarshallerSignedServiceMetadataType (false);
aMarshaller.setUseSchema (false);
aDoc = aMarshaller.getAsDocument (ret);
break;
}
Expand All @@ -95,8 +97,9 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
sPathDocumentTypeID);

// Convert to DOM document
final BDXR2MarshallerServiceMetadata aMarshaller = new BDXR2MarshallerServiceMetadata ();
// Disable XSD check, because Signature is added later
final BDXR2MarshallerServiceMetadata aMarshaller = new BDXR2MarshallerServiceMetadata (false);
aMarshaller.setUseSchema (false);
aDoc = aMarshaller.getAsDocument (ret);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
{
case PEPPOL:
{
final com.helger.xsds.peppol.smp1.ServiceMetadataType aServiceMetadata = new SMPMarshallerServiceMetadataType (XML_SCHEMA_VALIDATION).read (aServiceMetadataDoc);
final com.helger.xsds.peppol.smp1.ServiceMetadataType aServiceMetadata = new SMPMarshallerServiceMetadataType ().setUseSchema (XML_SCHEMA_VALIDATION)
.read (aServiceMetadataDoc);
if (aServiceMetadata != null)
{
eSuccess = new SMPServerAPI (aDataProvider).saveServiceRegistration (sPathServiceGroupID,
Expand All @@ -89,7 +90,8 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
}
case OASIS_BDXR_V1:
{
final com.helger.xsds.bdxr.smp1.ServiceMetadataType aServiceMetadata = new BDXR1MarshallerServiceMetadataType (XML_SCHEMA_VALIDATION).read (aServiceMetadataDoc);
final com.helger.xsds.bdxr.smp1.ServiceMetadataType aServiceMetadata = new BDXR1MarshallerServiceMetadataType ().setUseSchema (XML_SCHEMA_VALIDATION)
.read (aServiceMetadataDoc);
if (aServiceMetadata != null)
{
eSuccess = new BDXR1ServerAPI (aDataProvider).saveServiceRegistration (sPathServiceGroupID,
Expand All @@ -101,7 +103,8 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
}
case OASIS_BDXR_V2:
{
final com.helger.xsds.bdxr.smp2.ServiceMetadataType aServiceMetadata = new BDXR2MarshallerServiceMetadata (XML_SCHEMA_VALIDATION).read (aServiceMetadataDoc);
final com.helger.xsds.bdxr.smp2.ServiceMetadataType aServiceMetadata = new BDXR2MarshallerServiceMetadata ().setUseSchema (XML_SCHEMA_VALIDATION)
.read (aServiceMetadataDoc);
if (aServiceMetadata != null)
{
eSuccess = new BDXR2ServerAPI (aDataProvider).saveServiceRegistration (sPathServiceGroupID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,17 @@ public void invokeAPI (@Nonnull final IAPIDescriptor aAPIDescriptor,
// Unspecified extension
final com.helger.xsds.peppol.smp1.ServiceGroupReferenceListType ret = new SMPServerAPI (aDataProvider).getServiceGroupReferenceList (sPathUserID,
aCredentials);
aBytes = new SMPMarshallerServiceGroupReferenceListType (XML_SCHEMA_VALIDATION).getAsBytes (ret);
aBytes = new SMPMarshallerServiceGroupReferenceListType ().setUseSchema (XML_SCHEMA_VALIDATION)
.getAsBytes (ret);
break;
}
case OASIS_BDXR_V1:
{
// Unspecified extension
final com.helger.xsds.bdxr.smp1.ServiceGroupReferenceListType ret = new BDXR1ServerAPI (aDataProvider).getServiceGroupReferenceList (sPathUserID,
aCredentials);
aBytes = new BDXR1MarshallerServiceGroupReferenceListType (XML_SCHEMA_VALIDATION).getAsBytes (ret);
aBytes = new BDXR1MarshallerServiceGroupReferenceListType ().setUseSchema (XML_SCHEMA_VALIDATION)
.getAsBytes (ret);
break;
}
// Not available in OASIS BDXR v2
Expand Down

0 comments on commit 9bcba07

Please sign in to comment.