[webbeans-issues] [JBoss JIRA] Commented: (WBRI-33) ComponentMetaModelTest is failing

Diego Coronel (JIRA) jira-events at lists.jboss.org
Wed Aug 6 08:40:58 EDT 2008


    [ https://jira.jboss.org/jira/browse/WBRI-33?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12423858#action_12423858 ] 

Diego Coronel commented on WBRI-33:
-----------------------------------

hey,

 Sry, but i think my patch is right, can you confirm this?

 In your code in class ComponentMetaModelTest you have a method: testMutipleIncompatibleScopeStereotypesWithScopeSpecified, pls ready my comment in your code:

 @Test
//this name says you are looking for a exception
   public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified() 
   {
      Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
  // FishStereotypeBinding extends RiverFishStereotype that is @ApplicationScoped
      annotations.put(FishStereotype.class, new FishStereotypeBinding()); 
//  AnimalStereotypeBinding extends AnimalStereotype that is @RequestScoped
      annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());

// and  both annotations are in same Map 
      AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
      // so, probably at you class AbstractComponentModel in method initScopeType your code should throws 
//else if (stereotypes.getPossibleScopeTypes().size() > 1)
//      {
//         throw new RuntimeException("All stereotypes must specify the same scope OR a scope must be specified on the component");
//      }

// because you cant have RequestedScope and Application scope, so, i think my patch failed because it did right thing.
// sry about complexity of my patch WBRI-34, i tried to extract some codes to a private method and use the superclass to make all logic
      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
      assert trout.getScopeType().annotationType().equals(RequestScoped.class);     
   }

Is my logic correct? if not, pls can you explain.


> ComponentMetaModelTest is failing
> ---------------------------------
>
>                 Key: WBRI-33
>                 URL: https://jira.jboss.org/jira/browse/WBRI-33
>             Project: Web Beans RI
>          Issue Type: Bug
>    Affects Versions: 1.0.0.EDR2
>         Environment: JDK 1.6
> Windows Vista
> JUnit 4.4
>            Reporter: Diego Coronel
>            Assignee: Pete Muir
>         Attachments: ComponentMetaModelTestPatch.patch
>
>
> Test "testMutipleIncompatibleScopeStereotypesWithScopeSpecified" isnt correct, it was waiting a scope but the correct is check if AbstractComponentModel is going to throw RuntimeException. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the weld-issues mailing list