Examples of JavaResource


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

         Assert.assertTrue(controller.canExecute());
         Result result = controller.execute();
         Assert.assertThat(result, is(not(instanceOf(Failed.class))));
      }
      JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
      JavaResource filterResource = facet.getJavaResource("unknown.rest.NewCrossOriginResourceSharingFilter");
      Assert.assertTrue(filterResource.exists());
      Assert.assertThat(filterResource.getJavaType(), is(instanceOf(JavaClass.class)));
      JavaClass<?> filterClass = filterResource.getJavaType();
      Assert.assertFalse(filterClass.hasSyntaxErrors());
      Assert.assertTrue(filterClass.hasAnnotation(Provider.class));
      Assert.assertTrue(filterClass.hasAnnotation(PreMatching.class));
      Method<?, ?> method = filterClass
               .getMethod("filter", ContainerRequestContext.class, ContainerResponseContext.class);
View Full Code Here

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

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

      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

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

   @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

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

   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

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

   }

   @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

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

   }

   @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

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

   }

   @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

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

      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

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

   }

   @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
TOP
Copyright © 2018 www.massapi.com. 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.