Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support metadata props spread over several lines #73

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/lib/client/ManifestReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@
constructor(artifactDirectory: string) {
log.info(`Reading manifest from ${artifactDirectory}...`);
this.manifestEntries = new Map();
fs.readFileSync(path.join(artifactDirectory, 'META-INF', 'MANIFEST.MF'), 'utf-8')
.split(/\r?\n/)
.forEach((line) => {
const [key, value] = line.split(':');
if (key && value) {
this.manifestEntries.set(key.trim(), value.trim());
}
});
const lines = fs.readFileSync(path.join(artifactDirectory, 'META-INF', 'MANIFEST.MF'), 'utf-8').split(/\r?\n/);

Check failure on line 13 in src/lib/client/ManifestReader.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

src/test/integration/IntegrationFlow.test.ts > Integration flow > fetch an integration flow

Error: ENOENT: no such file or directory, open '/tmp/d-2024315-1832-5gxjx9.5cvnj/TestPackage/IntegrationFlow/META-INF/MANIFEST.MF' ❯ Object.openSync node:fs:596:3 ❯ Object.readFileSync node:fs:464:35 ❯ new ManifestReader src/lib/client/ManifestReader.ts:13:26 ❯ SCIRestClient.getArtifactMetadata src/lib/client/SCIRestClient.ts:405:32 ❯ src/test/integration/IntegrationFlow.test.ts:35:43 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { errno: -2, syscall: 'open', code: 'ENOENT', path: '/tmp/d-2024315-1832-5gxjx9.5cvnj/TestPackage/IntegrationFlow/META-INF/MANIFEST.MF' }

Check failure on line 13 in src/lib/client/ManifestReader.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

src/test/integration/IntegrationFlow.test.ts > Integration flow > fetch an integration flow

Error: ENOENT: no such file or directory, open '/tmp/d-2024315-1832-5gxjx9.5cvnj/TestPackage/com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingGetOffboardUserRecordWithExpabcd.EBZ/META-INF/MANIFEST.MF' ❯ Object.openSync node:fs:596:3 ❯ Object.readFileSync node:fs:464:35 ❯ new ManifestReader src/lib/client/ManifestReader.ts:13:26 ❯ SCIRestClient.getArtifactMetadata src/lib/client/SCIRestClient.ts:405:32 ❯ src/test/integration/IntegrationFlow.test.ts:35:43 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { errno: -2, syscall: 'open', code: 'ENOENT', path: '/tmp/d-2024315-1832-5gxjx9.5cvnj/TestPackage/com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingGetOffboardUserRecordWithExpabcd.EBZ/META-INF/MANIFEST.MF' }

let lastLineKey = '';
lines.forEach((line) => {
const [key, value] = line.split(':');
if (key && value && key.match(/^[^\s]+$/)) {
const keyTrimmed = key.trim();
this.manifestEntries.set(keyTrimmed, value.trim());
lastLineKey = keyTrimmed;
} else if (lastLineKey) {
const lastValue = this.manifestEntries.get(lastLineKey);
this.manifestEntries.set(lastLineKey, `${lastValue}${key.trim()}`);
}
});
}

get(key: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?><projectDescription>
<name>com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingGetOffboardUserRecordWithExportId.EBZ</name>
<comment/>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.sap.ide.ifl.project.support.project.nature</nature>
<nature>com.sap.ide.ifl.odop</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Manifest-Version: 1.0
Bundle-Description:
Bundle-SymbolicName: com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingGetOffbo
ardUserRecordWithExpabcd; singleton:=true
Origin-Bundle-SymbolicName: com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingG
etOffboardUserRecordWithExpabcd
Bundle-ManifestVersion: 2
Origin-Bundle-Version: 1.0.0
Import-Package: com.sap.esb.application.services.cxf.interceptor,com.s
ap.esb.security,com.sap.it.op.agent.api,com.sap.it.op.agent.collector
.camel,com.sap.it.op.agent.collector.cxf,com.sap.it.op.agent.mpl,com.
sap.sod.utils.cxf.interceptors,com.sap.sod.utils.encoding.processors,
com.sap.sod.utils.idoc.soap,com.sap.sod.utils.soap,com.sap.sod.utils.
idoc.soap.processors,javax.jms,javax.jws,javax.wsdl,javax.xml.bind.an
notation,javax.xml.namespace,javax.xml.ws,org.apache.camel;version="2
.8",org.apache.camel.builder;version="2.8",org.apache.camel.builder.x
ml;version="2.8",org.apache.camel.component.cxf,org.apache.camel.mode
l;version="2.8",org.apache.camel.processor;version="2.8",org.apache.c
amel.processor.aggregate;version="2.8",org.apache.camel.spring.spi;ve
rsion="2.8",org.apache.commons.logging,org.apache.cxf.binding,org.apa
che.cxf.binding.soap,org.apache.cxf.binding.soap.spring,org.apache.cx
f.bus,org.apache.cxf.bus.resource,org.apache.cxf.bus.spring,org.apach
e.cxf.buslifecycle,org.apache.cxf.catalog,org.apache.cxf.configuratio
n.jsse,org.apache.cxf.configuration.spring,org.apache.cxf.endpoint,or
g.apache.cxf.headers,org.apache.cxf.interceptor,org.apache.cxf.manage
ment.counters,org.apache.cxf.message,org.apache.cxf.phase,org.apache.
cxf.resource,org.apache.cxf.service.factory,org.apache.cxf.service.mo
del,org.apache.cxf.transport,org.apache.cxf.transport.common.gzip,org
.apache.cxf.transport.http,org.apache.cxf.transport.http.policy,org.a
pache.cxf.workqueue,org.apache.cxf.ws.rm.persistence,org.apache.cxf.w
sdl11,org.osgi.framework;version="1.6.0",org.osgi.service.blueprint;v
ersion="[1.0.0,2.0.0)",org.slf4j;version="1.6",org.springframework.be
ans.factory.config;version="3.0",com.sap.aii.ib.bom.flib.types,com.sa
p.aii.mapping.api,com.sap.aii.mappingtool.flib3,com.sap.aii.mappingto
ol.flib7,com.sap.aii.mappingtool.tf3,com.sap.aii.mappingtool.tf3.rt,c
om.sap.aii.mappingtool.tf7,com.sap.aii.mappingtool.tf7.rt,com.sap.aii
.mappingtool.tfapi,com.sap.esb.webservice.audit.log
Origin-Bundle-Name: Integration Flow
SAP-RuntimeProfile:
Bundle-Name: Integration Flow
Bundle-Version: 1.0.0
SAP-NodeType: IFLMAP
Origin-ModifiedDate: 1696523944750
Import-Service: com.sap.esb.webservice.audit.log.AuditLogger
SAP-BundleType: IntegrationFlow

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Store metainfo properties
#Thu Apr 11 09:27:31 UTC 2024
description=This process is used to get employee data for an offboarded employee.
SAP-MarkedSAP2SAP=SAP_TO_SAP_INTEGRATION
source=SAPHCM
target=SAPSuccessFactors
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p1:xiObj xmlns:p1="urn:sap-com:xi"><p1:idInfo VID="6c028ff7246911e590b5000033b6d7f2"><p1:vc caption="SFIHCM03 600" sp="-1" swcGuid="0050568f0aac1ed3a5b2d9f0b458ba15" vcType="S"><p1:clCxt consider="A"/></p1:vc><p1:key oid="e3f16d086c3a3a759d2f06d022ce5047" typeID="MAPPING"><p1:elem>SFSFOffboardingGetOffboardUserRecord_Out_to_SFSFOffboardingGetOffboardUserRecordWithExportId_In</p1:elem><p1:elem>src/main/resources/mapping</p1:elem></p1:key></p1:idInfo><p1:generic><p1:admInf><p1:modifBy>rainas</p1:modifBy><p1:modifAt>2015-07-07 07:31:30.435</p1:modifAt><modifAtLong>1436247090435</modifAtLong><p1:owner>rainas</p1:owner></p1:admInf><p1:lnks><p1:lnkRole kpos="0" role="REQUEST_IN_MES"><p1:lnk rMode="R"><p1:key oid="60bb5ce3e52a3f4b9e2f2c228edd8ce4" typeID="ifmextmes"><p1:elem>SFSFONBIntegration</p1:elem><p1:elem>http://sap.com/xi/SFIHCM03</p1:elem><p1:elem>GetOffboardUserRecordWithExportIdSoapIn</p1:elem><p1:elem>http://ATS.online-onboarding.com/Client/HRDataServiceEx</p1:elem></p1:key></p1:lnk></p1:lnkRole><p1:lnkRole kpos="0" role="REQUEST_TRAFO"><p1:lnk rMode="R"><p1:key oid="2db5fdebd5e0385ea98cdda1cb64cd38" typeID="XI_TRAFO"><p1:elem>HCMgetOffboardUserRecordRequest_to_ONBgetOffboardUserRecordWithExportIdRequest</p1:elem><p1:elem>src/main/resources/mapping</p1:elem></p1:key></p1:lnk></p1:lnkRole><p1:lnkRole kpos="0" role="RESPONSE_TRAFO"><p1:lnk rMode="R"><p1:key oid="8b8ba4df70603d559395ebf851b6b179" typeID="XSL"><p1:elem>XSLT_GetOffboardUserRecordWithExportIdResponse_Mapping_1</p1:elem><p1:elem>src/main/resources/mapping</p1:elem></p1:key></p1:lnk></p1:lnkRole><p1:lnkRole kpos="1" role="RESPONSE_TRAFO"><p1:lnk rMode="R"><p1:key oid="79a84585d8eb315d8ce69bdbab70b7c8" typeID="XSL"><p1:elem>XSLT_GetOffboardUserRecordResponse_Mapping_2</p1:elem><p1:elem>src/main/resources/mapping</p1:elem></p1:key></p1:lnk></p1:lnkRole><p1:lnkRole kpos="0" role="RESPONSE_OUT_MES"><p1:lnk rMode="R"><p1:key oid="2250f14730943a619915c48e5a8e731c" typeID="ifmextmes"><p1:elem>SFSFONBIntegration</p1:elem><p1:elem>http://sap.com/xi/SFIHCM03</p1:elem><p1:elem>GetOffboardUserRecordWithExportIdSoapOut</p1:elem><p1:elem>http://ATS.online-onboarding.com/Client/HRDataServiceEx</p1:elem></p1:key></p1:lnk></p1:lnkRole><p1:lnkRole kpos="0" role="RESPONSE_IN_MES"><p1:lnk rMode="R"><p1:key oid="8016b4a65d963091b69323e505441942" typeID="ifmmessage"><p1:elem>getNewHireRecordResponse</p1:elem><p1:elem>http://sap.com/xi/SFIHCM03</p1:elem></p1:key></p1:lnk></p1:lnkRole><p1:lnkRole kpos="0" role="REQUEST_OUT_MES"><p1:lnk rMode="R"><p1:key oid="e6e926af4da6338c9850d876cd897f7b" typeID="ifmmessage"><p1:elem>getNewHireRecordRequest</p1:elem><p1:elem>http://sap.com/xi/SFIHCM03</p1:elem></p1:key></p1:lnk></p1:lnkRole><p1:lnkRole kpos="1" role="OUTBOUND_IF"><p1:lnk rMode="R"><p1:key oid="92cfe5096c033f78bcda19ccd7da91ab" typeID="wsdl"><p1:elem>SFSFOffboardingGetOffboardUserRecord_Out</p1:elem><p1:elem>src/main/resources/wsdl</p1:elem></p1:key></p1:lnk></p1:lnkRole><p1:lnkRole kpos="1" role="INBOUND_IF"><p1:lnk rMode="R"><p1:key oid="14513f93b8db377aa27294ea44ed22a9" typeID="wsdl"><p1:elem>SFSFOffboardingGetOffboardUserRecordWithExportId_In</p1:elem><p1:elem>src/main/resources/wsdl</p1:elem></p1:key></p1:lnk></p1:lnkRole></p1:lnks><p1:textInfo><p1:textObj id="6c028ff7246911e590b5000033b6d7f2" masterL="EN" type="0"/></p1:textInfo></p1:generic><p1:content><mp:Mapping xmlns:mp="urn:sap-com:xi:mapping"><mp:Category>OI</mp:Category><mp:Kind>J</mp:Kind><mp:XopInclude/><mp:Attachments/><mp:Multiplicity>1:1</mp:Multiplicity><mp:SourceParameters><mp:Parameter><mp:Position>1</mp:Position><mp:Minoccurs>1</mp:Minoccurs><mp:Maxoccurs>1</mp:Maxoccurs></mp:Parameter></mp:SourceParameters><mp:TargetParameters><mp:Parameter><mp:Position>1</mp:Position><mp:Minoccurs>1</mp:Minoccurs><mp:Maxoccurs>1</mp:Maxoccurs></mp:Parameter></mp:TargetParameters></mp:Mapping></p1:content></p1:xiObj>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="ISO-8859-1"?><!--comment -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns0="http://sap.com/xi/SFIHCM03">

<xsl:template match="GetOffboardUserRecordResult">
<!-- TODO: Auto-generated template -->
<xsl:element name="ns0:getNewHireRecordResponse"
namespace="http://sap.com/xi/SFIHCM03">
<xsl:apply-templates />
</xsl:element>
</xsl:template>

<xsl:template match="*[local-name()='item']">
<xsl:element name="Data">
<xsl:apply-templates select="*[local-name()='key']" />
<xsl:apply-templates select="*[local-name()='value']" />
</xsl:element>
</xsl:template>

<xsl:template match="*[local-name()='key']">
<xsl:element name="Field_Id">
<xsl:value-of select="." />
</xsl:element>
</xsl:template>
<xsl:template match="*[local-name()='value']">
<xsl:element name="Field_Content">
<xsl:value-of select="." />
</xsl:element>
</xsl:template>

<xsl:template match="Errors">
<xsl:copy-of select="." />
<!-- node() -->
</xsl:template>

<xsl:template match="OffBoardUserRecord">
<xsl:if
test="not(self::node()[text()='00000000-0000-0000-0000-000000000000'])">
<xsl:apply-templates />
</xsl:if>
</xsl:template>

</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?><!--comment -->
<!--comment -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:output method="xml" version="1.0" indent="yes"
omit-xml-declaration="no" />
<xsl:template match="*[local-name()='GetOffboardUserRecordWithExportIdResult']">
<!-- TODO: Auto-generated template -->
<xsl:value-of select="." disable-output-escaping="yes"></xsl:value-of>
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu Apr 11 09:27:31 UTC 2024
SenderAddress=/hcm2bizx/SFSFOffboardingGetOffboardUserRecordWithExportId
SAPHCM_enableBasicAuthentication_17=false
subject=DC\=sender,CN\=sender
Offboarding_EndPoint=https\://<SuccessFactors_Onboarding_Endpoint>
issuer=DC\=issuer,CN\=issuer
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><parameters><parameter>
<key/>
<name>Offboarding_EndPoint</name>
<type>xsd:string</type>
<isRequired>false</isRequired>
<constraint/>
<description/>
<additionalMetadata/>
</parameter><parameter>
<key/>
<name>issuer</name>
<type>xsd:string</type>
<isRequired>false</isRequired>
<constraint/>
<description/>
<additionalMetadata/>
</parameter><parameter>
<key/>
<name>subject</name>
<type>xsd:string</type>
<isRequired>false</isRequired>
<constraint/>
<description/>
<additionalMetadata/>
</parameter><parameter>
<key/>
<name>SenderAddress</name>
<type>xsd:string</type>
<isRequired>false</isRequired>
<constraint/>
<description/>
<additionalMetadata/>
</parameter><parameter>
<key/>
<name>SAPHCM_enableBasicAuthentication_17</name>
<type>xsd:string</type>
<isRequired>false</isRequired>
<constraint/>
<description/>
<additionalMetadata/>
</parameter><param_references><reference attribute_category="SAPHCM.Receiver.System" attribute_id="ctype::AdapterVariant/cname::SOAP/tp::HTTP/mp::SOAP 1.x/direction::Receiver/version::1.0.6/attrId::address" attribute_uilabel="Address" param_key="SenderAddress"/><reference attribute_category="SuccessFactors.Receiver.System" attribute_id="ctype::AdapterVariant/cname::SOAP/tp::HTTP/mp::SOAP 1.x/direction::Receiver/version::1.0.6/attrId::address" attribute_uilabel="Address" param_key="Offboarding_EndPoint"/><reference attribute_category="SAPHCM.Sender.Auth" attribute_id="/attrId::subject0" attribute_uilabel="Subject DN" param_key="subject"/><reference attribute_category="SAPHCM.Sender.Auth" attribute_id="/attrId::enableBasicAuthentication" attribute_uilabel="Authentication Mode" param_key="SAPHCM_enableBasicAuthentication_17"/><reference attribute_category="SAPHCM.Sender.Auth" attribute_id="/attrId::issuer0" attribute_uilabel="Issuer DN" param_key="issuer"/></param_references></parameters>
Loading
Loading