Skullabs site
skullabs / trip Goto Github PK
View Code? Open in Web Editor NEWThis project forked from miere/trip
Low coupling module development
License: Apache License 2.0
This project forked from miere/trip
Low coupling module development
License: Apache License 2.0
May be its a good time to create an CI job for this.
Consider you have an interface called MyService
. If you provide a service implementing interface at the source folder and another in the test folder you will face some NullPointerException while running tests that need those implementations. This occurs only when running then in Eclipse IDE.
The trip-processor depends on JMustache to generate classes at compile time. It makes an artifact with 2Mb of size. To make the usage of this artifact viable, it should have at most 150Kb.
The use of names to refer to a service is a deprecated practice. @Name
annotation, for sake of example, is discouraged to be used as injection classifier, but still pretty useful when using with JSF.
tRip has no intent to be a CDI provider, but a SPI provider. To keep its code simple, @Stateless.name
and @Singleton.name
attributes will be removed in this version.
Tenho a classe:
package com.test;
@trip.spi.Stateless
public class StatelessTest {
protected <T> Iterable<T> generic( Class<T> clazz ) {
return null;
}
}
E ela gera erro de compilação:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3:compile (default-compile) on project ttm-cobol-maven-plugin: Compilation failure: Compilation failure:
[ERROR] \Projetos\ttm-server\ttm-cobol\ttm-cobol-maven-plugin\target\generated-sources\annotations\com\test\StatelessTestStateless2463568548.java:[10,55] error: cannot find symbol
[ERROR]
[ERROR] \Projetos\ttm-server\ttm-cobol\ttm-cobol-maven-plugin\target\generated-sources\annotations\com\test\StatelessTestStateless2463568548.java:[10,27] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
Verifiquei e o metodo da classe StatelessTestStateless2463568548 ficou:
public java.lang.Iterable<T> generic( java.lang.Class<T> arg0 ) {
onde o correto seria:
public <T> java.lang.Iterable<T> generic( java.lang.Class<T> arg0 ) {
It will make development easier for developers with low maven knowledge.
Quando utilizada a classe DefaultServiceProvider
em um teste unitário e o teste unitário é executado diretamente pelo eclipse esta classe não funciona corretamente.
Abaixo as classes utilizadas para simular o problema:
`
package provider;
@trip.spi.Singleton
public class ProvidedClass implements ProvidedClassAnnotation {
}
package provider;
public interface ProvidedClassAnnotation {
}
package provider;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import trip.spi.DefaultServiceProvider;
import trip.spi.Provided;
import trip.spi.ServiceProvider;
public class ProvidedClassTest {
@Provided
ServiceProvider provider;
@Before
public void before(){
ServiceProvider serviceProvider = new DefaultServiceProvider();
serviceProvider.providerFor( ServiceProvider.class, serviceProvider );
serviceProvider.provideOn( this );
}
@Test
public void getClasses(){
Iterable<Class<ProvidedClassAnnotation>> iterable = ((DefaultServiceProvider)provider).loadClassesImplementing( ProvidedClassAnnotation.class );
List<Class<ProvidedClassAnnotation>> list = new ArrayList<>();
iterable.forEach( list::add );
Assert.assertFalse( "Lista está vazia", list.isEmpty() );
}
`
After some usage tests, becomes clear that developers wasn't understanding the exposition mechanism that choose which will be the supperclass ( or superinterface ) which a service is exposed and could be retrieved by ServiceProvider
.
Definition of done:
The new exposition rule will be defined as:
exposedAs
from @Stateless
and @Singleton
is empty, so the service is exposed by its own classexposedAs
from @Stateless
and @Singleton
is not empty, so the service is exposed by the class defined in exposedAs attributeDefinition of done:
Git Flow
master
branchmaster
branch build was finished with successDocumentation points to outdated tRip version.
Although it was useful in the last months, when trip-project is used in a multi-module maven project, all trip dependencies are forced as dependency under all modules. The propose of this feature was to make easy to use trip under Maven projects. Developers will be encouraged to download the trip-boilderplate project instead of use trip-project.
Todays naming mechanism to avoid ambiguations are done by @Name
annotation. Learning some users usage of tRip becomes clear that this approach are never found by devs. Instead, the test point out that they look for parameters on annotations.
Definition of done:
@Singleton
and @Stateless
annotations, and let users to use ServiceProvider.load( MyClass.class, "my-disambiguation-name" ) method as they are already using@Provided
annotation and let users to define which data will be provided matching the name defined on this attribute.Similar to @javax.enterprise.inject.Any
, should be possible to developers inject all occurrences from specific interface or superclass.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.