How to get remaining early start and finish from MPXJ Task object - mpxj

I want to get the remaining early start and remaining early finish properties of an Activity while reading a Primavera .xer file. I have seen that the class PrimaveraPMFileReader in the mpxj library sets these properties to the task object, but am trying to import xer file and so the reader used is PrimaveraXERFileReader class. With the XER reader, the task instances are not set any properties that am looking for.

After going through the code of PrimaveraPMFileWriter and also some methods of the Task class of mpxj library, I have realized that to get remaining early start of a task in primavera, you need to use the getResume() API of the Task class of mpxj.

Related

How can I invoke a task module on handleTeamsMessagingExtensionSelectItem(...)?

I am building a messaging extension app for MS Teams using the Teams-Toolkit in Visual Studio Code. I have been able to launch task modules from the message context without a problem but is there a way to launch a task module from handleTeamsMessagingExtensionSelectItem(context, obj)? The goal is for the user to select an item from the query list which triggers a new task module where they can fill out and submit a form (adaptive card).
For more visibility, adding the answer from the comment section:
Task module can be opened using TaskModuleResponse return type.
Only TeamsTaskModuleFetchAsync() method supports TaskModuleResponse return type.
TeamsMessagingExtensionSelectItemAsync() method return type can be MessagingExtensionResponse only. As this response type can't be changed.
So, overall not feasible.

How to perform teardown for releasing resources after each Scenario In serenity BDD with Cucumber

I am using Serenity with BDD and need to perform a teardown step that must get executed after completion of each Scenario. Also, this teardown step should not be visible to report as it is technical thing and nothing to do with behavior to be exposed as part of cucumber such as releasing few expensive resource that got
I used cucumber's #After annotation which is working as expected, but the problem is now this step is also shown in my Report which I don't want to be visible.
Could someone please suggest me a solution that allows me to perform teardown step that gets executed per scenario but should not be added as step in my Serenity Report.
Current Solution I have is which does not satisfy my need:
Step Definition Class has following method:
#After
public void tearDown() {
systemAction.deleteCostlyResource(id);
}
but #After annotation makes it a candidate for Reporting Step.
If you are using Dependency Injection, you could have your DI framework teardown the resources at the end of the scenarios?
For instance, if you are using Spring:
If the "costly resource" is a class that you yourself have created, mark it with:
#Component
#Scope("cucumber-glue")
If the "costly resource" is not a class you created, but provided by a framework or whatever, you can register it as a bean in your spring (test)configuration and mark it with a "destroy method".
For example, to register Selenium WebDriver using annotation based configuration and making sure to quit after each Scenario, mark it with:
#Bean(destroyMethod = "quit")
In this example, quit() is WebDriver's method to quit(). In your situation, call "costly resource's" quit method, or equivalent thereof.

Output resources using Groovy ASTTransformer

I've written a number of Java annotation processors that write some arbitrary data to text files that will be included in my class directory / jar file. I typically use code that looks like this:
final OutputStream out = processingEnv
.getFiler()
.createResource(StandardLocation.CLASS_OUTPUT, "", "myFile")
.openOutputStream();
I'm trying to do something similar in a groovy ASTTransformation. I've tried adding a new source file but that (expectedly) must be valid groovy. How do I write arbitrary resources from an ASTTransformation? Is it even possible?
As part of implementing your ASTTransformation, you need to implement the void visit(ASTNode[] nodes, SourceUnit source) method. In it you can call source.getConfiguration().getTargetDirectory() and it will return your build output directory, e.g. /Users/skissane/my-groovy-project/build/classes/groovy/main). You can then write your resources into there, and whatever is packaging them into the JAR (such as Gradle) should pull them from that.
In my case, I wanted to delay writing the resources until OUTPUT phase – since I was creating META-INF/services files, and I wanted to wait until I'd seen all the annotated classes before writing them, or else I'd be repeatedly adding to them for each annotated class – so I also implemented CompilationUnitAware, and then in my setCompilationUnit method I call unit.addPhaseOperation() and pass it a method reference to run during OUTPUT. Note, if you are using a local ASTTransformation, setCompilationUnit will be called multiple times (each time on a new instance of your transformation class); to avoid adding the phase operation repeatedly, I used a map in a static field to track if I'd seen this CompilationUnit before or not. My addPhaseOperation method is called once per an output class, so I used a boolean field to make sure I only wrote the resource files out once.
Doing this caused a warning to be printed:
> Task :compileGroovy
warning: Implicitly compiled files were not subject to annotation processing.
Use -implicit to specify a policy for implicit compilation.
1 warning
Adding this to build.gradle made the warning go away:
compileGroovy {
options.compilerArgs += ['-implicit:none']
}

How to use the method named bindThread in StandardContext class?

Because I found the method named bindThread() is invoked multiple times at class named StandardContext in Tomcat 7 source code, especially in the method named startInternal(). I do not understand why need to call this method multiple times.
Actually the bindThread() is set the thread context classloader, but I don't konw why still use bindThread() and unbindThread() method pair in the startInternal() invoke multiple times.
Web application start and stop normally happens with the container class loader in effect. Some parts of the start (and stop) process (e.g. firing the application listeners) needs to take place with the web application class loader in effect. bindThread() and unbindThread() are the methods that switch to the web application class loader and back again respectively. The various elements of start and stop have to happen in a specific order so it is necessary to switch back and forth between class loaders.

Media Foundation IMFMediaSource::CreatePresentationDescriptor invocation never ends

I'm triying to use Media Foundation to play mp3 file and I have a problem getting PresentationDesctiptor using CreatePresentationDescriptor method
What am I doing:
Start MF using MFStartup
Create session using MFCreateMediaSession
Create SourceResolver using MFCreateSourceResolver
Create MediaSource using CreateObjectFromURL from SourceResolver
Create topology using MFCreateTopology
Trying to create PresentationDescriptor using CreatePresentationDescriptor from MediaSource
When I call CreatePresentationDescriptor no error/exception occurs it just stands there and does nothing. When I pause Visual Strudio it indicates that program is still waiting for method to finish. What am I doing wrong ?
I did not metion that I use C# for this (did not think this was relevant)
The problem was that when importing com interfaces in C# you need to import all methods of interface not only those that are called. Some methods can call not imported methods and cause Access Violation that is not reported to Visual Strudio debugger and as a result it seems like method is never finished invokink.

Resources