Home » Archived » Test and Performance Tools Platform (TPTP) » Parse Execution file
Parse Execution file [message #100762] |
Mon, 11 June 2007 12:54 |
Eclipse User |
|
|
|
Originally posted by: juliano.vidal.gmail.com
Hi all,
I'm building a Rational Manual Tester exporter plugin.
But I need to open an execution file, get the content and build a PDF
with it.
Since the execution file is similar to a jar file, I'm using the JarFile
class to get it's content.
Well the problem is when I try to parse the ResourceContents file.
Since I'm opening and getting the information on demand I don't want to
create a file then use:
URI uri = URI.createFileURI(new File("ResourceContents").getAbsolutePath());
then
Resource resource = resourceSet.getResource(uri, true);
Is there either a better way to do it or to create a URI from an
InputStream?
Thanks in Advance!!
|
|
|
Re: Parse Execution file [message #101205 is a reply to message #100762] |
Tue, 19 June 2007 12:33 |
Joe Toomey Messages: 79 Registered: July 2009 |
Member |
|
|
Hi Juliano,
It appears from the code at the end of your post that you are trying to
use EMF to examine the test log (.execution) file, and this is the right
approach. If you initialize and register the TPTP Test models before
you try to open the model file, EMF will already be aware that the file
is serialized with the zip option, so there is no need to open the file
using JarFile or locate the ResourceContents within it.
If you include the org.eclipse.tptp.platform.models plugin in your
classpath, simply call
org.eclipse.hyades.models.common.facades.behavioral.impl.Fac adeResourceFactoryImpl.initializeRequisiteModels();
and then you can open the model and traverse it using normal EMF APIs.
The only change to your code below would be to pass the path to the
..execution file itself instead of to the ResourceContents file that you
extracted.
Hope this helps,
--Joe
juliano.vidal@gmail.com wrote:
> Hi all,
>
> I'm building a Rational Manual Tester exporter plugin.
>
> But I need to open an execution file, get the content and build a PDF
> with it.
>
> Since the execution file is similar to a jar file, I'm using the JarFile
> class to get it's content.
> Well the problem is when I try to parse the ResourceContents file.
> Since I'm opening and getting the information on demand I don't want to
> create a file then use:
>
> URI uri = URI.createFileURI(new
> File("ResourceContents").getAbsolutePath());
>
> then
>
> Resource resource = resourceSet.getResource(uri, true);
>
> Is there either a better way to do it or to create a URI from an
> InputStream?
>
> Thanks in Advance!!
|
|
|
Re: Parse Execution file [message #101236 is a reply to message #101205] |
Tue, 19 June 2007 19:48 |
Eclipse User |
|
|
|
Originally posted by: juliano.vidal.gmail.com
Hi Joe,
I don't see the method FacadeResourceFactoryImpl.initializeRequisiteModels()
Are you sure it's the right Class?
Thanks in advance.
Joe Toomey wrote:
> Hi Juliano,
>
> It appears from the code at the end of your post that you are trying to
> use EMF to examine the test log (.execution) file, and this is the right
> approach. If you initialize and register the TPTP Test models before
> you try to open the model file, EMF will already be aware that the file
> is serialized with the zip option, so there is no need to open the file
> using JarFile or locate the ResourceContents within it.
>
> If you include the org.eclipse.tptp.platform.models plugin in your
> classpath, simply call
> org.eclipse.hyades.models.common.facades.behavioral.impl.Fac adeResourceFactoryImpl.initializeRequisiteModels();
>
> and then you can open the model and traverse it using normal EMF APIs.
> The only change to your code below would be to pass the path to the
> .execution file itself instead of to the ResourceContents file that you
> extracted.
>
> Hope this helps,
> --Joe
>
> juliano.vidal@gmail.com wrote:
>> Hi all,
>>
>> I'm building a Rational Manual Tester exporter plugin.
>>
>> But I need to open an execution file, get the content and build a PDF
>> with it.
>>
>> Since the execution file is similar to a jar file, I'm using the
>> JarFile class to get it's content.
>> Well the problem is when I try to parse the ResourceContents file.
>> Since I'm opening and getting the information on demand I don't want
>> to create a file then use:
>>
>> URI uri = URI.createFileURI(new
>> File("ResourceContents").getAbsolutePath());
>>
>> then
>>
>> Resource resource = resourceSet.getResource(uri, true);
>>
>> Is there either a better way to do it or to create a URI from an
>> InputStream?
>>
>> Thanks in Advance!!
|
|
|
Re: Parse Execution file [message #101246 is a reply to message #101236] |
Tue, 19 June 2007 19:52 |
Eclipse User |
|
|
|
Originally posted by: juliano.vidal.gmail.com
Hey, sorry, found it.
But here is another question: How do I load the file?
Thanks again.
Juliano Vidal wrote:
> Hi Joe,
>
> I don't see the method
> FacadeResourceFactoryImpl.initializeRequisiteModels()
>
> Are you sure it's the right Class?
>
> Thanks in advance.
>
> Joe Toomey wrote:
>> Hi Juliano,
>>
>> It appears from the code at the end of your post that you are trying
>> to use EMF to examine the test log (.execution) file, and this is the
>> right approach. If you initialize and register the TPTP Test models
>> before you try to open the model file, EMF will already be aware that
>> the file is serialized with the zip option, so there is no need to
>> open the file using JarFile or locate the ResourceContents within it.
>>
>> If you include the org.eclipse.tptp.platform.models plugin in your
>> classpath, simply call
>> org.eclipse.hyades.models.common.facades.behavioral.impl.Fac adeResourceFactoryImpl.initializeRequisiteModels();
>>
>> and then you can open the model and traverse it using normal EMF APIs.
>> The only change to your code below would be to pass the path to the
>> .execution file itself instead of to the ResourceContents file that
>> you extracted.
>>
>> Hope this helps,
>> --Joe
>>
>> juliano.vidal@gmail.com wrote:
>>> Hi all,
>>>
>>> I'm building a Rational Manual Tester exporter plugin.
>>>
>>> But I need to open an execution file, get the content and build a PDF
>>> with it.
>>>
>>> Since the execution file is similar to a jar file, I'm using the
>>> JarFile class to get it's content.
>>> Well the problem is when I try to parse the ResourceContents file.
>>> Since I'm opening and getting the information on demand I don't want
>>> to create a file then use:
>>>
>>> URI uri = URI.createFileURI(new
>>> File("ResourceContents").getAbsolutePath());
>>>
>>> then
>>>
>>> Resource resource = resourceSet.getResource(uri, true);
>>>
>>> Is there either a better way to do it or to create a URI from an
>>> InputStream?
>>>
>>> Thanks in Advance!!
|
|
|
Re: Parse Execution file [message #101260 is a reply to message #101246] |
Tue, 19 June 2007 20:51 |
Eclipse User |
|
|
|
Originally posted by: juliano.vidal.gmail.com
Nice!!!
I got it.
For the ones with same problems here is the code:
Common_TestprofilePackage testprofilePackage =
Common_TestprofilePackageImpl.eINSTANCE;
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(testprofilePackage.getN sURI(),
testprofilePackage);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "execution",
new ExecutionFacadeResourceFactoryImpl());
URI uri = URI.createFileURI(new
File("TC13N004_Exporter.execution").getAbsolutePath());
Resource resource = resourceSet.getResource(uri, true);
TreeIterator iterator = resource.getAllContents();
Thanks for the help!!!
Juliano Vidal wrote:
> Hey, sorry, found it.
>
> But here is another question: How do I load the file?
>
> Thanks again.
>
> Juliano Vidal wrote:
>> Hi Joe,
>>
>> I don't see the method
>> FacadeResourceFactoryImpl.initializeRequisiteModels()
>>
>> Are you sure it's the right Class?
>>
>> Thanks in advance.
>>
>> Joe Toomey wrote:
>>> Hi Juliano,
>>>
>>> It appears from the code at the end of your post that you are trying
>>> to use EMF to examine the test log (.execution) file, and this is the
>>> right approach. If you initialize and register the TPTP Test models
>>> before you try to open the model file, EMF will already be aware that
>>> the file is serialized with the zip option, so there is no need to
>>> open the file using JarFile or locate the ResourceContents within it.
>>>
>>> If you include the org.eclipse.tptp.platform.models plugin in your
>>> classpath, simply call
>>> org.eclipse.hyades.models.common.facades.behavioral.impl.Fac adeResourceFactoryImpl.initializeRequisiteModels();
>>>
>>> and then you can open the model and traverse it using normal EMF
>>> APIs. The only change to your code below would be to pass the path to
>>> the .execution file itself instead of to the ResourceContents file
>>> that you extracted.
>>>
>>> Hope this helps,
>>> --Joe
>>>
>>> juliano.vidal@gmail.com wrote:
>>>> Hi all,
>>>>
>>>> I'm building a Rational Manual Tester exporter plugin.
>>>>
>>>> But I need to open an execution file, get the content and build a
>>>> PDF with it.
>>>>
>>>> Since the execution file is similar to a jar file, I'm using the
>>>> JarFile class to get it's content.
>>>> Well the problem is when I try to parse the ResourceContents file.
>>>> Since I'm opening and getting the information on demand I don't want
>>>> to create a file then use:
>>>>
>>>> URI uri = URI.createFileURI(new
>>>> File("ResourceContents").getAbsolutePath());
>>>>
>>>> then
>>>>
>>>> Resource resource = resourceSet.getResource(uri, true);
>>>>
>>>> Is there either a better way to do it or to create a URI from an
>>>> InputStream?
>>>>
>>>> Thanks in Advance!!
|
|
|
Goto Forum:
Current Time: Mon Apr 29 15:17:51 GMT 2024
Powered by FUDForum. Page generated in 0.04001 seconds
|