forked from apache/dubbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix apache#6306. support TypeBuilder sort
- Loading branch information
Showing
6 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...ubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/TestTypeBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.apache.dubbo.metadata.definition; | ||
|
||
import org.apache.dubbo.metadata.definition.builder.TypeBuilder; | ||
import org.apache.dubbo.metadata.definition.model.TypeDefinition; | ||
|
||
import java.lang.reflect.Type; | ||
import java.util.Map; | ||
|
||
/** | ||
* test for sort | ||
*/ | ||
public class TestTypeBuilder implements TypeBuilder { | ||
// it is smaller than the implements of TypeBuilder | ||
public int order(){ | ||
return 10; | ||
} | ||
|
||
@Override | ||
public boolean accept(Type type, Class<?> clazz) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public TypeDefinition build(Type type, Class<?> clazz, Map<Class<?>, TypeDefinition> typeCache) { | ||
return null; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ata-api/src/test/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.apache.dubbo.metadata.definition; | ||
|
||
import org.apache.dubbo.metadata.definition.builder.TypeBuilder; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class TypeDefinitionBuilderTest { | ||
|
||
@Test | ||
public void testSortTypeBuilder(){ | ||
TypeBuilder tb = TypeDefinitionBuilder.BUILDERS.get(0); | ||
Assertions.assertTrue(tb instanceof TestTypeBuilder); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...esources/META-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test=org.apache.dubbo.metadata.definition.TestTypeBuilder |