You are viewing a plain text version of this content. The canonical link for it is here.
Posted to photark-commits@incubator.apache.org by lr...@apache.org on 2011/07/21 06:07:41 UTC
svn commit: r1149044 - in /incubator/photark/trunk/photark-face-recognition:
./ src/main/java/org/apache/photark/face/services/
src/test/java/org/apache/photark/face/facebook/test/ src/test/resources/
Author: lresende
Date: Thu Jul 21 06:07:37 2011
New Revision: 1149044
URL: http://svn.apache.org/viewvc?rev=1149044&view=rev
Log:
Updating testcase with proper dependency and making composite available for the project
Added:
incubator/photark/trunk/photark-face-recognition/src/test/resources/face-recognition-test.composite (with props)
Modified:
incubator/photark/trunk/photark-face-recognition/pom.xml
incubator/photark/trunk/photark-face-recognition/src/main/java/org/apache/photark/face/services/FaceRecognitionServiceImpl.java
incubator/photark/trunk/photark-face-recognition/src/test/java/org/apache/photark/face/facebook/test/GenericFaceRecognitionTestCase.java
Modified: incubator/photark/trunk/photark-face-recognition/pom.xml
URL: http://svn.apache.org/viewvc/incubator/photark/trunk/photark-face-recognition/pom.xml?rev=1149044&r1=1149043&r2=1149044&view=diff
==============================================================================
--- incubator/photark/trunk/photark-face-recognition/pom.xml (original)
+++ incubator/photark/trunk/photark-face-recognition/pom.xml Thu Jul 21 06:07:37 2011
@@ -54,6 +54,14 @@
<version>${tuscany.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+
<!-- JackRabbit Dependencies -->
<!-- The JCR API -->
<dependency>
Modified: incubator/photark/trunk/photark-face-recognition/src/main/java/org/apache/photark/face/services/FaceRecognitionServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/photark/trunk/photark-face-recognition/src/main/java/org/apache/photark/face/services/FaceRecognitionServiceImpl.java?rev=1149044&r1=1149043&r2=1149044&view=diff
==============================================================================
--- incubator/photark/trunk/photark-face-recognition/src/main/java/org/apache/photark/face/services/FaceRecognitionServiceImpl.java (original)
+++ incubator/photark/trunk/photark-face-recognition/src/main/java/org/apache/photark/face/services/FaceRecognitionServiceImpl.java Thu Jul 21 06:07:37 2011
@@ -18,19 +18,26 @@
*/
package org.apache.photark.face.services;
+import java.io.File;
+import java.util.List;
+
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.Service;
+
import com.github.mhendred.face4j.DefaultFaceClient;
import com.github.mhendred.face4j.exception.FaceClientException;
import com.github.mhendred.face4j.exception.FaceServerException;
-import com.github.mhendred.face4j.model.*;
+import com.github.mhendred.face4j.model.Namespace;
+import com.github.mhendred.face4j.model.Photo;
+import com.github.mhendred.face4j.model.RemovedTag;
+import com.github.mhendred.face4j.model.SavedTag;
+import com.github.mhendred.face4j.model.UserStatus;
import com.github.mhendred.face4j.response.GroupResponse;
import com.github.mhendred.face4j.response.LimitsResponse;
import com.github.mhendred.face4j.response.TrainResponse;
import com.github.mhendred.face4j.response.UsersResponse;
-import org.oasisopen.sca.annotation.*;
-
-import java.io.File;
-import java.util.List;
- @Service(FaceRecognitionService.class)
+
+@Service(FaceRecognitionService.class)
@Scope("COMPOSITE")
public class FaceRecognitionServiceImpl implements FaceRecognitionService {
Modified: incubator/photark/trunk/photark-face-recognition/src/test/java/org/apache/photark/face/facebook/test/GenericFaceRecognitionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/photark/trunk/photark-face-recognition/src/test/java/org/apache/photark/face/facebook/test/GenericFaceRecognitionTestCase.java?rev=1149044&r1=1149043&r2=1149044&view=diff
==============================================================================
--- incubator/photark/trunk/photark-face-recognition/src/test/java/org/apache/photark/face/facebook/test/GenericFaceRecognitionTestCase.java (original)
+++ incubator/photark/trunk/photark-face-recognition/src/test/java/org/apache/photark/face/facebook/test/GenericFaceRecognitionTestCase.java Thu Jul 21 06:07:37 2011
@@ -19,42 +19,76 @@
package org.apache.photark.face.facebook.test;
-import com.github.mhendred.face4j.DefaultFaceClient;
-import com.github.mhendred.face4j.exception.FaceClientException;
-import com.github.mhendred.face4j.exception.FaceServerException;
-import com.github.mhendred.face4j.model.Face;
-import com.github.mhendred.face4j.model.Photo;
import org.apache.photark.face.services.FaceRecognitionService;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
+import com.github.mhendred.face4j.DefaultFaceClient;
+import com.github.mhendred.face4j.exception.FaceClientException;
+import com.github.mhendred.face4j.exception.FaceServerException;
+import com.github.mhendred.face4j.model.Face;
+import com.github.mhendred.face4j.model.Photo;
+
+@Ignore
public class GenericFaceRecognitionTestCase {
private DefaultFaceClient defaultFaceClient;
private String apiKey = "";
private String apiSecret = "";
private static Node node;
+
+
+ @BeforeClass
+ public static void BeforeClass() {
+ try {
+ String contribution = ContributionLocationHelper.getContributionLocation("face-recognition-test.composite");
+ node =
+ NodeFactory.newInstance().createNode("face-recognition-test.composite",
+ new Contribution("c1", contribution));
+ node.start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void AfterClass() {
+ if(node != null) {
+ node.stop();
+ }
+ }
+
/*
- This test case shows a generic face recognition app. This includes very same methods we used in FaceRecognitionService SCA component
- This trains two images of Jenifer Lopez and clearly identifies her among Shakira and Marc Anthony
- */
+ * This test case shows a generic face recognition app. This includes very
+ * same methods we used in FaceRecognitionService SCA component This trains
+ * two images of Jenifer Lopez and clearly identifies her among Shakira and
+ * Marc Anthony
+ */
@Test
- @Ignore
-public void testFaceRecognition() throws FaceServerException, FaceClientException {
- FaceRecognitionService defaultFaceClient = (FaceRecognitionService)node.getService(FaceRecognitionService.class,"FaceRecognitionService");
- Photo p1 = defaultFaceClient.detectFromUrls("https://lh3.googleusercontent.com/-z13PTuGA9mg/Thi6cKAiJVI/AAAAAAAAABs/lTEMvH9in1s/s128/Jennifer-Lopez0045.jpg").get(0);
- Photo p2 = defaultFaceClient.detectFromUrls("https://lh5.googleusercontent.com/-K6Jpe-1liwc/Thk0cEGT9cI/AAAAAAAAAB4/9a_84-oMqL8/s128/jennifer-lopez.jpg").get(0);
+ public void testFaceRecognition() throws FaceServerException, FaceClientException {
+ FaceRecognitionService defaultFaceClient =
+ (FaceRecognitionService)node.getService(FaceRecognitionService.class, "FaceRecognitionService");
+ Photo p1 =
+ defaultFaceClient
+ .detectFromUrls("https://lh3.googleusercontent.com/-z13PTuGA9mg/Thi6cKAiJVI/AAAAAAAAABs/lTEMvH9in1s/s128/Jennifer-Lopez0045.jpg").get(0);
+ Photo p2 =
+ defaultFaceClient
+ .detectFromUrls("https://lh5.googleusercontent.com/-K6Jpe-1liwc/Thk0cEGT9cI/AAAAAAAAAB4/9a_84-oMqL8/s128/jennifer-lopez.jpg").get(0);
defaultFaceClient.saveTags(p1.getFace().getTID(), "jenifer@photark.com", "jenifer");
defaultFaceClient.saveTags(p2.getFace().getTID(), "jenifer@photark.com", "jenifer");
defaultFaceClient.train("jenifer@photark.com");
- Photo p = defaultFaceClient.recognizeFromUrls("https://lh3.googleusercontent.com/-4I_Yn56XwAw/Thi6LIZSutI/AAAAAAAAABo/jOjx2cGgHao/s128/110306_latinjlo_400X400.jpg", "jenifer@photark.com").get(0);
+ Photo p =
+ defaultFaceClient
+ .recognizeFromUrls("https://lh3.googleusercontent.com/-4I_Yn56XwAw/Thi6LIZSutI/AAAAAAAAABo/jOjx2cGgHao/s128/110306_latinjlo_400X400.jpg",
+ "jenifer@photark.com").get(0);
for (Face f : p.getFaces()) {
if (f.getGuess() == null) {
@@ -64,20 +98,7 @@ public void testFaceRecognition() throws
}
}
- node.stop();
}
- @BeforeClass
- public static void BeforeClass() {
- try {
- String contribution = ContributionLocationHelper.getContributionLocation("web.composite");
- node = NodeFactory.newInstance().createNode("web.composite", new Contribution("/photark/FaceRecognitionService?smd", contribution));
- node.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
}
-
-
Added: incubator/photark/trunk/photark-face-recognition/src/test/resources/face-recognition-test.composite
URL: http://svn.apache.org/viewvc/incubator/photark/trunk/photark-face-recognition/src/test/resources/face-recognition-test.composite?rev=1149044&view=auto
==============================================================================
--- incubator/photark/trunk/photark-face-recognition/src/test/resources/face-recognition-test.composite (added)
+++ incubator/photark/trunk/photark-face-recognition/src/test/resources/face-recognition-test.composite Thu Jul 21 06:07:37 2011
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://org.apache.photoark"
+ name="FaceRecognitionTestComposite">
+
+ <component name="FaceRecognitionService">
+ <implementation.java class="org.apache.photark.face.services.FaceRecognitionServiceImpl"/>
+
+ <service name="FaceRecognitionService">
+ <interface.java interface="org.apache.photark.face.services.FaceRecognitionService"/>
+ <binding.sca/>
+ </service>
+ </component>
+
+</composite>
Propchange: incubator/photark/trunk/photark-face-recognition/src/test/resources/face-recognition-test.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/photark/trunk/photark-face-recognition/src/test/resources/face-recognition-test.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/photark/trunk/photark-face-recognition/src/test/resources/face-recognition-test.composite
------------------------------------------------------------------------------
svn:mime-type = text/xml