HistoryViewLinks to this page 2014 July 18 | 11:06 am

OSLC Automation 2.0 Appendix A: Samples

An appendix of the OSLC Automation Specification Version 2.0

(this document is informative)

Contents


Overview

This a collection of various Automation resources in a variety of formats to better illustrate their usage. These are samples only and not intended to show every permutation of the various formats.

Example 1

AutomationPlan RDF/XML Sample

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:oslc="http://open-services.net/ns/core#"
  xmlns:oslc_auto="http://open-services.net/ns/auto#">

    <oslc_auto:AutomationPlan
      rdf:about="http://example.org/autoplans/1234">

      <dcterms:title> Build Pet Store Application </dcterms:title>
      <dcterms:description> Build the Pet Store application. </dcterms:description>
      <dcterms:identifier> 1234 </dcterms:identifier>

      <dcterms:subject> samples </dcterms:subject>

      <dcterms:creator rdf:resource="http://myserver/myapp/users/joe" />
      <dcterms:contributor rdf:resource="http://myserver/myapp/users/bob" />

      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >
      <dcterms:modified> 2012-03-22T12:54:09.577Z </dcterms:modified>

      <oslc_auto:parameterDefinition>
            <oslc:name>BuildType</oslc:name>
            <oslc:occurs>http://open-services.net/ns/core#Exactly-one</oslc:occurs>
            <oslc:valueType rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
            <oslc:allowedValue>production</oslc:allowedValue>
            <oslc:allowedValue>personal</oslc:allowedValue>
            <oslc:allowedValue>test</oslc:allowedValue>
      </oslc_auto:parameterDefinition>

    </oslc_auto:AutomationPlan>
</rdf:RDF>

AutomationRequest RDF/XML Sample

This example assumes the provider creates AutomationRequests that have no other Automation domain type. In order to locate the matching AutomationResult, the client will need to obtain the AutomationRequest’s URL from the response’s Location header and query the provider’s AutomationResult collection.

The client’s POST request message representation is shown below.

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:oslc="http://open-services.net/ns/core#"
  xmlns:oslc_auto="http://open-services.net/ns/auto#">

    <oslc_auto:AutomationRequest>

      <dcterms:title> Pet Store Build Request 2345 </dcterms:title>
      <dcterms:identifier> 2345 </dcterms:identifier>

      <dcterms:creator rdf:resource="http://myserver/myapp/users/joe" />
      <dcterms:contributor rdf:resource="http://myserver/myapp/users/builduser1" />

      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >
      <dcterms:modified> 2012-03-22T12:54:09.577Z </dcterms:modified>

      <oslc_auto:inputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildType</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">production</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:inputParameter>

      <oslc_auto:state rdf:resource="http://open-services.net/ns/auto#new"/>

      <oslc_auto:executesAutomationPlan rdf:resource="http://example.org/autoplans/1234"/>

    </oslc_auto:AutomationRequest>
</rdf:RDF>

AutomationResult RDF/XML Sample

The provider’s POST response was either 201 (Created) or 204 (No Content) and the URL of the AutomationRequest was returned in the HTTP Location header. The client later searches the AutomationResult collection for the instance whose oslc_auto:producedByAutomationRequest predicate matches the AutomationRequest URL, finding a result whose representation looks like the following:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:oslc="http://open-services.net/ns/core#"
  xmlns:oslc_auto="http://open-services.net/ns/auto#"
  xmlns:my_ns="http://example.org/ns/my_ns#">

    <oslc_auto:AutomationResult
      rdf:about="http://example.org/autoresults/3456">

      <dcterms:title> Pet Store Build Result 3456 </dcterms:title>
      <dcterms:identifier> 2345 </dcterms:identifier>
      <dcterms:subject>milestone 1</dcterms:subject>
      <dcterms:subject>translations included</dcterms:subject>


      <dcterms:creator rdf:resource="http://myserver/myapp/users/builduser1" />
      <dcterms:contributor rdf:resource="http://myserver/myapp/users/builduser1" />

      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >
      <dcterms:modified> 2012-03-22T12:54:09.577Z </dcterms:modified>

      <oslc_auto:inputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildType</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">production</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:inputParameter>

      <oslc_auto:outputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildType</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">production</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:outputParameter>

      <oslc_auto:outputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildMachine</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">buildengine1</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:outputParameter>

      <oslc_auto:state rdf:resource="http://open-services.net/ns/auto#complete"/>
      <oslc_auto:state rdf:resource="http://example.org/ns/my_ns#completed-after-manual-intervention"/>
      <oslc_auto:verdict rdf:resource="http://open-services.net/ns/auto#pass"/>

      <oslc_auto:reportsOnAutomationPlan rdf:resource="http://example.org/autoplans/1234"/>
      <oslc_auto:producedByAutomationRequest rdf:resource="http://example.org/autoreqs/2345"/>

      <oslc_auto:hasContribution>
         <rdf:Description>
         <dcterms:title>logfile.txt</dcterms:title>
            <dcterms:description>Logfile for build result 3456</dcterms:description>
            <rdf:type rdf:resource="http://example.org/ns/my_ns#Logfile"/>
            <my_ns:status_page>http://buildserver1/builds/3456/status.html</my_ns:status_page>
            <my_ns:logfile>http://buildserver1/builds/3456/logfile.txt</my_ns:logfile>
            <my_ns:build_location>ftp://anonymous@fileserver1/home/builds/3456/build_output_20120322a.zip</my_ns:build_location>
      </rdf:Description>
      </oslc_auto:hasContribution>

      <oslc_auto:hasContribution>
         <rdf:Description>
            <dcterms:title>Approval Record 3456</dcterms:title>
            <dcterms:description>The approval record for build result 3456</dcterms:description>
            <dcterms:type rdf:resource="http://example.org/ns/my_ns#Approval"/>
            <my_ns:approver>John Smith</my_ns:approver>
            <my_ns:approval_status>Approved</my_ns:approval_status>
      </rdf:Description>
      </oslc_auto:hasContribution>

    </oslc_auto:AutomationResult>
</rdf:RDF>

Example 2

Same as Example 1, but illustrating a different provider implementation permitted by the specification. In this example, the 200 (OK) response contains only an AutomationResult; no AutomationRequest is ever exposed by the provider.

AutomationPlan RDF/XML Sample

Exactly the same as the Automation Plan from Example 1.

AutomationRequest RDF/XML Sample

The client POSTs an AutomationRequest to the provider as before, but this time it is not returned in the 200 (OK) response body. The corresponding AutomationRequest exists only in the client’s initial Create request. Its representation is identical to the AutomationResult in Example 1.

AutomationResult RDF/XML Sample

The provider responds with 200 (OK); since this provider does not include a copy of the AutomationRequest in the HTTP response body, its representation is identical to the AutomationResult in Example 1.

Example 3

Same as Example 1, but illustrating another provider implementation alternative. In this example, the 200 (OK) response contains both an AutomationResult and the original AutomationRequest.

AutomationPlan RDF/XML Sample

Exactly the same as the Automation Plan from Example 1.

AutomationRequest and AutomationResult RDF/XML Sample

This provider’s POST (Create) response is 200 (OK); this provider includes a copy of the AutomationRequest in the response, so the HTTP response body consists of the representation below. It consists of the AutomationRequest from Example 1 smushed together with the AutomationResult from Example 1.

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:oslc="http://open-services.net/ns/core#"
  xmlns:oslc_auto="http://open-services.net/ns/auto#"
  xmlns:my_ns="http://example.org/ns/my_ns#">

    <oslc_auto:AutomationRequest
      rdf:about="http://example.org/autoreqsresults/2345">
     <rdf:type rdf:resource="oslc_auto:AutomationResult" />

      <dcterms:title> Pet Store Build [Request/Result](Request/Result.html) 2345 </dcterms:title>
      <dcterms:identifier> 2345 </dcterms:identifier>
      <dcterms:subject>milestone 1</dcterms:subject>
      <dcterms:subject>translations included</dcterms:subject>

      <dcterms:creator rdf:resource="http://myserver/myapp/users/joe" />
      <dcterms:contributor rdf:resource="http://myserver/myapp/users/builduser1" />

      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >
      <dcterms:modified> 2012-01-16T08:42:11.268Z </dcterms:modified>

      <oslc_auto:inputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildType</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">production</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:inputParameter>

      <oslc_auto:outputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildMachine</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">buildengine1</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:outputParameter>

      <oslc_auto:state rdf:resource="http://open-services.net/ns/auto#complete"/>
      <oslc_auto:verdict rdf:resource="http://open-services.net/ns/auto#pass"/>

      <oslc_auto:reportsOnAutomationPlan rdf:resource="http://example.org/autoplans/1234"/>
      <oslc_auto:producedByAutomationRequest rdf:resource="http://example.org/autoreqs/2345"/>

      <oslc_auto:executesAutomationPlan rdf:resource="http://example.org/autoplans/1234"/>

      <oslc_auto:hasContribution>
         <rdf:Description>
         <dcterms:title>logfile.txt</dcterms:title>
            <dcterms:description>Logfile for build result 3456</dcterms:description>
            <rdf:type rdf:resource="http://example.org/ns/my_ns#Logfile"/>
            <my_ns:status_page>http://buildserver1/builds/3456/status.html</my_ns:status_page>
            <my_ns:logfile>http://buildserver1/builds/3456/logfile.txt</my_ns:logfile>
            <my_ns:build_location>ftp://anonymous@fileserver1/home/builds/3456/build_output_20120322a.zip</my_ns:build_location>
         </rdf:Description>
      </oslc_auto:hasContribution>

      <oslc_auto:hasContribution>
         <rdf:Description>
            <dcterms:title>Approval Record 3456</dcterms:title>
            <dcterms:description>The approval record for build result 3456</dcterms:description>
            <dcterms:type rdf:resource="http://example.org/ns/my_ns#Approval"/>
            <my_ns:approver>John Smith</my_ns:approver>
            <my_ns:approval_status>Approved</my_ns:approval_status>
         </rdf:Description>
      </oslc_auto:hasContribution>

   </oslc_auto:AutomationRequest>
</rdf:RDF>