How To Test Injectors

1 view
Skip to first unread message

Jennifer Kovachick

unread,
Aug 5, 2024, 5:44:15 AM8/5/24
to nabetenog
Were currently using unit tests with AEM Mock to test our models in our application. We've recently introduced a custom injector and custom annotations and this has been bogging down the tests significantly. Even in tests that don't do any work, merely injecting the custom injector adds a half second or more of startup time. Is there a way to improve the performance this? My understanding based on this question and the answer is that each custom injector is forced to interrogate every Inject annotation of every model registered in the system at startup. Is that understanding correct? It's possible that there's no way to speed this up, but I wanted to make sure we weren't missing something. If this is the case and each new AEM Context will simply have to apply the injector to every model with an Inject annotation, then I can't see a way to improve this outside of shunting these tests off to an Integration test suite or something like that.

We were hoping there was an ability to hint the AEM Context in the mock to only read certain models. Or maybe in the custom injector implementation is there a way to scope down which annotations the custom injector reads. Can someone let me know if I'm missing something?


Correct. If you are using the @inject annotation, it means you don't have a clear idea of which implementation of an "injector" needs to be selected. Consequently, the system will have to iterate through all the available "injectors" to determine which one to use. That's why it is highly recommended to use the most specific injector possible. Please take a look at this great article[1] explaining the behavior and the performance implications of using @inject.


In your situation, the ideal scenario would be to not have the @inject annotation in your Sling Model. This way, when the AEM Context runs, it won't evaluate all the injectors but only the ones specific to your sling model. Can you check if refactoring one Sling model which is using @inject to use the specific annotations helps and improves your performance issue? If so, this would be preferred because having the @inject annotation as explained in the article would potentially impact your application's performance.


The behavior we're seeing that's making us most concerned about the performance is that when we breakpoint the injector's createAnnotationProcessor method, we can see references to elements like ImageImpl.pageManager and com.adobe.cq.wcm.core.components.internal.models.v2.ListImpl.linkManager, for example. Meaning that it appears like even models that aren't part of our custom code base are being applied against our custom injector.



So when you say:






Won't we still deal with the slow start time, because the Context is trying to apply all of the other models that use Inject against our custom injector? Or am I still missing something here? What we're seeing is that the simple act of adding our custom injector to the context is causing it to be tested against every model in the system, whether custom code, or OOTB or AEM Core Components.


So for now at least we're not concerned about the performance of the models per se. We're more concerned that in the context of trying to do automated testing against our models, that the test suite is slow to spin up because of the fact that our custom injector is being applied against all of these models, which we can't figure out how to avoid or if we even can.


Could you please share some code related to your annotation? Please pay attention to the ranking value, and ensure that it returns null if the injector doesn't match your annotation. It should look something like this:


So for posterity we had something akin to your Thread Sleep going on in our injector, it turns out. We had an I/O operation going on that we didn't notice and once we removed that the tests blazed.



With that, I'm confused about what you're seeing. Everything I've read on these forums, in documentation and even from the folks at AEM Mocks says that the AEM Context will try to test every model with an Inject annotation against all injectors until it finds an injector that can handle the annotation. So that knowledge makes me think what we're seeing is the correct behavior. Especially if we don't specify OOTB or 3rd party injectors in our test, but those models are part of our classpath. We did change the priority level and that doesn't make a difference, which I assume is because we don't have other injectors in place that could handle those models.


Hello if they are working faintly it means they are working which is what the test function is designed to, but check the injector set up is set to saturated or peak and hold depending on there resistance this will make a difference in the injector test as far as I'm aware


I find it very strange that three have a very drastic sound to the other three, and when I plug the working injector plug onto the quite injector it will buz correctly and when I plug the quite injector plug onto the working injector it goes very quite.


Do you have the same voltage at each injector connector. With the harness disconnected from the battery Can you measure any significant resistance between the power pins on the "good" vs. "bad" injector connectors?


Are all injector connectors wired with the same polarity? I can see how the sounds might vary with the polarity -- and the injectors might not be wired internally with the same polarity (but I wouldn't expect this).


A bit hard to read, but are you saying if you swap the wiring from the 3 "loud" injectors over to the 3 quiet injectors, then run the injector test, the quiet injectors are still quiet, and the loud injectors are still loud? If that's the case then I think that rules out wiring, drivers, power supply and settings. So basically the only part of the equation left is the injectors themselves - or as David suggested there is a slim chance something is effecting the NHV such as valves open or the rubber seals etc although i cant say I have ever come across that effect before.


Are you using adapters for the connector difference or have you cut the denso plugs off and replaced with a Bosch connector? I have seen the Toyota injector terminals lose tension or fret before and give a intermittent bad connection but it would be hard to imagine 3 are bad. The wiring swap should have eliminated this possibility but since you didnt give much detail on what was swapped I thought it was worth mentioning.


Have the injectors been sitting long? Not sure what injector a raceworks 1650 is based on, but some of those CNG injectors will start to jam up within about a week if they've had ethanol in them or are left dry after use.


The fuel injectors in your vehicle are designed to spray fuel into the cylinders of your engine where it is combined with air and compressed before being ignited by the spark plug to produce power. As a result, an issue with one of your fuel injectors can cause your engine to run poorly, or even fail to run at all. There are a number of issues that could cause your fuel injectors to fail. Although some may be beyond the expertise of most home mechanics, you can often diagnose a faulty fuel injector using common hand tools.


I have an LT1 with Painless wiring harness and a 1992 computer. It just stopped running the other day; the spark is good but I don't feel like the injectors are opening properly (I do have 43 PSI at startup). How do I test the Injectors from the computer, I think I might have a bad computer (I just put in a rebuilt computer about a month ago).


Your injectors should ohm out at around 12-15ohms. As for testing them, you should really use a "noid" light" but you can use a 12V test light. The noid light is designed not to put any extra load/draw on the injector circuit so you dont run the risk of damaging the computer. So using a 12V test light may or may not damage your PCM. I've seen plenty of guys use it without any harm to the PCM.


I would double check my grounds for the pcm, battery, engine to frame. Bad grounds do funny stuff. Other than that it could be a bad icm. As far as I know there is not a way to test a icm. It was a toss of either opti or icm for me 2 times. Both times it was the opti.


When you click on links to various merchants on this site and make a purchase, this can result in this site earning a commission. Affiliate programs and affiliations include, but are not limited to, the eBay Partner Network.


I have read periodically here that some folks have had their tii injectors cleaned and tested at Bosch diesel repair shops. I'm thinking of doing this while I have everything apart, although I have not had any problems with either the KF or the injectors. What exactly do they do, and what should I be asking them for?


They will test for spray pattern, leakage, and pressure (and probably more). Tell them what the specs are so they can test accordingly. If I remember correctly, KF injectors have a lot higher pressure levels than standard diesel injectors.


I just had this done in the San Diego area. It took a while to find a place that could test them properly. I typed in "diesel fuel injector service" in maps.google.com and finally ended up finding someone who could do it. It took some calling around. I can find the number of the place that did it if you need it.


I've seen the flexible fuel line at some injection shops advertised as a emergency repair for guys. I would think you could take the pump mechanism from a hydraulic jack, depending on the jack might be able to use the one way mechanism from it also, just need a fuel supply, gauge, and adaptors. You will have to let us know how you end up doing it.


The IH test stand pretty much looked like a hand pump deal. I have extra fuel lines and picked up one of those oil compatible grease guns but never got around to making the adapter. The basic big issues can be checked pretty easy, but the leak down and drip tests are a little harder with an unknown pump. I think the book just says to keep pressure on the line. A little air in the system actually helps with that for leak down.

3a8082e126
Reply all
Reply to author
Forward
0 new messages