Package org.jboss.forge.addon.parser.java.resources

Examples of org.jboss.forge.addon.parser.java.resources.JavaResource


                  addonDependency.getVersion().toString())
                  .setClassifier(MavenAddonDependencyResolver.FORGE_ADDON_CLASSIFIER).setScopeType("test");
         Assert.assertTrue(deps.hasEffectiveDependency(dependency));
      }
      JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
      JavaResource javaResource = facet.getTestJavaResource("org.jboss.forge.test.MyTestCase");
      Assert.assertNotNull(javaResource);
      Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaClass.class)));
      Assert.assertFalse(javaResource.getJavaType().hasSyntaxErrors());

      Resource<?> finalArtifact = project.getFacet(PackagingFacet.class).getFinalArtifact();
      Assert.assertFalse(finalArtifact.exists());
      Assert.assertTrue(project.getFacet(PackagingFacet.class).createBuilder().runTests(false).build()
               .exists());
View Full Code Here


      String beanName = named.getValue();
      String beanPackage = targetPackage.getValue();
      DirectoryResource targetDir = targetLocation.getValue();
      UIContext uiContext = context.getUIContext();
      Project project = getSelectedProject(uiContext);
      JavaResource javaResource;
      if (project == null)
      {
         javaResource = facesOperations.newBackingBean(targetDir, beanName, beanPackage);
      }
      else
View Full Code Here

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Project project = getSelectedProject(context);
      JavaResource javaResource = targetEntity.getValue();
      String fieldNameStr = named.getValue();
      JavaClassSource targetEntity = javaResource.getJavaType();
      FieldSource<JavaClassSource> field = targetEntity.getField(fieldNameStr);
      String action = (field == null) ? "created" : "updated";
      if (field != null)
      {
         UIPrompt prompt = context.getPrompt();
View Full Code Here

   public void validate(UIValidationContext validator)
   {
      super.validate(validator);
      try
      {
         JavaResource javaResource = targetEntity.getValue();
         if (javaResource != null)
         {
            JavaClassSource javaClass = javaResource.getJavaType();
            if (javaClass.hasField(named.getValue()))
            {
               validator.addValidationWarning(targetEntity, "Field '" + named.getValue() + "' already exists");
            }
         }
View Full Code Here

   }

   @Test
   public void testAddOneToManyRel() throws Exception
   {
      JavaResource rhsClass = projectHelper.createJPAEntity(project, "Account");
      String qualifiedRhsType = rhsClass.getJavaType().getCanonicalName();
      String simpleRhsType = rhsClass.getJavaType().getName();
      String simpleCollectionType = Set.class.getSimpleName();
      String qualifiedCollectionType = Set.class.getCanonicalName();

      String fieldName = "accounts";
      jpaFieldOperations.newOneToManyRelationship(project, entity, fieldName, qualifiedRhsType, null,
View Full Code Here

   }

   @Test
   public void testAddManyToManyRel() throws Exception
   {
      JavaResource rhsClass = projectHelper.createJPAEntity(project, "Account");
      String qualifiedRhsType = rhsClass.getJavaType().getCanonicalName();
      String simpleRhsType = rhsClass.getJavaType().getName();
      String simpleCollectionType = Set.class.getSimpleName();
      String qualifiedCollectionType = Set.class.getCanonicalName();

      String fieldName = "accounts";
      jpaFieldOperations.newManyToManyRelationship(project, entity, fieldName, qualifiedRhsType, null,
View Full Code Here

   }

   @Test
   public void testAddManyToOneRel() throws Exception
   {
      JavaResource rhsClass = projectHelper.createJPAEntity(project, "Store");
      String qualifiedRhsType = rhsClass.getJavaType().getCanonicalName();
      String simpleRhsType = rhsClass.getJavaType().getName();

      String fieldName = "store";
      jpaFieldOperations.newManyToOneRelationship(project, entity, fieldName, qualifiedRhsType, null,
               FetchType.LAZY, false, Lists.<CascadeType> newArrayList());
      entityClass = entity.getJavaType();
View Full Code Here

      Assert.assertTrue(controller.canExecute());
      Result result = controller.execute();
      Assert.assertThat(result, is(not(instanceOf(Failed.class))));

      JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
      JavaResource javaResource = facet.getJavaResource("org.jboss.forge.test.MyInterceptorBinding");
      Assert.assertNotNull(javaResource);
      Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaAnnotation.class)));
      JavaAnnotation<?> ann = javaResource.getJavaType();
      Assert.assertTrue(ann.hasAnnotation(InterceptorBinding.class));
      Assert.assertFalse(ann.hasAnnotation(Inherited.class));
   }
View Full Code Here

   }

   @Test
   public void testAddOneToOneRel() throws Exception
   {
      JavaResource rhsClass = projectHelper.createJPAEntity(project, "Store");
      String qualifiedRhsType = rhsClass.getJavaType().getCanonicalName();
      String simpleRhsType = rhsClass.getJavaType().getName();

      String fieldName = "store";
      jpaFieldOperations.newOneToOneRelationship(project, entity, fieldName, qualifiedRhsType, null,
               FetchType.LAZY, false, Lists.<CascadeType> newArrayList());
      entityClass = entity.getJavaType();
View Full Code Here

      Assert.assertTrue(controller.canExecute());
      Result result = controller.execute();
      Assert.assertThat(result, is(not(instanceOf(Failed.class))));

      JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
      JavaResource javaResource = facet.getJavaResource("org.jboss.forge.test.MyQualifier");
      Assert.assertNotNull(javaResource);
      Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaAnnotation.class)));
      JavaAnnotation<?> ann = javaResource.getJavaType();
      Assert.assertTrue(ann.hasAnnotation(Qualifier.class));
      Assert.assertFalse(ann.hasAnnotation(Inherited.class));
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.parser.java.resources.JavaResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.