Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 30 files changed
  • 0 commit comments
  • 1 contributor
Showing with 264 additions and 165 deletions.
  1. +21 −0 core/api/src/main/java/org/qi4j/api/activation/ActivationException.java
  2. +4 −1 core/api/src/main/java/org/qi4j/api/association/GenericAssociationInfo.java
  3. +1 −1  core/api/src/main/java/org/qi4j/api/composite/ConstructorDescriptor.java
  4. +1 −1  core/api/src/main/java/org/qi4j/api/composite/PropertyMapper.java
  5. +38 −9 core/api/src/main/java/org/qi4j/api/entity/EntityReference.java
  6. +1 −1  core/api/src/main/java/org/qi4j/api/mixin/MixinDescriptor.java
  7. +3 −0  core/api/src/main/java/org/qi4j/api/property/InvalidPropertyTypeException.java
  8. +4 −4 core/api/src/main/java/org/qi4j/api/property/Numbers.java
  9. +12 −0 core/api/src/main/java/org/qi4j/api/service/ServiceReference.java
  10. +1 −1  core/api/src/main/java/org/qi4j/api/sideeffect/SideEffectDescriptor.java
  11. +9 −1 core/api/src/main/java/org/qi4j/api/structure/ApplicationDescriptor.java
  12. +3 −0  core/api/src/main/java/org/qi4j/api/structure/Layer.java
  13. +7 −1 core/api/src/main/java/org/qi4j/api/structure/LayerDescriptor.java
  14. +23 −1 core/api/src/main/java/org/qi4j/api/structure/Module.java
  15. +2 −1  core/api/src/main/java/org/qi4j/api/type/CollectionType.java
  16. +1 −1  core/api/src/main/java/org/qi4j/api/type/EnumType.java
  17. +2 −1  core/api/src/main/java/org/qi4j/api/type/MapType.java
  18. +1 −1  core/api/src/main/java/org/qi4j/api/type/ValueCompositeType.java
  19. +3 −2 core/api/src/main/java/org/qi4j/api/type/ValueType.java
  20. +6 −3 core/api/src/main/java/org/qi4j/api/unitofwork/UnitOfWorkException.java
  21. +3 −0  core/api/src/main/java/org/qi4j/api/util/Classes.java
  22. +8 −0 core/api/src/main/java/org/qi4j/api/util/Dates.java
  23. +4 −4 core/runtime/src/main/java/org/qi4j/runtime/composite/AbstractModifierModel.java
  24. +25 −0 core/runtime/src/main/java/org/qi4j/runtime/composite/CompositeMethodModel.java
  25. +3 −3 core/runtime/src/main/java/org/qi4j/runtime/composite/ConstructorModel.java
  26. +5 −5 core/runtime/src/main/java/org/qi4j/runtime/composite/MixinModel.java
  27. +1 −1  core/runtime/src/main/java/org/qi4j/runtime/composite/SideEffectModel.java
  28. +25 −57 core/runtime/src/test/java/org/qi4j/test/ASMTest.java
  29. +26 −25 libraries.gradle
  30. +21 −40 libraries/rest-client/src/test/java/org/qi4j/library/rest/client/RssReaderTest.java
View
21 core/api/src/main/java/org/qi4j/api/activation/ActivationException.java
@@ -1,7 +1,28 @@
+/*
+ * Copyright 2013 Niclas Hedhman.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.qi4j.api.activation;
+/**
+ * Thrown when unable to activate.
+ */
public class ActivationException extends Exception
{
+ private static final long serialVersionUID = 1L;
public ActivationException( String message, Throwable cause )
{
super( message, cause );
View
5 core/api/src/main/java/org/qi4j/api/association/GenericAssociationInfo.java
@@ -13,7 +13,7 @@
* implied.
*
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
package org.qi4j.api.association;
@@ -23,6 +23,9 @@
import static org.qi4j.api.util.Classes.typeOf;
+/**
+ * Generic Association info.
+ */
public final class GenericAssociationInfo
{
public static Type associationTypeOf( AccessibleObject accessor )
View
2  core/api/src/main/java/org/qi4j/api/composite/ConstructorDescriptor.java
@@ -21,5 +21,5 @@
*/
public interface ConstructorDescriptor
{
- Constructor constructor();
+ Constructor<?> constructor();
}
View
2  core/api/src/main/java/org/qi4j/api/composite/PropertyMapper.java
@@ -26,7 +26,7 @@
import org.qi4j.api.value.ValueComposite;
/**
- * Transfer properties to Composite properties
+ * Transfer java.util.Properties to Composite properties
*/
public final class PropertyMapper
{
View
47 core/api/src/main/java/org/qi4j/api/entity/EntityReference.java
@@ -18,51 +18,77 @@
import org.qi4j.api.util.NullArgumentException;
/**
- * An EntityReference is identity of a specific
- * Entity instance. When stringified, the identity is used as-is. Example:
- * <pre>
- * 123456-abcde
- * </pre>
+ * An EntityReference is identity of a specific Entity instance.
+ * <p>When stringified, the identity is used as-is. Example:</p>
+ * <pre>123456-abcde</pre>
*/
public final class EntityReference
implements Serializable
{
+ /**
+ * Parse an URI to an EntityReference.
+ * @param uri the URI to parse
+ * @return the EntityReference represented by the given URI
+ */
public static EntityReference parseURI( String uri )
{
String identity = uri.substring( "urn:qi4j:entity:".length() );
return new EntityReference( identity );
}
- public static EntityReference parseEntityReference( String id )
+ /**
+ * Parse an Entity identity to an EntityReference.
+ * @param identity the EntityReference identity
+ * @return the EntityReference represented by the given identity
+ */
+ public static EntityReference parseEntityReference( String identity )
{
- return new EntityReference( id );
+ return new EntityReference( identity );
}
- public static EntityReference entityReferenceFor( Object o )
+ /**
+ * @param object an EntityComposite
+ * @return the EntityReference for the given EntityComposite
+ */
+ public static EntityReference entityReferenceFor( Object object )
{
- return new EntityReference( (EntityComposite) o );
+ return new EntityReference( (EntityComposite) object );
}
private static final long serialVersionUID = 1L;
private String identity;
+ /**
+ * @param entityComposite a non-null EntityComposite
+ * @throws NullPointerException if entityComposite is null
+ */
public EntityReference( EntityComposite entityComposite )
{
this( entityComposite.identity().get() );
}
+ /**
+ * @param identity reference identity
+ * @throws NullArgumentException if identity is null or empty
+ */
public EntityReference( String identity )
{
NullArgumentException.validateNotEmpty( "identity", identity );
this.identity = identity;
}
+ /**
+ * @return This EntityReference identity.
+ */
public final String identity()
{
return identity;
}
+ /**
+ * @return An URI representation of this EntityReference.
+ */
public String toURI()
{
return "urn:qi4j:entity:" + identity;
@@ -91,6 +117,9 @@ public int hashCode()
return result;
}
+ /**
+ * @return This EntityReference identity.
+ */
@Override
public String toString()
{
View
2  core/api/src/main/java/org/qi4j/api/mixin/MixinDescriptor.java
@@ -19,5 +19,5 @@
*/
public interface MixinDescriptor
{
- Class mixinClass();
+ Class<?> mixinClass();
}
View
3  core/api/src/main/java/org/qi4j/api/property/InvalidPropertyTypeException.java
@@ -3,6 +3,9 @@
import java.lang.reflect.AccessibleObject;
import org.qi4j.api.common.ConstructionException;
+/**
+ * Thrown when attempting to subclass Property.
+ */
public class InvalidPropertyTypeException extends ConstructionException
{
public InvalidPropertyTypeException( AccessibleObject accessor )
View
8 core/api/src/main/java/org/qi4j/api/property/Numbers.java
@@ -17,10 +17,10 @@
import java.math.BigDecimal;
/**
- * Convenience class for mathematical operations on
- * numerical properties.
- * <p/>
- * add(object.number(), 5)
+ * Convenience class for mathematical operations on numerical properties.
+ * <pre>import static org.qi4j.api.property.Numbers.*;
+ * ...
+ * add( object.numberProperty(), 5 );</pre>
*/
public final class Numbers
{
View
12 core/api/src/main/java/org/qi4j/api/service/ServiceReference.java
@@ -25,11 +25,23 @@
public interface ServiceReference<T>
extends HasTypes, ActivationEventListenerRegistration, MetaInfoHolder
{
+ /**
+ * @return the service's identity
+ */
String identity();
+ /**
+ * @return the actual service
+ */
T get();
+ /**
+ * @return TRUE if the service is active, otherwise return FALSE
+ */
boolean isActive();
+ /**
+ * @return TRUE if the service is available, otherwise return FALSE
+ */
boolean isAvailable();
}
View
2  core/api/src/main/java/org/qi4j/api/sideeffect/SideEffectDescriptor.java
@@ -19,5 +19,5 @@
*/
public interface SideEffectDescriptor
{
- Class modifierClass();
+ Class<?> modifierClass();
}
View
10 core/api/src/main/java/org/qi4j/api/structure/ApplicationDescriptor.java
@@ -11,7 +11,6 @@
* limitations under the License.
*
*/
-
package org.qi4j.api.structure;
import org.qi4j.api.Qi4j;
@@ -23,7 +22,16 @@
public interface ApplicationDescriptor
extends VisitableHierarchy<Object, Object>
{
+ /**
+ * Create a new instance of the Application.
+ * @param runtime Qi4j Runtime
+ * @param importedServiceInstances Imported Services instances
+ * @return a new instance of the Application.
+ */
Application newInstance( Qi4j runtime, Object... importedServiceInstances );
+ /**
+ * @return the Application's name
+ */
String name();
}
View
3  core/api/src/main/java/org/qi4j/api/structure/Layer.java
@@ -24,5 +24,8 @@
public interface Layer
extends ActivationEventListenerRegistration, Activation, MetaInfoHolder
{
+ /**
+ * @return the Layer's name
+ */
String name();
}
View
8 core/api/src/main/java/org/qi4j/api/structure/LayerDescriptor.java
@@ -11,7 +11,6 @@
* limitations under the License.
*
*/
-
package org.qi4j.api.structure;
/**
@@ -19,7 +18,14 @@
*/
public interface LayerDescriptor
{
+
+ /**
+ * @return the Layer's name
+ */
String name();
+ /**
+ * @return Layers used by this Layer
+ */
UsedLayersDescriptor usedLayers();
}
View
24 core/api/src/main/java/org/qi4j/api/structure/Module.java
@@ -12,7 +12,6 @@
* limitations under the License.
*
*/
-
package org.qi4j.api.structure;
import org.qi4j.api.activation.ActivationEventListenerRegistration;
@@ -43,15 +42,38 @@
QueryBuilderFactory,
ServiceFinder
{
+
+ /**
+ * @return the Module's name
+ */
String name();
+ /**
+ * @return the Module's ClassLoader
+ */
ClassLoader classLoader();
+ /**
+ * @param typeName name of a transient composite type
+ * @return the descriptor for a transient composite or null if the class could not be found or the transient composite is not visible
+ */
TransientDescriptor transientDescriptor( String typeName );
+ /**
+ * @param typeName name of an entity composite type
+ * @return the descriptor for an entity composite or null if the class could not be found or the entity composite is not visible
+ */
EntityDescriptor entityDescriptor( String typeName );
+ /**
+ * @param typeName name of an object type
+ * @return the descriptor for an object or null if the class could not be found or the object is not visible
+ */
ObjectDescriptor objectDescriptor( String typeName );
+ /**
+ * @param typeName name of a value composite type
+ * @return the descriptor for a value composite or null if the class could not be found or the value composite is not visible
+ */
ValueDescriptor valueDescriptor( String typeName );
}
View
3  core/api/src/main/java/org/qi4j/api/type/CollectionType.java
@@ -20,7 +20,8 @@
import org.qi4j.api.util.Classes;
/**
- * Collection type. This handles Collection, List and Set types
+ * Collection ValueType.
+ * <p>This handles Collection, List and Set types.</p>
*/
public final class CollectionType
extends ValueType
View
2  core/api/src/main/java/org/qi4j/api/type/EnumType.java
@@ -16,7 +16,7 @@
import java.lang.reflect.Type;
/**
- * Enumeration type
+ * Enum ValueType.
*/
public final class EnumType
extends ValueType
View
3  core/api/src/main/java/org/qi4j/api/type/MapType.java
@@ -18,7 +18,8 @@
import org.qi4j.api.util.Classes;
/**
- * Map type. This handles instances of Map
+ * Map ValueType.
+ * <p>This handles instances of Map.</p>
*/
public final class MapType
extends ValueType
View
2  core/api/src/main/java/org/qi4j/api/type/ValueCompositeType.java
@@ -22,7 +22,7 @@
import org.qi4j.api.value.ValueDescriptor;
/**
- * ValueComposite type
+ * ValueComposite ValueType.
*/
public final class ValueCompositeType
extends ValueType
View
5 core/api/src/main/java/org/qi4j/api/type/ValueType.java
@@ -23,8 +23,6 @@
/**
* Base class for types of values in ValueComposites and Properties.
- *
- * TODO I think the ValueType system requires some major re-thinking.
*/
public class ValueType
implements HasTypes
@@ -92,6 +90,9 @@ public static boolean isPrimitiveValueType( ValueType valueType )
return isPrimitiveValueType( valueType.mainType() );
}
+ /**
+ * @see ValueType#isPrimitiveValue(java.lang.Object)
+ */
public static boolean isPrimitiveValueType( Class<?> type )
{
NullArgumentException.validateNotNull( "type", type );
View
9 core/api/src/main/java/org/qi4j/api/unitofwork/UnitOfWorkException.java
@@ -3,19 +3,22 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.qi4j.api.unitofwork;
+/**
+ * Base Exception for UnitOfWork related concerns.
+ */
public class UnitOfWorkException
extends RuntimeException
{
View
3  core/api/src/main/java/org/qi4j/api/util/Classes.java
@@ -108,6 +108,9 @@ public Type map( Type aClass )
}
};
+ /**
+ * Function that extract the raw class of a type.
+ */
public static final Function<Type, Class<?>> RAW_CLASS = new Function<Type, Class<?>>()
{
@Override
View
8 core/api/src/main/java/org/qi4j/api/util/Dates.java
@@ -50,6 +50,10 @@ protected DateFormat initialValue()
}
};
+ /**
+ * @param stringDate a string representing a date as either ISO8601, @millis@ or /Date() formats
+ * @return a Date
+ */
public static Date fromString( String stringDate )
{
try
@@ -84,6 +88,10 @@ else if( stringDate.startsWith( "/Date(" ) && stringDate.endsWith( ")/" ) ) // M
}
}
+ /**
+ * @param date a Date
+ * @return String representation in ISO8601 UTC
+ */
public static String toUtcString( Date date )
{
return ISO8601_UTC.get().format( date );
View
8 core/runtime/src/main/java/org/qi4j/runtime/composite/AbstractModifierModel.java
@@ -37,15 +37,15 @@
public abstract class AbstractModifierModel
implements Dependencies, VisitableHierarchy<Object, Object>
{
- private final Class modifierClass;
+ private final Class<?> modifierClass;
private ConstructorsModel constructorsModel;
private InjectedFieldsModel injectedFieldsModel;
private InjectedMethodsModel injectedMethodsModel;
- private Class[] nextInterfaces;
+ private Class<?>[] nextInterfaces;
- public AbstractModifierModel( Class declaredModifierClass, Class instantiationClass )
+ public AbstractModifierModel( Class<?> declaredModifierClass, Class<?> instantiationClass )
{
this.modifierClass = instantiationClass;
constructorsModel = new ConstructorsModel( modifierClass );
@@ -55,7 +55,7 @@ public AbstractModifierModel( Class declaredModifierClass, Class instantiationCl
nextInterfaces = toArray( componentType, unique( map( RAW_CLASS, interfacesOf( declaredModifierClass ) ) ));
}
- public Class modifierClass()
+ public Class<?> modifierClass()
{
return modifierClass;
}
View
25 core/runtime/src/main/java/org/qi4j/runtime/composite/CompositeMethodModel.java
@@ -16,6 +16,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Array;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -23,6 +24,7 @@
import java.util.List;
import org.qi4j.api.common.ConstructionException;
import org.qi4j.api.composite.MethodDescriptor;
+import org.qi4j.api.util.NullArgumentException;
import org.qi4j.functional.HierarchicalVisitor;
import org.qi4j.functional.VisitableHierarchy;
import org.qi4j.runtime.injection.Dependencies;
@@ -291,5 +293,28 @@ public boolean isAnnotationPresent( Class<? extends Annotation> annotationClass
{
return new Annotation[ 0 ];
}
+
+ // @Override (Since JDK 8)
+ @SuppressWarnings( "unchecked" )
+ public <T extends Annotation> T[] getAnnotations( Class<T> annotationClass )
+ {
+ NullArgumentException.validateNotNull( "annotationClass", annotationClass );
+ return (T[]) Array.newInstance( annotationClass, 0 );
+ }
+
+ // @Override (Since JDK 8)
+ public <T extends Annotation> T getDeclaredAnnotation( Class<T> annotationClass )
+ {
+ NullArgumentException.validateNotNull( "annotationClass", annotationClass );
+ return null;
+ }
+
+ // @Override (Since JDK 8)
+ @SuppressWarnings( "unchecked" )
+ public <T extends Annotation> T[] getDeclaredAnnotations( Class<T> annotationClass )
+ {
+ NullArgumentException.validateNotNull( "annotationClass", annotationClass );
+ return (T[]) Array.newInstance( annotationClass, 0 );
+ }
}
}
View
6 core/runtime/src/main/java/org/qi4j/runtime/composite/ConstructorModel.java
@@ -32,11 +32,11 @@
public final class ConstructorModel
implements ConstructorDescriptor, VisitableHierarchy<Object, Object>
{
- private Constructor constructor;
+ private Constructor<?> constructor;
private InjectedParametersModel parameters;
- public ConstructorModel( Constructor constructor, InjectedParametersModel parameters )
+ public ConstructorModel( Constructor<?> constructor, InjectedParametersModel parameters )
{
this.constructor = constructor;
this.parameters = parameters;
@@ -44,7 +44,7 @@ public ConstructorModel( Constructor constructor, InjectedParametersModel parame
}
@Override
- public Constructor constructor()
+ public Constructor<?> constructor()
{
return constructor;
}
View
10 core/runtime/src/main/java/org/qi4j/runtime/composite/MixinModel.java
@@ -42,14 +42,14 @@
public final class MixinModel
implements MixinDescriptor, VisitableHierarchy<Object, Object>
{
- private final Class mixinClass;
- private final Class instantiationClass;
+ private final Class<?> mixinClass;
+ private final Class<?> instantiationClass;
private final ConstructorsModel constructorsModel;
private final InjectedFieldsModel injectedFieldsModel;
private final InjectedMethodsModel injectedMethodsModel;
private final Iterable<Class<?>> thisMixinTypes;
- public MixinModel( Class declaredMixinClass, Class instantiationClass )
+ public MixinModel( Class<?> declaredMixinClass, Class<?> instantiationClass )
{
injectedFieldsModel = new InjectedFieldsModel( declaredMixinClass );
injectedMethodsModel = new InjectedMethodsModel( declaredMixinClass );
@@ -62,12 +62,12 @@ public MixinModel( Class declaredMixinClass, Class instantiationClass )
}
@Override
- public Class mixinClass()
+ public Class<?> mixinClass()
{
return mixinClass;
}
- public Class instantiationClass()
+ public Class<?> instantiationClass()
{
return instantiationClass;
}
View
2  core/runtime/src/main/java/org/qi4j/runtime/composite/SideEffectModel.java
@@ -23,7 +23,7 @@
extends AbstractModifierModel
implements SideEffectDescriptor
{
- public SideEffectModel( Class sideEffectClass, Class instantiationClass )
+ public SideEffectModel( Class<?> sideEffectClass, Class<?> instantiationClass )
{
super( sideEffectClass, instantiationClass );
}
View
82 core/runtime/src/test/java/org/qi4j/test/ASMTest.java
@@ -14,88 +14,42 @@
package org.qi4j.test;
+import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
+import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
-import org.objectweb.asm.util.ASMifierClassVisitor;
+import org.objectweb.asm.util.ASMifier;
+import org.objectweb.asm.util.TraceClassVisitor;
import org.qi4j.api.composite.CompositeInvoker;
import org.qi4j.runtime.composite.FragmentClassLoader;
+import org.qi4j.runtime.composite.QI256Test;
-import static org.objectweb.asm.Opcodes.AASTORE;
-import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
-import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
-import static org.objectweb.asm.Opcodes.ACC_STATIC;
-import static org.objectweb.asm.Opcodes.ACC_SUPER;
-import static org.objectweb.asm.Opcodes.ACONST_NULL;
-import static org.objectweb.asm.Opcodes.ALOAD;
-import static org.objectweb.asm.Opcodes.ANEWARRAY;
-import static org.objectweb.asm.Opcodes.ARETURN;
-import static org.objectweb.asm.Opcodes.ASTORE;
-import static org.objectweb.asm.Opcodes.ATHROW;
-import static org.objectweb.asm.Opcodes.BIPUSH;
-import static org.objectweb.asm.Opcodes.CHECKCAST;
-import static org.objectweb.asm.Opcodes.DLOAD;
-import static org.objectweb.asm.Opcodes.DUP;
-import static org.objectweb.asm.Opcodes.FLOAD;
-import static org.objectweb.asm.Opcodes.GETFIELD;
-import static org.objectweb.asm.Opcodes.GETSTATIC;
-import static org.objectweb.asm.Opcodes.GOTO;
-import static org.objectweb.asm.Opcodes.ICONST_0;
-import static org.objectweb.asm.Opcodes.ICONST_1;
-import static org.objectweb.asm.Opcodes.ICONST_2;
-import static org.objectweb.asm.Opcodes.ICONST_3;
-import static org.objectweb.asm.Opcodes.ICONST_4;
-import static org.objectweb.asm.Opcodes.ICONST_5;
-import static org.objectweb.asm.Opcodes.ILOAD;
-import static org.objectweb.asm.Opcodes.INVOKEINTERFACE;
-import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
-import static org.objectweb.asm.Opcodes.INVOKESTATIC;
-import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
-import static org.objectweb.asm.Opcodes.IRETURN;
-import static org.objectweb.asm.Opcodes.LLOAD;
-import static org.objectweb.asm.Opcodes.NEW;
-import static org.objectweb.asm.Opcodes.POP;
-import static org.objectweb.asm.Opcodes.PUTSTATIC;
-import static org.objectweb.asm.Opcodes.RETURN;
-import static org.objectweb.asm.Opcodes.V1_6;
+import static org.objectweb.asm.Opcodes.*;
-/**
- * JAVADOC
- */
public class ASMTest
{
@Test
public void generateASM()
throws Exception
{
- ASMifierClassVisitor.main( new String[]{ SomeMixin_Stubx.class.getName() } );
+ ASMifier.main( new String[]{ SomeMixin_Stubx.class.getName() } );
}
@Test
-// @Ignore
public void createClass()
throws Exception
{
-/*
- byte[] asm = generateClass();
-
- byte[] cl = FragmentClassLoader.generateClass( QI256Test.TestTransient.TestTransientMixin.class.getName() + "_Stub", QI256Test.TestTransient.TestTransientMixin.class );
-
- ClassReader cr = new ClassReader( cl );
- cr.accept( new ASMifierClassVisitor( new PrintWriter( System.out, true ) ),
- ASMifierClassVisitor.getDefaultAttributes(),
- 0 );
-*/
-
- // Assert.assertArrayEquals( asm, cl );
FragmentClassLoader classLoader = new FragmentClassLoader( SomeMixin.class.getClassLoader() );
@@ -188,9 +142,23 @@ public Object invokeComposite( Method method, Object[] args )
System.out.println( instance.testConcern() );
}
- // This is the code generated from the manual stub
+ @Test
+ @Ignore( "This was dead commented code, ~70% of this source file ... What should we do about this!?!" )
+ public void fragmentClassLoaderGenerateClassTest()
+ throws Exception
+ {
+ byte[] asm = generateClass();
+ byte[] cl = FragmentClassLoader.generateClass(
+ QI256Test.TestTransient.TestTransientMixin.class.getName() + "_Stub",
+ QI256Test.TestTransient.TestTransientMixin.class );
+
+ new ClassReader( cl ).accept( new TraceClassVisitor( new PrintWriter( System.out, true ) ), 0 );
- public static byte[] generateClass()
+ Assert.assertArrayEquals( asm, cl );
+ }
+
+ // This is the code generated from the manual stub
+ private static byte[] generateClass()
{
ClassWriter cw = new ClassWriter( 0 );
FieldVisitor fv;
View
51 libraries.gradle
@@ -1,5 +1,5 @@
// Versions of Dependencies;
-def asmVersion = '3.3.1'
+def asmVersion = '4.1'
def beanshellVersion = '2.0b4'
def bonecpVersion = '0.7.1.RELEASE'
def bouncyVersion = '1.46'
@@ -11,33 +11,33 @@ def commonsLangVersion = '2.6'
def cxfVersion = '2.5.6' // 2.7.0 - Unable to resolve dependencies!
def derbyVersion = '10.9.1.0'
def dnsJavaVersion = '2.1.1'
-def ehcacheVersion = '2.6.2'
-def elasticsearchVersion = '0.20.1'
+def ehcacheVersion = '2.6.3'
+def elasticsearchVersion = '0.20.5'
def freemarkerVersion = '2.3.19'
-def gaeVersion = '1.7.3'
-def groovyVersion = '2.0.5'
+def gaeVersion = '1.7.5'
+def groovyVersion = '2.1.0'
def guavaVersion = '13.0.1'
-def h2Version = '1.3.168'
-def hazelcastVersion = '2.4'
+def h2Version = '1.3.170'
+def hazelcastVersion = '2.5'
def httpClientVersion = '4.1.3' // 4.2.2 Fails to do HTTP basic auth in tests!
def javascriptVersion = '1.7R4'
def javasqlgeneratorVersion = '0.3.2'
-def jcloudsVersion = '1.5.3'
+def jcloudsVersion = '1.5.7'
def jdbmVersion = '2.0.1'
def jdomVersion = '2.0.2'
def jedisVersion = '2.1.0'
-ext.jettyVersion = '8.1.8.v20121106' // 9.0.0.M2 exists
+ext.jettyVersion = '8.1.9.v20130131' // 9.0.0.M5 exists
def jgoodiesLooksVersion = '2.5.2'
def jodaTimeVersion = '2.1'
-def jrubyVersion = '1.7.0'
+def jrubyVersion = '1.7.2'
def jtaVersion = '1.1'
-def leveldbVersion = '0.4'
-def leveldbJniVersion = '1.4.1'
+def leveldbVersion = '0.5'
+def leveldbJniVersion = '1.6'
def liquibaseVersion = '2.0.5'
def log4jVersion = '1.2.17'
-def logbackVersion = '1.0.7'
-def mongodbVersion = '2.9.3'
-def mysqlVersion = '5.1.21'
+def logbackVersion = '1.0.9'
+def mongodbVersion = '2.10.1'
+def mysqlVersion = '5.1.23'
def neoVersion = '1.3' // 1.8 exists
def neoIndexVersion = '1.3-1.3.M01' // Do not exist anymore!
def orgJsonVersion = '20130213'
@@ -46,9 +46,9 @@ def pdfboxVersion = '1.7.1'
def postgresqlVersion = '9.1-901-1.jdbc4'
def prefuseVersion = '0.21'
def rdfVersion = '2.6.6' // 2.6.9 - Application assembly fails, missing method Repository.isInitalized().
-def restletVersion = '2.0.15'
-def riakVersion = '1.0.6'
-def scalaVersion = '2.9.2'
+def restletVersion = '2.0.15' // HTTP(S) connectors in 2.1.x serie are buggy, see https://github.com/restlet/restlet-framework-java/issues/620
+def riakVersion = '1.0.7'
+def scalaVersion = '2.10.0'
ext.servletVersion = '3.0.1'
def shiroVersion = '1.2.1'
def skedVersion = '1.2'
@@ -57,22 +57,22 @@ def slf4jVersion = '1.7.2'
def solrVersion = "1.4.1" // 4.0.0 - Fails to compile!
def springVersion = '3.1.2.RELEASE'
def sqliteVersion = '3.7.2'
-def strutsVersion = '2.3.7'
+def strutsVersion = '2.3.8'
def velocityVersion = '1.7'
def voldemortVersion = '0.81' // Taken from Clojars maven repository, 0.96 not in any repository?
def wicketVersion = '1.5.8' // 6.3.0 - Samples fails to compile!
def wicketStatelessVersion = '1.5.0'
def woodstoxVersion = '4.1.4'
def wsdl4jVersion = '1.6.2'
-def yammerMetricsVersion = '2.1.5'
+def yammerMetricsVersion = '2.2.0'
def antVersion = '1.8.4'
def junitVersion = '4.11'
def testNgVersion = '6.8'
-def jmockVersion = '2.5.1'
+def jmockVersion = '2.6.0'
def mockitoVersion = '1.9.5'
def easyMockVersion = '3.1'
-def xmlunitVersion = '1.3'
+def xmlunitVersion = '1.4'
// build a map of the dependency artifacts to use. Allows centralized definition of the version of artifacts to
// use. In that respect it serves a role similar to <dependencyManagement> in Maven
@@ -84,9 +84,9 @@ rootProject.ext {
ant_junit: "org.apache.ant:ant-junit:$antVersion",
// ASM
- asm: "asm:asm:$asmVersion",
- asm_util: "asm:asm-util:$asmVersion",
- asm_commons: "asm:asm-commons:$asmVersion",
+ asm: "org.ow2.asm:asm:$asmVersion",
+ asm_util: "org.ow2.asm:asm-util:$asmVersion",
+ asm_commons: "org.ow2.asm:asm-commons:$asmVersion",
// OSGi
osgi_core: "org.osgi:org.osgi.core:$osgiVersion",
@@ -108,6 +108,7 @@ rootProject.ext {
// Restlet
restlet: [
"org.restlet.jee:org.restlet:$restletVersion",
+ "org.restlet.jee:org.restlet.ext.ssl:$restletVersion",
"org.restlet.jee:org.restlet.ext.atom:$restletVersion",
"org.restlet.jee:org.restlet.ext.servlet:$restletVersion",
"org.restlet.jee:org.restlet.ext.slf4j:$restletVersion"
View
61 libraries/rest-client/src/test/java/org/qi4j/library/rest/client/RssReaderTest.java
@@ -9,7 +9,6 @@
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.junit.Test;
-import org.qi4j.api.value.ValueBuilder;
import org.qi4j.bootstrap.AssemblyException;
import org.qi4j.bootstrap.ModuleAssembly;
import org.qi4j.library.rest.client.api.ContextResourceClient;
@@ -20,7 +19,6 @@
import org.qi4j.library.rest.client.spi.ResponseReader;
import org.qi4j.library.rest.client.spi.ResultHandler;
import org.qi4j.library.rest.common.ValueAssembler;
-import org.qi4j.library.rest.common.link.Link;
import org.qi4j.test.AbstractQi4jTest;
import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.restlet.Client;
@@ -35,12 +33,14 @@
import static org.qi4j.library.rest.client.api.HandlerCommand.*;
/**
- * Reads my RSS feed and prints out all comments for each entry. This is an example of how
- * to use the RSS client for something more generic that was not produced by Qi4j REST server library.
+ * Reads Qi4j Github commits on develop ATOM feed and prints out all title and detail url for each entry.
+ * This is an example of how to use the RSS client for something more generic that was not produced by Qi4j REST server
+ * library.
*/
public class RssReaderTest
extends AbstractQi4jTest
{
+
private ContextResourceClient crc;
@Override
@@ -56,7 +56,7 @@ public void assemble( ModuleAssembly module )
@Test
public void testReadRssFeed()
{
- Client client = new Client( Protocol.HTTP );
+ Client client = new Client( Protocol.HTTPS );
Reference ref = new Reference( "https://github.com/Qi4j/qi4j-sdk/commits/develop.atom" );
ContextResourceClientFactory contextResourceClientFactory = module.newObject( ContextResourceClientFactory.class, client );
@@ -66,7 +66,7 @@ public void testReadRssFeed()
public Object readResponse( Response response, Class<?> resultType )
throws ResourceException
{
- if (resultType.equals( Document.class ))
+ if( resultType.equals( Document.class ) )
{
try
{
@@ -80,7 +80,7 @@ public Object readResponse( Response response, Class<?> resultType )
}
}
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
} );
@@ -89,7 +89,7 @@ public Object readResponse( Response response, Class<?> resultType )
@Override
public HandlerCommand handleResponse( Response response, ContextResourceClient client )
{
- // Try to restart
+ System.out.println( ">> REFRESH on recoverable error: " + response.getStatus() );
return refresh();
}
} ) );
@@ -107,12 +107,14 @@ public HandlerCommand handleResult( Document result, ContextResourceClient clien
{
final XPath xPath = XPathFactory.newInstance().newXPath();
- System.out.println( "== "+xPath.evaluate( "rss/channel/title", result )+" ==");
+ System.out.println( "== " + xPath.evaluate( "feed/title", result ) + " ==" );
- final NodeList nodes = (NodeList)xPath.evaluate( "rss/channel/item", result, XPathConstants.NODESET);
+ final NodeList nodes = (NodeList) xPath.evaluate( "feed/entry", result, XPathConstants.NODESET );
List<Node> items = new ArrayList<Node>();
- for (int i = 0; i < nodes.getLength(); i++)
+ for( int i = 0; i < nodes.getLength(); i++ )
+ {
items.add( nodes.item( i ) );
+ }
itemNodes = items.iterator();
@@ -127,41 +129,20 @@ public HandlerCommand handleResult( Document result, ContextResourceClient clien
private HandlerCommand processEntry( final XPath xPath )
throws XPathExpressionException
{
- if (!itemNodes.hasNext())
+ if( !itemNodes.hasNext() )
+ {
return null;
+ }
Node item = itemNodes.next();
- System.out.println( "-- "+xPath.evaluate( "title", item )+" --" );
- String commentUrl = xPath.evaluate( "commentRss", item );
+ String title = xPath.evaluate( "title", item );
+ String detailUrl = xPath.evaluate( "link/@href", item );
- ValueBuilder<Link> link = module.newValueBuilder( Link.class );
- link.prototype().rel().set( "item" );
- link.prototype().id().set( "item" );
- link.prototype().href().set( commentUrl );
+ System.out.println( "-- " + title + " --" );
+ System.out.println( "-- " + detailUrl + " --" );
- return query( link.newInstance() ).onSuccess( new ResultHandler<Document>()
- {
- @Override
- public HandlerCommand handleResult( Document result, ContextResourceClient client )
- {
- try
- {
- final NodeList comments = (NodeList)xPath.evaluate( "rss/channel/item", result, XPathConstants.NODESET);
- for (int i = 0; i < comments.getLength(); i++)
- {
- System.out.println( xPath.evaluate( "description", comments.item( i ) ));
- System.out.println( "---");
- }
-
- return processEntry( xPath );
- }
- catch( XPathExpressionException e )
- {
- throw new ResourceException( e );
- }
- }
- } );
+ return processEntry( xPath );
}
} );

No commit comments for this range

Something went wrong with that request. Please try again.