You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/07/30 21:48:57 UTC
[58/80] zest-java git commit: Stage 2 of the namespace change. Bulk
of documentation fixed.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/JsonFormatterFactory.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/JsonFormatterFactory.java b/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/JsonFormatterFactory.java
deleted file mode 100644
index b0d3e48..0000000
--- a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/JsonFormatterFactory.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.appbrowser.json;
-
-import java.io.Writer;
-import org.json.JSONWriter;
-import org.apache.zest.library.appbrowser.Formatter;
-import org.apache.zest.library.appbrowser.FormatterFactory;
-
-public class JsonFormatterFactory
- implements FormatterFactory
-{
- private static final NullFormatter NULL_FORMATTER = new NullFormatter();
- private final JSONWriter writer;
-
- public JsonFormatterFactory(Writer destination)
- {
- writer = new JSONWriter( destination );
- }
-
- @Override
- public Formatter create( String componentType )
- {
- if( componentType.equalsIgnoreCase( "ApplicationModel" ))
- return new ApplicationModelFormatter( writer );
- if( componentType.equalsIgnoreCase( "LayerModel" ))
- return new LayerModelFormatter( writer );
- if( componentType.equalsIgnoreCase( "ModuleModel" ))
- return new ModuleModelFormatter( writer );
- if( componentType.equalsIgnoreCase( "TransientsModel" ))
- return new ArrayFormatter(writer, "transients");
- if( componentType.equalsIgnoreCase( "EntitiesModel" ))
- return new ArrayFormatter(writer, "entities");
- if( componentType.equalsIgnoreCase( "ServicesModel" ))
- return new ArrayFormatter(writer, "services");
- if( componentType.equalsIgnoreCase( "ServiceModel" ))
- return new ServiceModelFormatter
- (writer);
- if( componentType.equalsIgnoreCase( "ValuesModel" ))
- return new ArrayFormatter(writer, "values");
- if( componentType.equalsIgnoreCase( "ValueModel" ))
- return new ValueModelFormatter(writer);
- if( componentType.equalsIgnoreCase( "ValueStateModel" ))
- return NULL_FORMATTER;
- if( componentType.equalsIgnoreCase( "EntityModel" ))
- return new EntityModelFormatter( writer );
- if( componentType.equalsIgnoreCase( "CompositeMethodsModel" ))
- return new ArrayFormatter( writer, "methods" );
- if( componentType.equalsIgnoreCase( "CompositeMethodModel" ))
- return new CompositeMethodModelFormatter(writer);
- if( componentType.equalsIgnoreCase( "ObjectsModel" ))
- return new ArrayFormatter( writer, "objects" );
- if( componentType.equalsIgnoreCase( "ConstraintsModel" ))
- return new ArrayFormatter( writer, "constraints" );
- if( componentType.equalsIgnoreCase( "SideEffectsModel" ))
- return new ArrayFormatter( writer, "sideeffects" );
- if( componentType.equalsIgnoreCase( "ConcernsModel" ))
- return new ArrayFormatter( writer, "concerns" );
- if( componentType.equalsIgnoreCase( "PropertiesModel" ))
- return new ArrayFormatter( writer, "properties" );
- if( componentType.equalsIgnoreCase( "ConstructorsModel" ))
- return new ArrayFormatter( writer, "constructors" );
- if( componentType.equalsIgnoreCase( "ConstructorModel" ))
- return new ConstructorModelFormatter( writer );
- if( componentType.equalsIgnoreCase( "EntityMixinsModel" ))
- return new ArrayFormatter( writer, "mixins" );
- if( componentType.equalsIgnoreCase( "MixinsModel" ))
- return new ArrayFormatter( writer, "mixins" );
- if( componentType.equalsIgnoreCase( "MixinModel" ))
- return new MixinModelFormatter( writer );
- if( componentType.equalsIgnoreCase( "AssociationsModel" ))
- return new ArrayFormatter( writer, "associations" );
- if( componentType.equalsIgnoreCase( "ManyAssociationsModel" ))
- return new ArrayFormatter( writer, "manyassociations" );
- if( componentType.equalsIgnoreCase( "InjectedFieldsModel" ))
- return new ArrayFormatter( writer, "injectedfields" );
- if( componentType.equalsIgnoreCase( "InjectedFieldModel" ))
- return new InjectedFieldModelFormatter(writer);
- if( componentType.equalsIgnoreCase( "InjectedMethodsModel" ))
- return new ArrayFormatter( writer, "injectedmethods" );
- if( componentType.equalsIgnoreCase( "InjectedParametersModel" ))
- return new ArrayFormatter( writer, "injectedparameters" );
- if( componentType.equalsIgnoreCase( "EntityStateModel" ))
- return NULL_FORMATTER;
- if( componentType.equalsIgnoreCase( "ObjectModel" ))
- return new ObjectModelFormatter(writer);
- if( componentType.equalsIgnoreCase( "ImportedServicesModel" ))
- return NULL_FORMATTER;
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/LayerModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/LayerModelFormatter.java b/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/LayerModelFormatter.java
deleted file mode 100644
index c53f8dd..0000000
--- a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/LayerModelFormatter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.zest.api.structure.LayerDescriptor;
-import org.apache.zest.api.structure.UsedLayersDescriptor;
-
-public class LayerModelFormatter extends AbstractJsonFormatter<LayerDescriptor, Void>
-{
- public LayerModelFormatter( JSONWriter writer )
- {
- super( writer );
- }
-
- @Override
- public void enter( LayerDescriptor visited )
- throws JSONException
- {
- object();
- field( "name", visited.name() );
- array( "uses" );
- UsedLayersDescriptor usedLayersDescriptor = visited.usedLayers();
- for( LayerDescriptor used : usedLayersDescriptor.layers() )
- {
- value( used.name() );
- }
- endArray();
- array( "modules" );
- }
-
- @Override
- public void leave( LayerDescriptor visited )
- throws JSONException
- {
- endArray();
- endObject();
- }
-
- @Override
- public void visit( Void visited )
- throws JSONException
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/MixinModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/MixinModelFormatter.java b/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/MixinModelFormatter.java
deleted file mode 100644
index d9e1ce8..0000000
--- a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/MixinModelFormatter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.zest.api.mixin.MixinDescriptor;
-
-public class MixinModelFormatter extends AbstractJsonFormatter<MixinDescriptor, Void>
-{
- public MixinModelFormatter( JSONWriter writer )
- {
- super( writer );
- }
-
- @Override
- public void enter( MixinDescriptor visited )
- throws JSONException
- {
- object();
- field( "mixin", visited.mixinClass().getName() );
- }
-
- @Override
- public void leave( MixinDescriptor visited )
- throws JSONException
- {
- endObject();
- }
-
- @Override
- public void visit( Void visited )
- throws JSONException
- {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ModuleModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ModuleModelFormatter.java b/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ModuleModelFormatter.java
deleted file mode 100644
index 8adff0a..0000000
--- a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ModuleModelFormatter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.library.appbrowser.Formatter;
-
-public class ModuleModelFormatter extends AbstractJsonFormatter<ModuleDescriptor, Void>
-{
-
- public ModuleModelFormatter( JSONWriter writer )
- {
- super( writer );
- }
-
- @Override
- public void enter( ModuleDescriptor visited )
- throws JSONException
- {
- object();
- field( "name", visited.name() );
- }
-
- @Override
- public void leave( ModuleDescriptor visited )
- throws JSONException
- {
- endObject();
- }
-
- @Override
- public void visit( Void visited )
- throws JSONException
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/NullFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/NullFormatter.java b/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/NullFormatter.java
deleted file mode 100644
index 3f851de..0000000
--- a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/NullFormatter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.zest.library.appbrowser.Formatter;
-
-public class NullFormatter
- implements Formatter<Object, Object>
-{
- @Override
- public void enter( Object visited )
- throws JSONException
- {
-
- }
-
- @Override
- public void leave( Object visited )
- throws JSONException
- {
-
- }
-
- @Override
- public void visit( Object visited )
- throws JSONException
- {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ObjectModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ObjectModelFormatter.java b/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ObjectModelFormatter.java
deleted file mode 100644
index e259c56..0000000
--- a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ObjectModelFormatter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.zest.api.object.ObjectDescriptor;
-
-public class ObjectModelFormatter extends AbstractJsonFormatter<ObjectDescriptor, Void>
-{
- public ObjectModelFormatter( JSONWriter writer )
- {
- super(writer);
- }
-
- @Override
- public void enter( ObjectDescriptor visited )
- throws JSONException
- {
- object();
- field( "visibility", visited.visibility().toString());
- }
-
- @Override
- public void leave( ObjectDescriptor visited )
- throws JSONException
- {
- endObject();
- }
-
- @Override
- public void visit( Void visited )
- throws JSONException
- {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ServiceModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ServiceModelFormatter.java b/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ServiceModelFormatter.java
deleted file mode 100644
index 7ac39ef..0000000
--- a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ServiceModelFormatter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.zest.api.service.ServiceDescriptor;
-
-public class ServiceModelFormatter extends AbstractJsonFormatter<ServiceDescriptor, Void>
-{
- public ServiceModelFormatter( JSONWriter writer )
- {
- super( writer );
- }
-
- @Override
- public void enter( ServiceDescriptor visited )
- throws JSONException
- {
- object();
- field( "identity", visited.identity() );
- field( "type", visited.primaryType().getName() );
- field( "visibility", visited.visibility().toString() );
- Class<Object> config = visited.configurationType();
- if( config != null )
- {
- field( "configuration", config.getName() );
- }
- field( "instantiateOnStartup", visited.isInstantiateOnStartup() );
- }
-
- @Override
- public void leave( ServiceDescriptor visited )
- throws JSONException
- {
- endObject();
- }
-
- @Override
- public void visit( Void visited )
- throws JSONException
- {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ValueModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ValueModelFormatter.java b/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ValueModelFormatter.java
deleted file mode 100644
index 411b82b..0000000
--- a/libraries/appbrowser/src/main/java/org/qi4j/library/appbrowser/json/ValueModelFormatter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.zest.api.value.ValueDescriptor;
-import org.apache.zest.library.appbrowser.Formatter;
-
-public class ValueModelFormatter extends AbstractJsonFormatter<ValueDescriptor,Void>
-{
- public ValueModelFormatter( JSONWriter writer )
- {
- super(writer);
- }
-
- @Override
- public void enter( ValueDescriptor visited )
- throws JSONException
- {
- object();
- field( "type", visited.valueType().mainType().getName() );
- field( "visibility", visited.visibility().toString() );
- }
-
- @Override
- public void leave( ValueDescriptor visited )
- throws JSONException
- {
- endObject();
- }
-
- @Override
- public void visit( Void visited )
- throws JSONException
- {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java b/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java
new file mode 100644
index 0000000..9d8d82e
--- /dev/null
+++ b/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.zest.library.appbrowser;
+
+import java.io.StringWriter;
+import java.io.Writer;
+import org.joda.time.DateTime;
+import org.junit.Test;
+import org.apache.zest.api.association.Association;
+import org.apache.zest.api.association.ManyAssociation;
+import org.apache.zest.api.common.Optional;
+import org.apache.zest.api.concern.ConcernOf;
+import org.apache.zest.api.concern.Concerns;
+import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.injection.scope.Service;
+import org.apache.zest.api.injection.scope.This;
+import org.apache.zest.api.mixin.Mixins;
+import org.apache.zest.api.property.Property;
+import org.apache.zest.api.value.ValueSerialization;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.entitystore.memory.MemoryEntityStoreService;
+import org.apache.zest.library.appbrowser.json.JsonFormatterFactory;
+import org.apache.zest.test.AbstractQi4jTest;
+
+public class AppBrowserTest extends AbstractQi4jTest
+{
+ @Override
+ public void assemble( ModuleAssembly module )
+ throws AssemblyException
+ {
+ module.entities( Person.class );
+ module.values( Age.class );
+ module.services( MemoryEntityStoreService.class );
+ module.importedServices( ValueSerialization.class );
+ }
+
+ @Test
+ public void testBrowser()
+ throws Exception
+ {
+ Writer output = new StringWriter();
+ FormatterFactory jsonFactory = new JsonFormatterFactory( output );
+ Browser browser = new Browser( applicationModel, jsonFactory );
+ browser.toJson();
+ }
+
+ @Mixins( Person.Mixin.class )
+ @Concerns( Person.AgeLimitConcern.class )
+ public interface Person extends Identity
+ {
+ String name();
+
+ int yearsOld();
+
+ interface State
+ {
+ Property<String> name();
+
+ Property<Age> age();
+
+ @Optional
+ Association<Person> spouse();
+
+ ManyAssociation<Person> children();
+ }
+
+ abstract class Mixin
+ implements Person
+ {
+
+ @This
+ private State state;
+
+ @Override
+ public String name()
+ {
+ return state.name().get();
+ }
+
+ @Override
+ public int yearsOld()
+ {
+ return state.age().get().numberOfYearsOld();
+ }
+ }
+
+ abstract class AgeLimitConcern extends ConcernOf<Person>
+ implements Person
+ {
+ @This
+ private Person me;
+ @Service
+ private AgeCheckService ageCheck;
+
+ @Override
+ public int yearsOld()
+ {
+ int years = next.yearsOld();
+ if( ageCheck.checkAge( identity(), years ))
+ throw new DeathException( "Person is dead.");
+ return 0;
+ }
+ }
+ }
+
+ @Mixins( Age.AgeMixin.class )
+ public interface Age
+ {
+ Property<Integer> birthYear();
+
+ int numberOfYearsOld();
+
+ abstract class AgeMixin
+ implements Age
+ {
+
+ @Override
+ public int numberOfYearsOld()
+ {
+ return DateTime.now().getYearOfEra() - birthYear().get();
+ }
+ }
+ }
+
+ public static class DeathException extends RuntimeException
+ {
+ public DeathException( String message )
+ {
+ super( message );
+ }
+ }
+
+ @Mixins(AgeCheckService.AgeCheckerMixin.class)
+ public interface AgeCheckService
+ {
+
+ boolean checkAge( Property<String> identity, int years );
+
+ class AgeCheckerMixin
+ implements AgeCheckService
+ {
+
+ @Override
+ public boolean checkAge( Property<String> identity, int years )
+ {
+ double probabiility = years/(Math.random()*120+1);
+ return probabiility < 0.9;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/appbrowser/src/test/java/org/qi4j/library/appbrowser/AppBrowserTest.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/test/java/org/qi4j/library/appbrowser/AppBrowserTest.java b/libraries/appbrowser/src/test/java/org/qi4j/library/appbrowser/AppBrowserTest.java
deleted file mode 100644
index 9d8d82e..0000000
--- a/libraries/appbrowser/src/test/java/org/qi4j/library/appbrowser/AppBrowserTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.zest.library.appbrowser;
-
-import java.io.StringWriter;
-import java.io.Writer;
-import org.joda.time.DateTime;
-import org.junit.Test;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.concern.ConcernOf;
-import org.apache.zest.api.concern.Concerns;
-import org.apache.zest.api.entity.Identity;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueSerialization;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.entitystore.memory.MemoryEntityStoreService;
-import org.apache.zest.library.appbrowser.json.JsonFormatterFactory;
-import org.apache.zest.test.AbstractQi4jTest;
-
-public class AppBrowserTest extends AbstractQi4jTest
-{
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.entities( Person.class );
- module.values( Age.class );
- module.services( MemoryEntityStoreService.class );
- module.importedServices( ValueSerialization.class );
- }
-
- @Test
- public void testBrowser()
- throws Exception
- {
- Writer output = new StringWriter();
- FormatterFactory jsonFactory = new JsonFormatterFactory( output );
- Browser browser = new Browser( applicationModel, jsonFactory );
- browser.toJson();
- }
-
- @Mixins( Person.Mixin.class )
- @Concerns( Person.AgeLimitConcern.class )
- public interface Person extends Identity
- {
- String name();
-
- int yearsOld();
-
- interface State
- {
- Property<String> name();
-
- Property<Age> age();
-
- @Optional
- Association<Person> spouse();
-
- ManyAssociation<Person> children();
- }
-
- abstract class Mixin
- implements Person
- {
-
- @This
- private State state;
-
- @Override
- public String name()
- {
- return state.name().get();
- }
-
- @Override
- public int yearsOld()
- {
- return state.age().get().numberOfYearsOld();
- }
- }
-
- abstract class AgeLimitConcern extends ConcernOf<Person>
- implements Person
- {
- @This
- private Person me;
- @Service
- private AgeCheckService ageCheck;
-
- @Override
- public int yearsOld()
- {
- int years = next.yearsOld();
- if( ageCheck.checkAge( identity(), years ))
- throw new DeathException( "Person is dead.");
- return 0;
- }
- }
- }
-
- @Mixins( Age.AgeMixin.class )
- public interface Age
- {
- Property<Integer> birthYear();
-
- int numberOfYearsOld();
-
- abstract class AgeMixin
- implements Age
- {
-
- @Override
- public int numberOfYearsOld()
- {
- return DateTime.now().getYearOfEra() - birthYear().get();
- }
- }
- }
-
- public static class DeathException extends RuntimeException
- {
- public DeathException( String message )
- {
- super( message );
- }
- }
-
- @Mixins(AgeCheckService.AgeCheckerMixin.class)
- public interface AgeCheckService
- {
-
- boolean checkAge( Property<String> identity, int years );
-
- class AgeCheckerMixin
- implements AgeCheckService
- {
-
- @Override
- public boolean checkAge( Property<String> identity, int years )
- {
- double probabiility = years/(Math.random()*120+1);
- return probabiility < 0.9;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/circuitbreaker/src/docs/circuitbreaker.txt
----------------------------------------------------------------------
diff --git a/libraries/circuitbreaker/src/docs/circuitbreaker.txt b/libraries/circuitbreaker/src/docs/circuitbreaker.txt
index 6706bd5..21aada2 100644
--- a/libraries/circuitbreaker/src/docs/circuitbreaker.txt
+++ b/libraries/circuitbreaker/src/docs/circuitbreaker.txt
@@ -70,7 +70,7 @@ Here is a code snippet that demonstrate how to create a CircuitBreaker and how i
[snippet,java]
----
-source=libraries/circuitbreaker/src/test/java/org/qi4j/library/circuitbreaker/CircuitBreakerTest.java
+source=libraries/circuitbreaker/src/test/java/org/apache/zest/library/circuitbreaker/CircuitBreakerTest.java
tag=direct
----
@@ -88,7 +88,7 @@ Here is how to declare such a Service:
[snippet,java]
----
-source=libraries/circuitbreaker/src/test/java/org/qi4j/library/circuitbreaker/BreaksCircuitOnThrowableTest.java
+source=libraries/circuitbreaker/src/test/java/org/apache/zest/library/circuitbreaker/BreaksCircuitOnThrowableTest.java
tag=service
----
@@ -106,7 +106,7 @@ Here is how it goes:
[snippet,java]
----
-source=libraries/circuitbreaker/src/test/java/org/qi4j/library/circuitbreaker/jmx/CircuitBreakerManagementSample.java
+source=libraries/circuitbreaker/src/test/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerManagementSample.java
tag=jmx
----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/constraints/src/docs/constraints.txt
----------------------------------------------------------------------
diff --git a/libraries/constraints/src/docs/constraints.txt b/libraries/constraints/src/docs/constraints.txt
index c358f75..8baaf0c 100644
--- a/libraries/constraints/src/docs/constraints.txt
+++ b/libraries/constraints/src/docs/constraints.txt
@@ -41,7 +41,7 @@ Here are some examples:
[snippet,java]
----
-source=libraries/constraints/src/test/java/org/qi4j/library/constraints/TestCaseComposite.java
+source=libraries/constraints/src/test/java/org/apache/zest/library/constraints/TestCaseComposite.java
tag=constraints
----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/conversion/src/docs/conversion.txt
----------------------------------------------------------------------
diff --git a/libraries/conversion/src/docs/conversion.txt b/libraries/conversion/src/docs/conversion.txt
index 015f3e6..a8eb3cf 100644
--- a/libraries/conversion/src/docs/conversion.txt
+++ b/libraries/conversion/src/docs/conversion.txt
@@ -45,7 +45,7 @@ To convert Entities to Values, use the EntityToValueService. It is easily assemb
[snippet,java]
----
-source=libraries/conversion/src/test/java/org/qi4j/library/conversion/values/EntityToValueTest.java
+source=libraries/conversion/src/test/java/org/apache/zest/library/conversion/values/EntityToValueTest.java
tag=assembly
----
@@ -53,7 +53,7 @@ Let's say we have an interface defining state:
[snippet,java]
----
-source=libraries/conversion/src/test/java/org/qi4j/library/conversion/values/TestModel.java
+source=libraries/conversion/src/test/java/org/apache/zest/library/conversion/values/TestModel.java
tag=state
----
@@ -61,7 +61,7 @@ An EntityComposite using the state as a Private Mixin:
[snippet,java]
----
-source=libraries/conversion/src/test/java/org/qi4j/library/conversion/values/TestModel.java
+source=libraries/conversion/src/test/java/org/apache/zest/library/conversion/values/TestModel.java
tag=entity
----
@@ -69,7 +69,7 @@ And a ValueComposite extending this very same state;
[snippet,java]
----
-source=libraries/conversion/src/test/java/org/qi4j/library/conversion/values/TestModel.java
+source=libraries/conversion/src/test/java/org/apache/zest/library/conversion/values/TestModel.java
tag=value
----
@@ -77,7 +77,7 @@ Here is how to convert an EntityComposite to a ValueComposite:
[snippet,java]
----
-source=libraries/conversion/src/test/java/org/qi4j/library/conversion/values/EntityToValueTest.java
+source=libraries/conversion/src/test/java/org/apache/zest/library/conversion/values/EntityToValueTest.java
tag=conversion
----
@@ -89,7 +89,7 @@ It is easy assembled:
[snippet,java]
----
-source=libraries/conversion/src/test/java/org/qi4j/library/conversion/values/ValueToEntityTest.java
+source=libraries/conversion/src/test/java/org/apache/zest/library/conversion/values/ValueToEntityTest.java
tag=assembly
----
@@ -99,7 +99,7 @@ Here is how to create an EntityComposite from a ValueComposite:
[snippet,java]
----
-source=libraries/conversion/src/test/java/org/qi4j/library/conversion/values/ValueToEntityTest.java
+source=libraries/conversion/src/test/java/org/apache/zest/library/conversion/values/ValueToEntityTest.java
tag=creation
----
@@ -107,7 +107,7 @@ Here is how to update an EntityComposite from a ValueComposite:
[snippet,java]
----
-source=libraries/conversion/src/test/java/org/qi4j/library/conversion/values/ValueToEntityTest.java
+source=libraries/conversion/src/test/java/org/apache/zest/library/conversion/values/ValueToEntityTest.java
tag=update
----
@@ -123,7 +123,7 @@ Here is an example:
[snippet,java]
----
-source=libraries/conversion/src/test/java/org/qi4j/library/conversion/values/TestModel.java
+source=libraries/conversion/src/test/java/org/apache/zest/library/conversion/values/TestModel.java
tag=unqualified
----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/eventsourcing/src/docs/eventsourcing.txt
----------------------------------------------------------------------
diff --git a/libraries/eventsourcing/src/docs/eventsourcing.txt b/libraries/eventsourcing/src/docs/eventsourcing.txt
index 6936ea5..882eee1 100644
--- a/libraries/eventsourcing/src/docs/eventsourcing.txt
+++ b/libraries/eventsourcing/src/docs/eventsourcing.txt
@@ -72,14 +72,14 @@ Assembly is done as follows:
[snippet,java]
----
-source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
+source=libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/application/ApplicationEventTest.java
tag=assemblyAE
----
Configure application events store:
[snippet,java]
----
-source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
+source=libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/application/ApplicationEventTest.java
tag=storeAE
----
@@ -88,14 +88,14 @@ First parameter is `null` on "normal" execution.
If it is not `null`, then the method call is a replay of previously created events.
[snippet,java]
----
-source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
+source=libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/application/ApplicationEventTest.java
tag=methodAE
----
To enable execution capturing, you have to configure composite with concern:
[snippet,java]
----
-source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java
+source=libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/application/ApplicationEventTest.java
tag=concernAE
----
@@ -105,7 +105,7 @@ Assembly:
[snippet,java]
----
-source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
+source=libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/DomainEventTest.java
tag=assemblyDE
----
@@ -113,7 +113,7 @@ Configure domain events store:
[snippet,java]
----
-source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
+source=libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/DomainEventTest.java
tag=storeDE
----
@@ -122,7 +122,7 @@ Event methods may only change state.
They may not fail or thrown exceptions:
[snippet,java]
----
-source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
+source=libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/DomainEventTest.java
tag=methodDE
----
@@ -130,6 +130,6 @@ To enable method execution capturing, you have to configure entity with concern:
[snippet,java]
----
-source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java
+source=libraries/eventsourcing/src/test/java/org/apache/zest/library/eventsourcing/domain/DomainEventTest.java
tag=concernDE
----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/fileconfig/src/docs/fileconfig.txt
----------------------------------------------------------------------
diff --git a/libraries/fileconfig/src/docs/fileconfig.txt b/libraries/fileconfig/src/docs/fileconfig.txt
index ac973e6..7520005 100644
--- a/libraries/fileconfig/src/docs/fileconfig.txt
+++ b/libraries/fileconfig/src/docs/fileconfig.txt
@@ -35,7 +35,7 @@ include::../../build/docs/buildinfo/artifact.txt[]
[snippet,java]
----
-source=libraries/fileconfig/src/main/java/org/qi4j/library/fileconfig/FileConfiguration.java
+source=libraries/fileconfig/src/main/java/org/apache/zest/library/fileconfig/FileConfiguration.java
tag=fileconfig
----
@@ -43,13 +43,13 @@ To use it you simply need to use the FileConfigurationAssembler in your applicat
[snippet,java]
----
-source=libraries/fileconfig/src/test/java/org/qi4j/library/fileconfig/FileConfigurationTest.java
+source=libraries/fileconfig/src/test/java/org/apache/zest/library/fileconfig/FileConfigurationTest.java
tag=simple
----
These will default to the platform settings, but can be overridden manually, either one-by-one or as a whole.
-You can override defaults by adding org.qi4j.library.fileconfig.FileConfiguration_OS.properties files to your
+You can override defaults by adding org.apache.zest.library.fileconfig.FileConfiguration_OS.properties files to your
classpath where OS is one of win, mac or unix.
You can also override all properties definitions at assembly time by setting a FileConfigurationOverride object
@@ -57,7 +57,7 @@ as meta info of this service:
[snippet,java]
----
-source=libraries/fileconfig/src/test/java/org/qi4j/library/fileconfig/FileConfigurationTest.java
+source=libraries/fileconfig/src/test/java/org/apache/zest/library/fileconfig/FileConfigurationTest.java
tag=override
----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/http/src/docs/http.txt
----------------------------------------------------------------------
diff --git a/libraries/http/src/docs/http.txt b/libraries/http/src/docs/http.txt
index 7e4b904..1479e69 100644
--- a/libraries/http/src/docs/http.txt
+++ b/libraries/http/src/docs/http.txt
@@ -39,7 +39,7 @@ EventListeners in HttpService are assembled as Services, so one have to declare
[snippet,java]
----
-source=libraries/http/src/test/java/org/qi4j/library/http/FooServletContextListenerService.java
+source=libraries/http/src/test/java/org/apache/zest/library/http/FooServletContextListenerService.java
tag=context-listener
----
@@ -49,7 +49,7 @@ Servlets in HttpService are assembled as Services, so one have to declare a Serv
[snippet,java]
----
-source=libraries/http/src/test/java/org/qi4j/library/http/HelloWorldServletService.java
+source=libraries/http/src/test/java/org/apache/zest/library/http/HelloWorldServletService.java
tag=servletservice
----
@@ -59,7 +59,7 @@ It's the same for Filters. As an example here is the bundled UnitOfWorkFilterSer
[snippet,java]
----
-source=libraries/http/src/main/java/org/qi4j/library/http/UnitOfWorkFilterService.java
+source=libraries/http/src/main/java/org/apache/zest/library/http/UnitOfWorkFilterService.java
tag=filterservice
----
@@ -71,7 +71,7 @@ The HTTP library provide a JettyServiceAssembler and a fluent API to easily asse
[snippet,java]
----
-source=libraries/http/src/test/java/org/qi4j/library/http/JettyServiceTest.java
+source=libraries/http/src/test/java/org/apache/zest/library/http/JettyServiceTest.java
tag=assembly
----
@@ -84,7 +84,7 @@ Module for the sake of clarity:
[snippet,java]
----
-source=libraries/http/src/test/java/org/qi4j/library/http/JettyJMXStatisticsTest.java
+source=libraries/http/src/test/java/org/apache/zest/library/http/JettyJMXStatisticsTest.java
tag=jmx
----
@@ -93,7 +93,7 @@ tag=jmx
Underlying Jetty engine configuration is exposed as a Zest™ Service Configuration.
The only one that is mandatory is the port.
-See org.qi4j.library.http.JettyConfiguration for a reference of all available
+See org.apache.zest.library.http.JettyConfiguration for a reference of all available
configuration properties.
== Secure Jetty Service ==
@@ -106,7 +106,7 @@ Simply change from JettyServiceAssembler to SecureJettyServiceAssembler:
[snippet,java]
----
-source=libraries/http/src/test/java/org/qi4j/library/http/SecureJettyServiceTest.java
+source=libraries/http/src/test/java/org/apache/zest/library/http/SecureJettyServiceTest.java
tag=assemblyssl
----
@@ -123,11 +123,11 @@ SecureJettyConfiguration default during assembly:
[snippet,java]
----
-source=libraries/http/src/test/java/org/qi4j/library/http/MutualSecureJettyServiceTest.java
+source=libraries/http/src/test/java/org/apache/zest/library/http/MutualSecureJettyServiceTest.java
tag=config
----
-See org.qi4j.library.http.SecureJettyConfiguration for a reference of all available
+See org.apache.zest.library.http.SecureJettyConfiguration for a reference of all available
configuration properties.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/invocation-cache/src/docs/invocation-cache.txt
----------------------------------------------------------------------
diff --git a/libraries/invocation-cache/src/docs/invocation-cache.txt b/libraries/invocation-cache/src/docs/invocation-cache.txt
index e613c6b..c46581a 100644
--- a/libraries/invocation-cache/src/docs/invocation-cache.txt
+++ b/libraries/invocation-cache/src/docs/invocation-cache.txt
@@ -63,7 +63,7 @@ Let's say that we have some service that is very expensive to call.
[snippet,java]
----
-source=libraries/invocation-cache/src/test/java/org/qi4j/library/invocationcache/DocumentationSupport.java
+source=libraries/invocation-cache/src/test/java/org/apache/zest/library/invocationcache/DocumentationSupport.java
tag=composite
----
@@ -73,7 +73,7 @@ provided.
[snippet,java]
----
-source=libraries/invocation-cache/src/test/java/org/qi4j/library/invocationcache/DocumentationSupport.java
+source=libraries/invocation-cache/src/test/java/org/apache/zest/library/invocationcache/DocumentationSupport.java
tag=assembly
----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/jmx/src/docs/jmx.txt
----------------------------------------------------------------------
diff --git a/libraries/jmx/src/docs/jmx.txt b/libraries/jmx/src/docs/jmx.txt
index b8421a4..5c17265 100644
--- a/libraries/jmx/src/docs/jmx.txt
+++ b/libraries/jmx/src/docs/jmx.txt
@@ -35,7 +35,7 @@ include::../../build/docs/buildinfo/artifact.txt[]
[snippet,java]
----
-source=libraries/jmx/src/test/java/org/qi4j/library/jmx/JMXTest.java
+source=libraries/jmx/src/test/java/org/apache/zest/library/jmx/JMXTest.java
tag=assembly
----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-groovy/src/docs/lang-groovy.txt
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/docs/lang-groovy.txt b/libraries/lang-groovy/src/docs/lang-groovy.txt
index e5a006a..9b090ed 100644
--- a/libraries/lang-groovy/src/docs/lang-groovy.txt
+++ b/libraries/lang-groovy/src/docs/lang-groovy.txt
@@ -38,7 +38,7 @@ All examples below are based on this type:
[snippet,java]
----
-source=libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeaker.java
+source=libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeaker.java
tag=speaker
----
@@ -52,7 +52,7 @@ Having this Groovy class compiled ;
.HelloSpeakerMixin.groovy
[snippet,groovy]
----
-source=libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerMixin.groovy
+source=libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerMixin.groovy
tag=direct
----
@@ -60,7 +60,7 @@ assemble it directly:
[snippet,java]
----
-source=libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerTest.java
+source=libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
tag=direct
----
@@ -72,7 +72,7 @@ Declare a Groovy class in a classpath resource file located in the same package
.HelloSpeaker.groovy
[snippet,groovy]
----
-source=libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.groovy
+source=libraries/lang-groovy/src/test/resources/org/apache/zest/lang/groovy/HelloSpeaker.groovy
tag=script
----
@@ -80,7 +80,7 @@ Then assemble it with the +GroovyMixin+:
[snippet,java]
----
-source=libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerTest.java
+source=libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
tag=script
----
@@ -94,7 +94,7 @@ Implement single composites methods, each in a classpath resource file located i
.HelloSpeaker.sayHello.groovy
[snippet,groovy]
----
-source=libraries/lang-groovy/src/test/resources/org/qi4j/lang/groovy/HelloSpeaker.sayHello.groovy
+source=libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/HelloSpeaker.sayHello.groovy
tag=script
----
@@ -102,7 +102,7 @@ Then assemble it with the +GroovyMixin+:
[snippet,java]
----
-source=libraries/lang-groovy/src/test/groovy/org/qi4j/lang/groovy/HelloSpeakerTest.java
+source=libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
tag=script
----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerMixin.groovy
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerMixin.groovy b/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerMixin.groovy
index b360211..1e85ecb 100644
--- a/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerMixin.groovy
+++ b/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerMixin.groovy
@@ -18,7 +18,7 @@
package org.apache.zest.library.groovy;
// START SNIPPET: direct
-public class HelloSpeakerMixin implements HelloSpeaker {
+public class HelloSpeakerMixin implements org.apache.zest.library.groovy.support.HelloSpeaker {
public String sayHello( String name ) {
"Hello $name!"
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java b/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
index 6b43495..defe29a 100644
--- a/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
+++ b/libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
@@ -29,13 +29,13 @@ public class HelloSpeakerTest extends AbstractQi4jTest
public void assemble( ModuleAssembly module )
throws AssemblyException
{
- module.transients( HelloSpeaker.class ).withMixins( GroovyMixin.class );
+ module.transients( org.apache.zest.library.groovy.support.HelloSpeaker.class ).withMixins( GroovyMixin.class );
}
@Test
public void testHello()
{
- HelloSpeaker speaker = module.newTransient( HelloSpeaker.class );
+ org.apache.zest.library.groovy.support.HelloSpeaker speaker = module.newTransient( org.apache.zest.library.groovy.support.HelloSpeaker.class );
Assert.assertEquals( "Hello World!", speaker.sayHello( "World" ) );
}
@@ -50,10 +50,10 @@ public class HelloSpeakerTest extends AbstractQi4jTest
public void assemble( ModuleAssembly assembly )
throws AssemblyException
{
- assembly.transients( HelloSpeaker.class ).withMixins( GroovyMixin.class );
+ assembly.transients( org.apache.zest.library.groovy.support.HelloSpeaker.class ).withMixins( GroovyMixin.class );
}
};
- HelloSpeaker speaker = assembler.module().newTransient( HelloSpeaker.class );
+ org.apache.zest.library.groovy.support.HelloSpeaker speaker = assembler.module().newTransient( org.apache.zest.library.groovy.support.HelloSpeaker.class );
Assert.assertEquals( "Hello World!", speaker.sayHello( "World" ) );
// END SNIPPET: script
}
@@ -69,10 +69,10 @@ public class HelloSpeakerTest extends AbstractQi4jTest
public void assemble( ModuleAssembly module )
throws AssemblyException
{
- module.transients( HelloSpeaker.class ).withMixins( HelloSpeakerMixin.class );
+ module.transients( org.apache.zest.library.groovy.support.HelloSpeaker.class ).withMixins( HelloSpeakerMixin.class );
}
};
- HelloSpeaker speaker = assembler.module().newTransient( HelloSpeaker.class );
+ org.apache.zest.library.groovy.support.HelloSpeaker speaker = assembler.module().newTransient( org.apache.zest.library.groovy.support.HelloSpeaker.class );
Assert.assertEquals( "Hello World!", speaker.sayHello( "World" ) );
// END SNIPPET: direct
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/HelloSpeaker.groovy
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/HelloSpeaker.groovy b/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/HelloSpeaker.groovy
deleted file mode 100644
index 00cc5a3..0000000
--- a/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/HelloSpeaker.groovy
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.apache.zest.library.groovy
-/*
- * Copyright (c) 2015 the original author or authors
- *
- * 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.
- */
-// START SNIPPET: script
-class HelloSpeaker {
- def This
- def sayHello( name ) {
- "Hello $name!".toString()
- }
-}
-// END SNIPPET: script
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/Mixin1.groovy
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/Mixin1.groovy b/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/Mixin1.groovy
deleted file mode 100644
index f7ca097..0000000
--- a/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/Mixin1.groovy
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.apache.zest.library.groovy
-/*
- * Copyright 2007 Rickard Öberg
- * 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.
-*/
-public class Mixin1
-{
- def This
- def counter = 0
-
- public String do1()
- {
- counter = counter + 1
- return "do1() in Groovy:" + counter
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/support/HelloSpeaker.groovy
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/support/HelloSpeaker.groovy b/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/support/HelloSpeaker.groovy
new file mode 100644
index 0000000..69e1bd1
--- /dev/null
+++ b/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/support/HelloSpeaker.groovy
@@ -0,0 +1,26 @@
+package org.apache.zest.library.groovy.support
+/*
+ * Copyright (c) 2015 the original author or authors
+ *
+ * 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.
+ */
+// START SNIPPET: script
+class HelloSpeaker {
+ def This
+ def sayHello( name ) {
+ "Hello $name!".toString()
+ }
+}
+// END SNIPPET: script
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/support/Mixin1.groovy
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/support/Mixin1.groovy b/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/support/Mixin1.groovy
new file mode 100644
index 0000000..3e985d9
--- /dev/null
+++ b/libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/support/Mixin1.groovy
@@ -0,0 +1,23 @@
+package org.apache.zest.library.groovy.support
+/*
+ * Copyright 2007 Rickard Öberg
+ * 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.
+*/
+public class Mixin1
+{
+ def This
+ def counter = 0
+
+ public String do1()
+ {
+ counter = counter + 1
+ return "do1() in Groovy:" + counter
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-javascript/src/docs/lang-javascript.txt
----------------------------------------------------------------------
diff --git a/libraries/lang-javascript/src/docs/lang-javascript.txt b/libraries/lang-javascript/src/docs/lang-javascript.txt
index ddd52e2..542b64c 100644
--- a/libraries/lang-javascript/src/docs/lang-javascript.txt
+++ b/libraries/lang-javascript/src/docs/lang-javascript.txt
@@ -37,7 +37,7 @@ includes the package, and has "." replaced with "/".
Example:
- org/qi4j/samples/hello/domain/HelloWorldSpeaker.say.js
+ org/apache/zest/samples/hello/domain/HelloWorldSpeaker.say.js
That means that the HelloWorldSpeaker.say.js file may be co-located with the
class files in the same package. It is currently not supported to place the
@@ -50,6 +50,6 @@ interface or at assembly time.
[snippet,java]
----
-source=libraries/lang-javascript/src/test/java/org/qi4j/lang/javascript/HelloSpeaker.java
+source=libraries/lang-javascript/src/test/java/org/apache/zest/library/javascript/HelloSpeaker.java
tag=mixin
----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-jruby/README.txt
----------------------------------------------------------------------
diff --git a/libraries/lang-jruby/README.txt b/libraries/lang-jruby/README.txt
index 3b2dcf5..fb53980 100644
--- a/libraries/lang-jruby/README.txt
+++ b/libraries/lang-jruby/README.txt
@@ -2,7 +2,7 @@
JRuby is licensed under LGPL, and Apache Software Foundation
doesn't allow the use of LGPL in Apache projects.
-Therefor, Apache Zest� had to drop this library component, but
+Therefor, Apache Zest™ had to drop this library component, but
it is still available for separate download at
https://github.com/Qi4j/qi4j-sdk
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/docs/lang-scala.txt
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/docs/lang-scala.txt b/libraries/lang-scala/src/docs/lang-scala.txt
index c4b3a8f..725d4da 100644
--- a/libraries/lang-scala/src/docs/lang-scala.txt
+++ b/libraries/lang-scala/src/docs/lang-scala.txt
@@ -37,28 +37,28 @@ The Scala Support Library is a Generic mixin class that implements Composites b
Example mixin declaration:
[snippet,scala]
----
-source=libraries/lang-scala/src/test/scala/org/qi4j/sample/scala/HelloWorldMixin2.scala
+source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin2.scala
tag=mixin
----
Example composite declaration:
[snippet,scala]
----
-source=libraries/lang-scala/src/test/scala/org/qi4j/sample/scala/HelloWorldComposite.scala
+source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite.scala
tag=composite
----
Example typed concern:
[snippet,scala]
----
-source=libraries/lang-scala/src/test/scala/org/qi4j/sample/scala/HelloThereConcern.scala
+source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloThereConcern.scala
tag=typedconcern
----
Example generic concern with filter:
[snippet,scala]
----
-source=libraries/lang-scala/src/test/scala/org/qi4j/sample/scala/ExclamationGenericConcern.scala
+source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/ExclamationGenericConcern.scala
tag=genericconcern
----
@@ -66,7 +66,7 @@ And the assembly code.
Note that the `ScalaTraitMixin` must be added.
[snippet,java]
----
-source=libraries/lang-scala/src/test/scala/org/qi4j/sample/scala/HelloWorldCompositeTest.java
+source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
tag=composite
----
@@ -81,7 +81,7 @@ Only commands are called by client code.
[snippet,scala]
----
-source=libraries/lang-scala/src/test/scala/org/qi4j/sample/scala/TestEntity.scala
+source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestEntity.scala
tag=entity
----
@@ -93,7 +93,7 @@ And the corresponding assembly code:
[snippet,java]
----
-source=libraries/lang-scala/src/test/scala/org/qi4j/sample/scala/HelloWorldCompositeTest.java
+source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
tag=entity
----
@@ -104,7 +104,7 @@ The following example is a pretty simple service written as a Scala trait:
[snippet,scala]
----
-source=libraries/lang-scala/src/test/scala/org/qi4j/sample/scala/TestService.scala
+source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestService.scala
tag=service
----
@@ -112,6 +112,6 @@ And the corresponding assembly code:
[snippet,java]
----
-source=libraries/lang-scala/src/test/scala/org/qi4j/sample/scala/HelloWorldCompositeTest.java
+source=libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
tag=service
----
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/ExclamationGenericConcern.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/ExclamationGenericConcern.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/ExclamationGenericConcern.scala
new file mode 100644
index 0000000..9328122
--- /dev/null
+++ b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/ExclamationGenericConcern.scala
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011 Rickard Öberg
+ * 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.apache.zest.library.scala
+
+import java.lang.reflect.Method
+import org.apache.zest.api.concern.GenericConcern
+import org.apache.zest.api.common.{AppliesToFilter, AppliesTo}
+
+/**
+ * Add an exclamation mark to the returned string
+ */
+// START SNIPPET: genericconcern
+@AppliesTo(Array(classOf[ StringFilter ]))
+class ExclamationGenericConcern
+ extends GenericConcern
+{
+ def invoke(composite: AnyRef, method: Method, args: Array[ AnyRef ] ) = next.invoke(composite, method, args) + "!"
+}
+
+class StringFilter
+ extends AppliesToFilter
+{
+ def appliesTo(method: Method, mixin: Class[ _ ], compositeType: Class[ _ ], fragmentClass: Class[ _ ] ) = method
+ .getReturnType
+ .equals(classOf[ String ])
+}
+// END SNIPPET: genericconcern
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloThereConcern.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloThereConcern.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloThereConcern.scala
new file mode 100644
index 0000000..81c4663
--- /dev/null
+++ b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloThereConcern.scala
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2011 Rickard Öberg
+ * 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.apache.zest.library.scala
+
+import org.apache.zest.api.concern.ConcernOf
+
+// START SNIPPET: typedconcern
+class HelloThereConcern
+ extends ConcernOf[ HelloWorldMixin2 ] with HelloWorldMixin2
+{
+ override def sayHello(name: String ) = next.sayHello("there " + name)
+}
+// END SNIPPET: typedconcern
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite.scala
new file mode 100644
index 0000000..a8ac925
--- /dev/null
+++ b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite.scala
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2011 Rickard Öberg
+ * 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.apache.zest.library.scala
+
+import org.apache.zest.api.composite.TransientComposite
+import org.apache.zest.api.concern.Concerns
+
+// START SNIPPET: composite
+@Concerns(Array(classOf[ HelloThereConcern ]))
+trait HelloWorldComposite
+ extends TransientComposite with HelloWorldMixin with HelloWorldMixin2
+// END SNIPPET: composite
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite2.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite2.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite2.scala
new file mode 100644
index 0000000..9a7c71c
--- /dev/null
+++ b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldComposite2.scala
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2011 Rickard Öberg
+ * 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.apache.zest.library.scala
+
+trait HelloWorldComposite2
+ extends HelloWorldComposite with HelloWorldMixin3
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
new file mode 100644
index 0000000..a01b870
--- /dev/null
+++ b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldCompositeTest.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2011 Rickard Öberg
+ * 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.apache.zest.library.scala;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.apache.zest.api.constraint.ConstraintViolationException;
+import org.apache.zest.api.unitofwork.UnitOfWork;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.bootstrap.SingletonAssembler;
+import org.apache.zest.index.rdf.assembly.RdfMemoryStoreAssembler;
+import org.apache.zest.spi.query.IndexExporter;
+import org.apache.zest.test.EntityTestAssembler;
+
+import static org.apache.zest.api.query.QueryExpressions.eq;
+import static org.apache.zest.api.query.QueryExpressions.templateFor;
+
+/**
+ * TODO
+ */
+public class HelloWorldCompositeTest
+{
+ @Test
+ public void testComposite()
+ throws Exception
+ {
+ SingletonAssembler assembler = new SingletonAssembler()
+ {
+ @Override
+ public void assemble( ModuleAssembly module )
+ throws AssemblyException
+ {
+ // START SNIPPET: composite
+ module.transients( HelloWorldComposite.class, HelloWorldComposite2.class ).
+ withMixins( ScalaTraitMixin.class ).
+ withConcerns( ExclamationGenericConcern.class );
+ // END SNIPPET: composite
+ }
+ };
+
+ HelloWorldComposite composite = assembler.module().newTransient( HelloWorldComposite.class );
+ Assert.assertEquals( "Do stuff!", composite.doStuff() );
+ Assert.assertEquals( "Hello there World!", composite.sayHello( "World" ) );
+
+ try
+ {
+ composite.sayHello( "AReallyReallyLongName" );
+ }
+ catch( ConstraintViolationException e )
+ {
+ // Ok!
+ }
+
+ HelloWorldComposite2 composite2 = assembler.module().newTransient( HelloWorldComposite2.class );
+ Assert.assertEquals( "Do custom stuff!", composite2.doStuff() );
+ }
+
+ @Test
+ public void testEntity()
+ throws Exception
+ {
+ SingletonAssembler assembler = new SingletonAssembler()
+ {
+ @Override
+ public void assemble( ModuleAssembly module )
+ throws AssemblyException
+ {
+ // START SNIPPET: entity
+ module.entities( TestEntity.class ).withMixins( ScalaTraitMixin.class );
+ // END SNIPPET: entity
+ // START SNIPPET: service
+ module.services( TestService.class ).withMixins( ScalaTraitMixin.class );
+ // END SNIPPET: service
+
+ new EntityTestAssembler().assemble( module );
+ new RdfMemoryStoreAssembler().assemble( module );
+ }
+ };
+
+ // Create and update Entity
+ UnitOfWork uow = assembler.module().newUnitOfWork();
+ try
+ {
+ Commands entity = uow.newEntity( Commands.class );
+ entity.updateFoo( "Foo" );
+
+ Data data = uow.get( Data.class, entity.toString() );
+
+ Assert.assertEquals( "FooFoo", data.foo().get() );
+ }
+ finally
+ {
+ uow.complete();
+ }
+
+ assembler.module().findService( IndexExporter.class ).get().exportReadableToStream( System.out );
+
+ // Find it
+ uow = assembler.module().newUnitOfWork();
+ try
+ {
+ Data data = uow.newQuery( assembler.module()
+ .newQueryBuilder( Data.class )
+ .where( eq( templateFor( Data.class ).foo(), "FooFoo" ) ) ).find();
+ Assert.assertEquals( "FooFoo", data.foo().get() );
+ }
+ finally
+ {
+ uow.discard();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin.scala
new file mode 100644
index 0000000..cf62e8c
--- /dev/null
+++ b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin.scala
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2011 Rickard Öberg
+ * 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.apache.zest.library.scala
+
+trait HelloWorldMixin
+{
+ def doStuff(): String =
+ {
+ "Do stuff"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin2.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin2.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin2.scala
new file mode 100644
index 0000000..6e176fc
--- /dev/null
+++ b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin2.scala
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2011 Rickard Öberg
+ * 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.apache.zest.library.scala
+
+import org.apache.zest.library.constraints.annotation.MaxLength
+
+// START SNIPPET: mixin
+trait HelloWorldMixin2
+{
+ def sayHello(@MaxLength(10) name: String ): String = "Hello " + name
+}
+// END SNIPPET: mixin
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin3.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin3.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin3.scala
new file mode 100644
index 0000000..118c4fd
--- /dev/null
+++ b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/HelloWorldMixin3.scala
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2011 Rickard Öberg
+ * 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.apache.zest.library.scala
+
+/**
+ * TODO
+ */
+
+trait HelloWorldMixin3
+ extends HelloWorldMixin
+{
+ override def doStuff() = "Do custom stuff"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestEntity.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestEntity.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestEntity.scala
new file mode 100644
index 0000000..426bf58
--- /dev/null
+++ b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestEntity.scala
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2011 Rickard Öberg
+ * 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.apache.zest.library.scala
+
+import org.apache.zest.api.entity.EntityComposite
+import org.apache.zest.api.injection.scope.Service
+import org.apache.zest.api.common.UseDefaults
+import org.apache.zest.api.property.Property
+
+/**
+ * Test entity
+ */
+ // START SNIPPET: entity
+trait TestEntity
+ extends EntityComposite with Commands with Events with Data
+
+trait Commands
+{
+ self: Events =>
+ def updateFoo(newValue: String )
+ {
+ // Call "injected" service
+ val repeated = testService.repeat(newValue)
+
+ // Check here if input is ok
+ updatedFoo(repeated)
+ }
+
+ // Service injection - this is really a method call to the ServiceFinder of the composite
+ @Service
+ def testService: TestService
+}
+
+// Raw data of entity goes here
+trait Data
+{
+ @UseDefaults
+ def foo: Property[ String ]
+
+ // Define property
+ def foo_=(v: String ) { foo.set(v) } // Operator overloading for =
+}
+
+trait Events
+{
+ self: Data =>
+ def updatedFoo(newValue: String )
+ {
+ // Register change by modifying state
+ foo = newValue
+ }
+}
+// END SNIPPET: entity
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestService.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestService.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestService.scala
new file mode 100644
index 0000000..6d66a30
--- /dev/null
+++ b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/TestService.scala
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2011 Rickard Öberg
+ * 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.apache.zest.library.scala
+
+import org.apache.zest.api.service.ServiceComposite
+
+/**
+ * Test service that repeats given string
+ */
+ // START SNIPPET: service
+trait TestService
+ extends ServiceComposite
+{
+ def repeat(input: String ): String = input + input
+}
+// END SNIPPET: service
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/scala/ExclamationGenericConcern.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/scala/ExclamationGenericConcern.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/scala/ExclamationGenericConcern.scala
deleted file mode 100644
index a836426..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/scala/ExclamationGenericConcern.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2011 Rickard Öberg
- * 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.apache.zest.library.scala.scala
-
-import java.lang.reflect.Method
-import org.apache.zest.api.concern.GenericConcern
-import org.apache.zest.api.common.{AppliesToFilter, AppliesTo}
-
-/**
- * Add an exclamation mark to the returned string
- */
-// START SNIPPET: genericconcern
-@AppliesTo(Array(classOf[ StringFilter ]))
-class ExclamationGenericConcern
- extends GenericConcern
-{
- def invoke(composite: AnyRef, method: Method, args: Array[ AnyRef ] ) = next.invoke(composite, method, args) + "!"
-}
-
-class StringFilter
- extends AppliesToFilter
-{
- def appliesTo(method: Method, mixin: Class[ _ ], compositeType: Class[ _ ], fragmentClass: Class[ _ ] ) = method
- .getReturnType
- .equals(classOf[ String ])
-}
-// END SNIPPET: genericconcern
http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/scala/HelloThereConcern.scala
----------------------------------------------------------------------
diff --git a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/scala/HelloThereConcern.scala b/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/scala/HelloThereConcern.scala
deleted file mode 100644
index 7786212..0000000
--- a/libraries/lang-scala/src/test/scala/org/apache/zest/library/scala/scala/HelloThereConcern.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2011 Rickard Öberg
- * 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.apache.zest.library.scala.scala
-
-import org.apache.zest.api.concern.ConcernOf
-
-// START SNIPPET: typedconcern
-class HelloThereConcern
- extends ConcernOf[ HelloWorldMixin2 ] with HelloWorldMixin2
-{
- override def sayHello(name: String ) = next.sayHello("there " + name)
-}
-// END SNIPPET: typedconcern