http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/alx.rya/src/main/resources/META-INF/spring/alx.rya-spring.xml ---------------------------------------------------------------------- diff --git a/osgi/alx.rya/src/main/resources/META-INF/spring/alx.rya-spring.xml b/osgi/alx.rya/src/main/resources/META-INF/spring/alx.rya-spring.xml index 47dced1..4ef9ac0 100644 --- a/osgi/alx.rya/src/main/resources/META-INF/spring/alx.rya-spring.xml +++ b/osgi/alx.rya/src/main/resources/META-INF/spring/alx.rya-spring.xml @@ -1,13 +1,23 @@ +<?xml version='1.0'?> -<!-- Copyright (C) 2008 PROTEUS Technologies, LLC This program is free software: - you can redistribute it and/or modify it under the terms of the GNU General - Public License as published by the Free Software Foundation, either version - 3 of the License, or (at your option) any later version. This program is - distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. You should - have received a copy of the GNU General Public License along with this program. - If not, see <http://www.gnu.org/licenses/>. --> +<!-- +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. +--> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/alx.rya/src/main/resources/ROOT/crossdomain.xml ---------------------------------------------------------------------- diff --git a/osgi/alx.rya/src/main/resources/ROOT/crossdomain.xml b/osgi/alx.rya/src/main/resources/ROOT/crossdomain.xml index c3b5339..cec91f6 100644 --- a/osgi/alx.rya/src/main/resources/ROOT/crossdomain.xml +++ b/osgi/alx.rya/src/main/resources/ROOT/crossdomain.xml @@ -1,5 +1,25 @@ <?xml version="1.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. +--> + <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> <cross-domain-policy> <allow-access-from domain="*" secure="false"/> -</cross-domain-policy> \ No newline at end of file +</cross-domain-policy> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/camel.rya/pom.xml ---------------------------------------------------------------------- diff --git a/osgi/camel.rya/pom.xml b/osgi/camel.rya/pom.xml index 951c010..ade8e03 100644 --- a/osgi/camel.rya/pom.xml +++ b/osgi/camel.rya/pom.xml @@ -1,35 +1,54 @@ <?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. +--> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>mvm.rya</groupId> + <groupId>org.apache.rya</groupId> <artifactId>rya.osgi</artifactId> <version>3.2.10-SNAPSHOT</version> </parent> - <groupId>mvm.rya</groupId> + <artifactId>camel.rya</artifactId> + <name>Apache Rya Camel</name> + <packaging>bundle</packaging> - <name>${project.groupId}.${project.artifactId}</name> - <properties> - <camel.version>2.7.2</camel.version> - </properties> + <dependencies> <dependency> + <groupId>org.apache.rya</groupId> + <artifactId>rya.sail</artifactId> + </dependency> + + <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> - <version>${camel.version}</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-test</artifactId> - <version>${camel.version}</version> - </dependency> - <dependency> - <groupId>mvm.rya</groupId> - <artifactId>rya.sail.impl</artifactId> </dependency> + <dependency> - <groupId>mvm.rya</groupId> + <groupId>org.apache.rya</groupId> <artifactId>accumulo.rya</artifactId> <scope>test</scope> </dependency> @@ -48,35 +67,4 @@ </plugins> </build> - <profiles> - <profile> - <id>accumulo</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <dependencies> - <dependency> - <groupId>org.apache.accumulo</groupId> - <artifactId>accumulo-core</artifactId> - <optional>true</optional> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>cloudbase</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <dependencies> - <dependency> - <groupId>com.texeltek</groupId> - <artifactId>accumulo-cloudbase-shim</artifactId> - <optional>true</optional> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - </profiles> - </project> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailComponent.java ---------------------------------------------------------------------- diff --git a/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailComponent.java b/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailComponent.java index 31f864c..0bbc07c 100644 --- a/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailComponent.java +++ b/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailComponent.java @@ -1,25 +1,26 @@ package mvm.rya.camel.cbsail; /* - * #%L - * mvm.rya.camel.rya - * %% - * Copyright (C) 2014 Rya - * %% - * 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 + * 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 + * 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. - * #L% + * 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. */ + + import org.apache.camel.Endpoint; import org.apache.camel.impl.DefaultComponent; import org.openrdf.model.ValueFactory; http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailEndpoint.java ---------------------------------------------------------------------- diff --git a/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailEndpoint.java b/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailEndpoint.java index 20a32d9..4a89291 100644 --- a/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailEndpoint.java +++ b/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailEndpoint.java @@ -1,25 +1,26 @@ package mvm.rya.camel.cbsail; /* - * #%L - * mvm.rya.camel.rya - * %% - * Copyright (C) 2014 Rya - * %% - * 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 + * 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 + * 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. - * #L% + * 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. */ + + import org.apache.camel.*; import org.apache.camel.impl.DefaultEndpoint; import org.openrdf.repository.Repository; http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailProducer.java ---------------------------------------------------------------------- diff --git a/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailProducer.java b/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailProducer.java index 75a39ac..ce3ff55 100644 --- a/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailProducer.java +++ b/osgi/camel.rya/src/main/java/mvm/rya/camel/cbsail/CbSailProducer.java @@ -1,25 +1,26 @@ package mvm.rya.camel.cbsail; /* - * #%L - * mvm.rya.camel.rya - * %% - * Copyright (C) 2014 Rya - * %% - * 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 + * 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 + * 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. - * #L% + * 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. */ + + import org.apache.camel.Exchange; import org.apache.camel.impl.DefaultProducer; import org.openrdf.model.Statement; http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailIntegrationTest.java ---------------------------------------------------------------------- diff --git a/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailIntegrationTest.java b/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailIntegrationTest.java index 8713b3a..d4f53da 100644 --- a/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailIntegrationTest.java +++ b/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailIntegrationTest.java @@ -1,25 +1,26 @@ package mvm.rya.camel.cbsail; /* - * #%L - * mvm.rya.camel.rya - * %% - * Copyright (C) 2014 Rya - * %% - * 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 + * 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 + * 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. - * #L% + * 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. */ + + import mvm.rya.camel.cbsail.CbSailComponent; import org.apache.camel.EndpointInject; import org.apache.camel.Exchange; @@ -113,4 +114,4 @@ public class CbSailIntegrationTest extends CamelTestSupport { }; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailPojoMain.java ---------------------------------------------------------------------- diff --git a/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailPojoMain.java b/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailPojoMain.java index 83b9f65..ddb056e 100644 --- a/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailPojoMain.java +++ b/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailPojoMain.java @@ -1,25 +1,26 @@ package mvm.rya.camel.cbsail; /* - * #%L - * mvm.rya.camel.rya - * %% - * Copyright (C) 2014 Rya - * %% - * 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 + * 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 + * 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. - * #L% + * 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. */ + + import mvm.rya.camel.cbsail.CbSailComponent; import org.apache.camel.EndpointInject; import org.apache.camel.ProducerTemplate; http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailTest.java ---------------------------------------------------------------------- diff --git a/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailTest.java b/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailTest.java index d95ce25..c52d094 100644 --- a/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailTest.java +++ b/osgi/camel.rya/src/test/java/mvm/rya/camel/cbsail/CbSailTest.java @@ -1,25 +1,26 @@ package mvm.rya.camel.cbsail; /* - * #%L - * mvm.rya.camel.rya - * %% - * Copyright (C) 2014 Rya - * %% - * 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 + * 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 + * 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. - * #L% + * 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. */ + + import mvm.rya.accumulo.AccumuloRdfConfiguration; import mvm.rya.accumulo.AccumuloRyaDAO; import mvm.rya.api.RdfCloudTripleStoreConfiguration; http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/pom.xml ---------------------------------------------------------------------- diff --git a/osgi/pom.xml b/osgi/pom.xml index 54bc1f0..e0a8992 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml @@ -1,24 +1,61 @@ <?xml version="1.0" encoding="utf-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<!-- +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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <properties> - <maven-bundle-plugin.version>2.1.0</maven-bundle-plugin.version> - </properties> <parent> - <groupId>mvm.rya</groupId> - <artifactId>parent</artifactId> + <groupId>org.apache.rya</groupId> + <artifactId>rya-project</artifactId> <version>3.2.10-SNAPSHOT</version> </parent> + <artifactId>rya.osgi</artifactId> + <name>Apache Rya OSGI Bundle</name> + <packaging>pom</packaging> - <name>${project.groupId}.${project.artifactId}</name> + + <properties> + <maven-bundle-plugin.version>2.1.0</maven-bundle-plugin.version> + </properties> + <modules> <module>alx.rya</module> <module>alx.rya.console</module> <module>camel.rya</module> + <!-- Disabling and documented in RYA-8 --> + <!-- <module>sesame-runtime-osgi</module> --> </modules> <build> + <plugins> + <!-- Move to subproject when resolving RYA-8 --> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes combine.children="append"> + <exclude>sesame-runtime-osgi/openrdf-sesame-osgi.bnd</exclude> + </excludes> + </configuration> + </plugin> + </plugins> <pluginManagement> <plugins> <plugin> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/osgi/sesame-runtime-osgi/pom.xml ---------------------------------------------------------------------- diff --git a/osgi/sesame-runtime-osgi/pom.xml b/osgi/sesame-runtime-osgi/pom.xml index db1a4bb..c454a66 100644 --- a/osgi/sesame-runtime-osgi/pom.xml +++ b/osgi/sesame-runtime-osgi/pom.xml @@ -1,14 +1,37 @@ +<?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. +--> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>mvm.rya</groupId> - <artifactId>rya.osgi</artifactId> - <version>3.0.4-SNAPSHOT</version> - </parent> + <groupId>org.apache.rya</groupId> + <artifactId>rya.osgi</artifactId> + <version>3.2.10-SNAPSHOT</version> + </parent> + <artifactId>sesame-runtime-osgi</artifactId> - <version>2.6.4</version> + <name>Sesame Runtime for OSGI</name> + <packaging>pom</packaging> - <name>${project.groupId}.${project.artifactId}</name> + <dependencies> <dependency> <groupId>org.openrdf.sesame</groupId> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/partition/common-query-ext/pom.xml ---------------------------------------------------------------------- diff --git a/partition/common-query-ext/pom.xml b/partition/common-query-ext/pom.xml deleted file mode 100644 index 4fb0aee..0000000 --- a/partition/common-query-ext/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <!--<parent>--> - <!--<groupId>sitestore</groupId>--> - <!--<artifactId>sitestore</artifactId>--> - <!--<version>2.0.0-SNAPSHOT</version>--> - <!--</parent>--> - - <parent> - <groupId>mvm.rya</groupId> - <artifactId>parent</artifactId> - <version>2.0.0-SNAPSHOT</version> - </parent> - - <groupId>sitestore.common</groupId> - <artifactId>common-query-ext</artifactId> - <name>common-query (${project.version})</name> - <version>1.0.0-SNAPSHOT</version> - <description>A set of filters and iterators for cloudbase queries</description> - - <properties> - <skipTests>true</skipTests> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <version>2.1.2</version> - <executions> - <execution> - <id>attach-sources</id> - <phase>install</phase> - <goals> - <goal>jar</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.7.2</version> - <configuration> - <skipTests>${skipTests}</skipTests> - </configuration> - </plugin> - </plugins> - </build> - <!--<scm>--> - <!--<connection>${scmLocation}/tto/ss/common/trunk/common-query</connection>--> - <!--</scm>--> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - <dependency> - <groupId>sitestore.common</groupId> - <artifactId>common-query</artifactId> - <version>2.0.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>cloudbase</groupId> - <artifactId>cloudbase-core</artifactId> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/partition/common-query-ext/src/main/java/ss/cloudbase/core/iterators/ext/EncodedSortedRangeIterator.java ---------------------------------------------------------------------- diff --git a/partition/common-query-ext/src/main/java/ss/cloudbase/core/iterators/ext/EncodedSortedRangeIterator.java b/partition/common-query-ext/src/main/java/ss/cloudbase/core/iterators/ext/EncodedSortedRangeIterator.java deleted file mode 100644 index fb59102..0000000 --- a/partition/common-query-ext/src/main/java/ss/cloudbase/core/iterators/ext/EncodedSortedRangeIterator.java +++ /dev/null @@ -1,44 +0,0 @@ -package ss.cloudbase.core.iterators.ext; - -import cloudbase.core.data.Key; -import cloudbase.core.data.Value; -import cloudbase.core.iterators.IteratorEnvironment; -import cloudbase.core.iterators.SortedKeyValueIterator; -import org.apache.commons.codec.binary.Base64; -import org.apache.hadoop.io.Text; -import ss.cloudbase.core.iterators.SortedRangeIterator; - -import java.io.IOException; -import java.util.Map; - -/** - * Class EncodedSortedRangeIterator - * Date: Aug 10, 2011 - * Time: 10:37:28 AM - */ -public class EncodedSortedRangeIterator extends SortedRangeIterator { - - @Override - public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { - super.init(source, options, env); - if (options.containsKey(OPTION_LOWER_BOUND)) { - lower = new Text(decode(options.get(OPTION_LOWER_BOUND))); - } else { - lower = new Text("\u0000"); - } - - if (options.containsKey(OPTION_UPPER_BOUND)) { - upper = new Text(decode(options.get(OPTION_UPPER_BOUND))); - } else { - upper = new Text("\u0000"); - } - } - - public static String encode(String str) { - return new String(Base64.encodeBase64(str.getBytes())); - } - - public static String decode(String str) { - return new String(Base64.decodeBase64(str.getBytes())); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/partition/common-query-ext/src/test/java/GVDateFilterTest.java ---------------------------------------------------------------------- diff --git a/partition/common-query-ext/src/test/java/GVDateFilterTest.java b/partition/common-query-ext/src/test/java/GVDateFilterTest.java deleted file mode 100644 index 8ea5578..0000000 --- a/partition/common-query-ext/src/test/java/GVDateFilterTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.Map.Entry; - -import org.apache.hadoop.io.Text; -import org.junit.Test; - -import ss.cloudbase.core.iterators.GMDenIntersectingIterator; -import ss.cloudbase.core.iterators.filter.general.GVDateFilter; - -import cloudbase.core.client.Connector; -import cloudbase.core.client.Scanner; -import cloudbase.core.client.TableNotFoundException; -import cloudbase.core.data.Key; -import cloudbase.core.data.Range; -import cloudbase.core.data.Value; -import cloudbase.core.iterators.FilteringIterator; -import cloudbase.core.security.Authorizations; - -/** - * - * @author rashah - */ -public class GVDateFilterTest -{ - - private Connector cellLevelConn; - private Connector serializedConn; - private static final String TABLE = "partition"; - private static final Authorizations AUTHS = new Authorizations("ALPHA,BETA,GAMMA".split(",")); - - - - protected Connector getSerializedConnector() - { - if (serializedConn == null) - { - serializedConn = SampleGVData.initConnector(); - SampleGVData.writeDenSerialized(serializedConn, SampleGVData.sampleData()); - } - return serializedConn; - } - - - - protected Scanner getSerializedScanner() - { - Connector c = getSerializedConnector(); - try - { - return c.createScanner(TABLE, AUTHS); - } - catch (TableNotFoundException e) - { - return null; - } - } - - protected Scanner setUpGVDFFilter(Scanner s, String timesta) - { - try - { - - s.setScanIterators(50, FilteringIterator.class.getName(), "gvdf"); - s.setScanIteratorOption("gvdf", "0", GVDateFilter.class.getName()); - s.setScanIteratorOption("gvdf", "0." + GVDateFilter.OPTIONInTimestamp, timesta); - - } - catch (IOException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return s; - } - - protected String checkSerialized(Scanner s) - { - StringBuilder sb = new StringBuilder(); - boolean first = true; - for (Entry<Key, Value> e : s) - { - - if (!first) - { - sb.append(","); - } - else - { - first = false; - } - - String colq = e.getKey().getColumnQualifier().toString(); - - sb.append(colq); - } - return sb.toString(); - } - - - @Test - public void testNoResults() - { - - Scanner s = setUpGVDFFilter(getSerializedScanner(), "2008-03-03T20:44:28.633Z"); - s.setRange(new Range()); - - assertTrue(checkSerialized(s).equals("")); - } - - - @Test - public void testOneResult() - { - - Scanner s = setUpGVDFFilter(getSerializedScanner(), "2011-03-03T20:44:28.633Z"); - s.setRange(new Range()); - - System.out.println(checkSerialized(s)); - - assertTrue(checkSerialized(s).equals("03")); - } - - @Test - public void testTwoResults() - { - - Scanner s = setUpGVDFFilter(getSerializedScanner(), "2009-03-03T20:44:28.633Z"); - s.setRange(new Range()); - - assertTrue(checkSerialized(s).equals("04,01")); - } - - @Test - public void testThreeResults() - { - - Scanner s = setUpGVDFFilter(getSerializedScanner(), "2010-03-01T20:44:28.633Z"); - s.setRange(new Range()); - - assertTrue(checkSerialized(s).equals("04,01,03")); - } - - @Test - public void testDummyTest() - { - assertTrue(true); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/partition/common-query-ext/src/test/java/GVFrequencyFilterTest.java ---------------------------------------------------------------------- diff --git a/partition/common-query-ext/src/test/java/GVFrequencyFilterTest.java b/partition/common-query-ext/src/test/java/GVFrequencyFilterTest.java deleted file mode 100644 index 25c602a..0000000 --- a/partition/common-query-ext/src/test/java/GVFrequencyFilterTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.Map.Entry; - -import org.apache.hadoop.io.Text; -import org.junit.Test; - -import ss.cloudbase.core.iterators.GMDenIntersectingIterator; -import ss.cloudbase.core.iterators.filter.general.GVFrequencyFilter; - -import cloudbase.core.client.Connector; -import cloudbase.core.client.Scanner; -import cloudbase.core.client.TableNotFoundException; -import cloudbase.core.data.Key; -import cloudbase.core.data.Range; -import cloudbase.core.data.Value; -import cloudbase.core.iterators.FilteringIterator; -import cloudbase.core.security.Authorizations; - -/** - * - * @author rashah - */ -public class GVFrequencyFilterTest -{ - - private Connector cellLevelConn; - private Connector serializedConn; - private static final String TABLE = "partition"; - private static final Authorizations AUTHS = new Authorizations("ALPHA,BETA,GAMMA".split(",")); - - - - protected Connector getSerializedConnector() - { - if (serializedConn == null) - { - serializedConn = SampleGVData.initConnector(); - SampleGVData.writeDenSerialized(serializedConn, SampleGVData.sampleData()); - } - return serializedConn; - } - - - - protected Scanner getSerializedScanner() - { - Connector c = getSerializedConnector(); - try - { - return c.createScanner(TABLE, AUTHS); - } - catch (TableNotFoundException e) - { - return null; - } - } - - protected Scanner setUpGVDFFilter(Scanner s, String Frequency) - { - try - { - s.clearScanIterators(); - - s.setScanIterators(50, FilteringIterator.class.getName(), "gvff"); - s.setScanIteratorOption("gvff", "0", GVFrequencyFilter.class.getName()); - s.setScanIteratorOption("gvff", "0." + GVFrequencyFilter.OPTIONFrequency, Frequency); - - } - catch (IOException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return s; - } - - protected String checkSerialized(Scanner s) - { - StringBuilder sb = new StringBuilder(); - boolean first = true; - for (Entry<Key, Value> e : s) - { - - if (!first) - { - sb.append(","); - } - else - { - first = false; - } - - String colq = e.getKey().getColumnQualifier().toString(); - - //System.out.println(e.getKey()+"\t"+e.getValue()); - - sb.append(colq); - } - return sb.toString(); - } - - @Test - public void testNoMatch() - { - - Scanner s = setUpGVDFFilter(getSerializedScanner(), "2000000000"); - s.setRange(new Range()); - - assertTrue(checkSerialized(s).isEmpty()); - } - - @Test - public void testSingleMatch() - { - Scanner s = setUpGVDFFilter(getSerializedScanner(), "1500000000"); - s.setRange(new Range()); - - assertTrue(checkSerialized(s).equals("01")); - } - - - @Test - public void testDoubleMatch() - { - Scanner s = setUpGVDFFilter(getSerializedScanner(), "1200000000"); - s.setRange(new Range()); - - assertTrue(checkSerialized(s).equals("01,03")); - } - - @Test - public void testDummyTest() - { - assertTrue(true); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/partition/common-query-ext/src/test/java/IteratorTest.java ---------------------------------------------------------------------- diff --git a/partition/common-query-ext/src/test/java/IteratorTest.java b/partition/common-query-ext/src/test/java/IteratorTest.java deleted file mode 100644 index 1b5cf14..0000000 --- a/partition/common-query-ext/src/test/java/IteratorTest.java +++ /dev/null @@ -1,554 +0,0 @@ -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.hadoop.io.Text; -import org.junit.Test; - -import ss.cloudbase.core.iterators.CellLevelFilteringIterator; -import ss.cloudbase.core.iterators.CellLevelRecordIterator; -import ss.cloudbase.core.iterators.ConversionIterator; -import ss.cloudbase.core.iterators.GMDenIntersectingIterator; -import ss.cloudbase.core.iterators.SortedMinIterator; -import ss.cloudbase.core.iterators.SortedRangeIterator; -import ss.cloudbase.core.iterators.UniqueIterator; -import ss.cloudbase.core.iterators.filter.CBConverter; -import cloudbase.core.client.Connector; -import cloudbase.core.client.Scanner; -import cloudbase.core.client.TableNotFoundException; -import cloudbase.core.data.Key; -import cloudbase.core.data.PartialKey; -import cloudbase.core.data.Range; -import cloudbase.core.data.Value; -import cloudbase.core.security.Authorizations; - -public class IteratorTest { - private Connector cellLevelConn; - private Connector serializedConn; - - private static final String TABLE = "partition"; - private static final Authorizations AUTHS = new Authorizations("ALPHA,BETA,GAMMA".split(",")); - - public IteratorTest() { - - } - - protected Connector getCellLevelConnector() { - if (cellLevelConn == null) { - cellLevelConn = SampleData.initConnector(); - SampleData.writeDenCellLevel(cellLevelConn, SampleData.sampleData()); - } - return cellLevelConn; - } - - protected Connector getSerializedConnector() { - if (serializedConn == null) { - serializedConn = SampleData.initConnector(); - SampleData.writeDenSerialized(serializedConn, SampleData.sampleData()); - SampleData.writeDenProvenance(serializedConn); - SampleData.writeMinIndexes(serializedConn); - } - return serializedConn; - } - - protected Scanner getProvenanceScanner() { - Connector c = getSerializedConnector(); - try { - return c.createScanner("provenance", AUTHS); - } catch (TableNotFoundException e) { - return null; - } - } - - protected Scanner getCellLevelScanner() { - Connector c = getCellLevelConnector(); - try { - return c.createScanner(TABLE, AUTHS); - } catch (TableNotFoundException e) { - return null; - } - } - - protected Scanner getSerializedScanner() { - Connector c = getSerializedConnector(); - try { - return c.createScanner(TABLE, AUTHS); - } catch (TableNotFoundException e) { - return null; - } - } - - protected Scanner setUpIntersectingIterator(Scanner s, Text[] terms, boolean multiDoc) { - try { - s.setScanIterators(50, GMDenIntersectingIterator.class.getName(), "ii"); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - s.setScanIteratorOption("ii", GMDenIntersectingIterator.indexFamilyOptionName, "index"); - s.setScanIteratorOption("ii", GMDenIntersectingIterator.docFamilyOptionName, "event"); - s.setScanIteratorOption("ii", GMDenIntersectingIterator.OPTION_MULTI_DOC, "" + multiDoc); - s.setScanIteratorOption("ii", GMDenIntersectingIterator.columnFamiliesOptionName, GMDenIntersectingIterator.encodeColumns(terms)); - return s; - } - - protected String checkSerialized(Scanner s) { - StringBuilder sb = new StringBuilder(); - boolean first = true; - for (Entry<Key, Value> e: s) { - if (!first) { - sb.append(","); - } else { - first = false; - } - - String colq = e.getKey().getColumnQualifier().toString(); - - sb.append(colq); - } - return sb.toString(); - } - - protected String checkCellLevel(Scanner s) { - StringBuilder sb = new StringBuilder(); - boolean first = true; - for (Entry<Key, Value> e: s) { - String colq = e.getKey().getColumnQualifier().toString(); - int i = colq.indexOf("\u0000"); - if (i > -1) { - if (!first) { - sb.append(","); - } else { - first = false; - } - sb.append(colq.substring(0, i)); - sb.append("."); - sb.append(colq.substring(i + 1)); - sb.append("="); - sb.append(e.getValue().toString()); - } - } - return sb.toString(); - } - - @Test - public void testSerializedSingleDuplicate() { - Text[] terms = new Text[] { - new Text("A"), - new Text("A") - }; - - String test = "01"; - Scanner s = setUpIntersectingIterator(getSerializedScanner(), terms, false); - s.setRange(new Range()); - assertTrue(test.equals(checkSerialized(s))); - } - - @Test - public void testCellLevelSingleDuplicate() { - Text[] terms = new Text[] { - new Text("A"), - new Text("A") - }; - String test = "01.field0=A,01.field1=B,01.field2=C,01.field3=D,01.field4=E"; - Scanner s = setUpIntersectingIterator(getCellLevelScanner(), terms, true); - s.setRange(new Range()); - assertTrue(test.equals(checkCellLevel(s))); - } - - @Test - public void testSerializedTwoTerms() { - Text[] terms = new Text[] { - new Text("C"), - new Text("D") - }; - // all the evens will come first - String test = "02,01,03"; - Scanner s = setUpIntersectingIterator(getSerializedScanner(), terms, false); - s.setRange(new Range()); - assertTrue(test.equals(checkSerialized(s))); - } - - @Test - public void testCellLevelTwoTerms() { - Text[] terms = new Text[] { - new Text("C"), - new Text("D") - }; - - String test = "02.field0=B,02.field1=C,02.field2=D,02.field3=E,02.field4=F," - + "01.field0=A,01.field1=B,01.field2=C,01.field3=D,01.field4=E," - + "03.field0=C,03.field1=D,03.field2=E,03.field3=F,03.field4=G"; - Scanner s = setUpIntersectingIterator(getCellLevelScanner(), terms, true); - s.setRange(new Range()); - assertTrue(test.equals(checkCellLevel(s))); - } - - @Test - public void testSerializedTwoTermsWithRange() { - Text[] terms = new Text[] { - new Text("C"), - new Text("D") - }; - - String test = "02"; - Scanner s = setUpIntersectingIterator(getSerializedScanner(), terms, false); - s.setRange(new Range(new Key(new Text("0")), true, new Key(new Text("1")), false)); - assertTrue(test.equals(checkSerialized(s))); - } - - @Test - public void testCellLevelTwoTermsWithRange() { - Text[] terms = new Text[] { - new Text("C"), - new Text("D") - }; - - String test = "02.field0=B,02.field1=C,02.field2=D,02.field3=E,02.field4=F"; - Scanner s = setUpIntersectingIterator(getCellLevelScanner(), terms, true); - s.setRange(new Range(new Key(new Text("0")), true, new Key(new Text("1")), false)); - assertTrue(test.equals(checkCellLevel(s))); - } - - @Test - public void testSerializedSingleRange() { - Text[] terms = new Text[] { - new Text(GMDenIntersectingIterator.getRangeTerm("index", "A", true, "B", true)), - new Text(GMDenIntersectingIterator.getRangeTerm("index", "A", true, "B", true)) - }; - - String test = "02,01"; - Scanner s = setUpIntersectingIterator(getSerializedScanner(), terms, false); - s.setRange(new Range()); - assertTrue(test.equals(checkSerialized(s))); - } - - @Test - public void testSerializedMultiRange() { - Text[] terms = new Text[] { - new Text(GMDenIntersectingIterator.getRangeTerm("index", "A", true, "B", true)), - new Text(GMDenIntersectingIterator.getRangeTerm("index", "B", true, "C", true)) - }; - - String test = "02,01"; - Scanner s = setUpIntersectingIterator(getSerializedScanner(), terms, false); - s.setRange(new Range()); - assertTrue(test.equals(checkSerialized(s))); - } - - @Test - public void testSerializedTermAndRange() { - Text[] terms = new Text[] { - new Text("B"), - new Text(GMDenIntersectingIterator.getRangeTerm("index", "A", true, "E", true)) - }; - - String test = "02,01"; - Scanner s = setUpIntersectingIterator(getSerializedScanner(), terms, false); - s.setRange(new Range()); - assertTrue(test.equals(checkSerialized(s))); - } - - protected Scanner setUpSortedRangeIterator(Scanner s, boolean multiDoc) { - try { - s.setScanIterators(50, SortedRangeIterator.class.getName(), "ri"); - s.setScanIteratorOption("ri", SortedRangeIterator.OPTION_COLF, "index"); - s.setScanIteratorOption("ri", SortedRangeIterator.OPTION_DOC_COLF, "event"); - s.setScanIteratorOption("ri", SortedRangeIterator.OPTION_LOWER_BOUND, "A"); - s.setScanIteratorOption("ri", SortedRangeIterator.OPTION_UPPER_BOUND, "C"); - s.setScanIteratorOption("ri", SortedRangeIterator.OPTION_START_INCLUSIVE, "true"); - s.setScanIteratorOption("ri", SortedRangeIterator.OPTION_END_INCLUSIVE, "true"); - s.setScanIteratorOption("ri", SortedRangeIterator.OPTION_MULTI_DOC, "" + multiDoc); - return s; - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - @Test - public void testSerializedSortedRangeIterator() { - Scanner s = setUpSortedRangeIterator(getSerializedScanner(), false); - String test = "02,01,03"; - s.setRange(new Range()); - assertTrue(test.equals(checkSerialized(s))); - } - - @Test - public void testCellLevelSortedRangeIterator() { - Scanner s = setUpSortedRangeIterator(getCellLevelScanner(), true); - String test = "02.field0=B,02.field1=C,02.field2=D,02.field3=E,02.field4=F," - + "01.field0=A,01.field1=B,01.field2=C,01.field3=D,01.field4=E," - + "03.field0=C,03.field1=D,03.field2=E,03.field3=F,03.field4=G"; - s.setRange(new Range()); - assertTrue(test.equals(checkCellLevel(s))); - } - - @Test - public void testUniqueIterator() { - Scanner s = getProvenanceScanner(); - try { - s.setScanIterators(50, UniqueIterator.class.getName(), "skipper"); - Key start = new Key(new Text("sid1")); - s.setRange(new Range(start, start.followingKey(PartialKey.ROW))); - - int count = 0; - for (Entry<Key, Value> e: s) { - count++; - } - - assertEquals(count, 3); - } catch (IOException e) { - e.printStackTrace(); - } - } - - protected Scanner setUpConversionIterator(Scanner s) { - String[] conversions = new String[] { - "field0 + 10", - "field1 - 10", - "field2 * 10", - "field3 / 10", - "field4 % 10" - }; - - try { - s.setScanIterators(50, ConversionIterator.class.getName(), "ci"); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - s.setScanIteratorOption("ci", ConversionIterator.OPTION_CONVERSIONS, ConversionIterator.encodeConversions(conversions)); - Key start = new Key(new Text("1"), new Text("event"), new Text("01")); - s.setRange(new Range(start, true, start.followingKey(PartialKey.ROW_COLFAM_COLQUAL), false)); - - return s; - } - - @Test - public void testConversionIteratorSerialized() { - Scanner s = getSerializedScanner(); - s = setUpConversionIterator(s); - - CBConverter c = new CBConverter(); - - boolean test = true; - Map<String, Double> expected = new HashMap<String, Double>(); - - expected.put("field0", 20.0); - expected.put("field1", 1.0); - expected.put("field2", 120.0); - expected.put("field3", 1.3); - expected.put("field4", 4.0); - - Map<String, String> record; - - for (Entry<Key, Value> e: s) { - record = c.toMap(e.getKey(), e.getValue()); - - for (Entry<String, String> pair: record.entrySet()) { - test = test && expected.get(pair.getKey()).equals(new Double(Double.parseDouble(record.get(pair.getKey())))); - } - } - - assertTrue(test); - } - - @Test - public void testConversionIteratorCellLevel() { - Scanner s = getCellLevelScanner(); - s = setUpConversionIterator(s); - s.setScanIteratorOption("ci", ConversionIterator.OPTION_MULTI_DOC, "true"); - - boolean test = true; - Map<String, Double> expected = new HashMap<String, Double>(); - - expected.put("field0", 20.0); - expected.put("field1", 1.0); - expected.put("field2", 120.0); - expected.put("field3", 1.3); - expected.put("field4", 4.0); - - for (Entry<Key, Value> e: s) { - String field = getField(e.getKey()); - if (field != null) { - test = test && expected.get(field).equals(new Double(Double.parseDouble(e.getValue().toString()))); - } - } - - assertTrue(test); - } - - protected String getField(Key key) { - String colq = key.getColumnQualifier().toString(); - int start = colq.indexOf("\u0000"); - if (start == -1) { - return null; - } - - int end = colq.indexOf("\u0000", start + 1); - if (end == -1) { - end = colq.length(); - } - - return colq.substring(start + 1, end); - } - - @Test - public void testCellLevelOGCFilter() { - Scanner s = getCellLevelScanner(); - s.fetchColumnFamily(new Text("event")); - - try { - s.setScanIterators(60, CellLevelFilteringIterator.class.getName(), "fi"); - } catch (IOException e) { - e.printStackTrace(); - } - - s.setScanIteratorOption("fi", CellLevelFilteringIterator.OPTION_FILTER, "<PropertyIsBetween><PropertyName>field0</PropertyName>" - + "<LowerBoundary><Literal>A</Literal></LowerBoundary>" - + "<UpperBoundary><Literal>C</Literal></UpperBoundary>" - + "</PropertyIsBetween>"); - - String test = "02.field0=B,02.field1=C,02.field2=D,02.field3=E,02.field4=F," - + "01.field0=A,01.field1=B,01.field2=C,01.field3=D,01.field4=E," - + "03.field0=C,03.field1=D,03.field2=E,03.field3=F,03.field4=G"; - assertTrue(test.equals(checkCellLevel(s))); - } - - @Test - public void testMultiLevelIterator() { - Scanner s = getCellLevelScanner(); - Text[] terms = new Text[] { - new Text("C"), - new Text("D") - }; - - s = setUpIntersectingIterator(s, terms, true); - - try { - s.setScanIterators(60, CellLevelFilteringIterator.class.getName(), "fi"); - } catch (IOException e) { - e.printStackTrace(); - } - - s.setScanIteratorOption("fi", CellLevelFilteringIterator.OPTION_FILTER, "<PropertyIsEqualTo><PropertyName>field0</PropertyName>" - + "<Literal>A</Literal>" - + "</PropertyIsEqualTo>"); - - String test = "01.field0=A,01.field1=B,01.field2=C,01.field3=D,01.field4=E"; - assertTrue(test.equals(checkCellLevel(s))); - } - - @Test - public void testMultiLevelIterator2() { - Scanner s = getCellLevelScanner(); - s = setUpSortedRangeIterator(s, true); - try { - s.setScanIterators(60, CellLevelFilteringIterator.class.getName(), "fi"); - } catch (IOException e) { - e.printStackTrace(); - } - s.setScanIteratorOption("fi", CellLevelFilteringIterator.OPTION_FILTER, "<PropertyIsEqualTo><PropertyName>field0</PropertyName>" - + "<Literal>A</Literal>" - + "</PropertyIsEqualTo>"); - - String test = "01.field0=A,01.field1=B,01.field2=C,01.field3=D,01.field4=E"; - assertTrue(test.equals(checkCellLevel(s))); - } - - @Test - public void testCellLevelRecordIterator() { - Scanner s = getCellLevelScanner(); - s = setUpSortedRangeIterator(s, true); - try { - s.setScanIterators(60, CellLevelRecordIterator.class.getName(), "recordItr"); - } catch (IOException e) { - e.printStackTrace(); - } - -// for (Entry<Key, Value> e: s) { -// String v = e.getValue().toString(); -// v = v.replaceAll("\\u0000", ","); -// v = v.replaceAll("\\uFFFD", "="); -// System.out.println(e.getKey() + "\t" + v); -// } - String test = "02,01,03"; - assertTrue(test.equals(checkSerialized(s))); - } - - @Test - public void testIntersectionWithoutDocLookup() { - Text[] terms = new Text[] { - new Text("C"), - new Text("D") - }; - // all the evens will come first - String test = "\u000002,\u000001,\u000003"; - Scanner s = setUpIntersectingIterator(getSerializedScanner(), terms, false); - s.setScanIteratorOption("ii", GMDenIntersectingIterator.OPTION_DOC_LOOKUP, "false"); - s.setRange(new Range()); - assertTrue(test.equals(checkSerialized(s))); - } - - @Test - public void testSimpleNot() { - Text[] terms = new Text[] { - new Text("B"), - new Text("F") - }; - - boolean[] nots = new boolean[] { - false, - true - }; - - String test="01"; - Scanner s = setUpIntersectingIterator(getSerializedScanner(), terms, false); - s.setScanIteratorOption("ii", GMDenIntersectingIterator.notFlagOptionName, GMDenIntersectingIterator.encodeBooleans(nots)); - s.setRange(new Range()); - - assertTrue(test.equals(checkSerialized(s))); - } - - @Test - public void testRangeNot() { - Text[] terms = new Text[] { - new Text("B"), - new Text(GMDenIntersectingIterator.getRangeTerm("index", "F", true, "H", true)) - }; - - boolean[] nots = new boolean[] { - false, - true - }; - - String test = "01"; - Scanner s = setUpIntersectingIterator(getSerializedScanner(), terms, false); - s.setScanIteratorOption("ii", GMDenIntersectingIterator.notFlagOptionName, GMDenIntersectingIterator.encodeBooleans(nots)); - s.setRange(new Range()); - - assertTrue(test.equals(checkSerialized(s))); - } - - @Test - public void testMinIteratorOnLastKeys() { - Scanner s = getSerializedScanner(); - try { - s.setScanIterators(50, SortedMinIterator.class.getName(), "min"); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - s.setScanIteratorOption("min", SortedMinIterator.OPTION_PREFIX, "z"); - s.setRange(new Range()); - - String test = "02,04,06,08,10,01,03,05,07,09"; - assertTrue(test.equals(checkSerialized(s))); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/partition/common-query-ext/src/test/java/JTSFilterTest.java ---------------------------------------------------------------------- diff --git a/partition/common-query-ext/src/test/java/JTSFilterTest.java b/partition/common-query-ext/src/test/java/JTSFilterTest.java deleted file mode 100644 index 8224f64..0000000 --- a/partition/common-query-ext/src/test/java/JTSFilterTest.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.Map.Entry; - -import org.apache.hadoop.io.Text; -import org.junit.Test; - -import ss.cloudbase.core.iterators.GMDenIntersectingIterator; -import ss.cloudbase.core.iterators.filter.jts.JTSFilter; - -import cloudbase.core.client.Connector; -import cloudbase.core.client.Scanner; -import cloudbase.core.client.TableNotFoundException; -import cloudbase.core.data.Key; -import cloudbase.core.data.Range; -import cloudbase.core.data.Value; -import cloudbase.core.iterators.FilteringIterator; -import cloudbase.core.security.Authorizations; - -/** - * - * @author rashah - */ -public class JTSFilterTest -{ - - private Connector cellLevelConn; - private Connector serializedConn; - private static final String TABLE = "partition"; - private static final Authorizations AUTHS = new Authorizations("ALPHA,BETA,GAMMA".split(",")); - - - - protected Connector getSerializedConnector() - { - if (serializedConn == null) - { - serializedConn = SampleJTSData.initConnector(); - SampleJTSData.writeDenSerialized(serializedConn, SampleJTSData.sampleData()); - } - return serializedConn; - } - - - - protected Scanner getSerializedScanner() - { - Connector c = getSerializedConnector(); - try - { - return c.createScanner(TABLE, AUTHS); - } - catch (TableNotFoundException e) - { - return null; - } - } - - protected Scanner setUpJTSFilter(Scanner s, String latitude, String longitude, boolean change_name) - { - try - { - - s.setScanIterators(50, FilteringIterator.class.getName(), "gvdf"); - s.setScanIteratorOption("gvdf", "0", JTSFilter.class.getName()); - s.setScanIteratorOption("gvdf", "0." + JTSFilter.OPTIONCenterPointLat, latitude); - s.setScanIteratorOption("gvdf", "0." + JTSFilter.OPTIONCenterPointLon, longitude); - if (change_name) - s.setScanIteratorOption("gvdf", "0." + JTSFilter.OPTIONGeometryKeyName, "beam-footprint"); - - - } - catch (IOException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return s; - } - - protected String checkSerialized(Scanner s) - { - StringBuilder sb = new StringBuilder(); - boolean first = true; - for (Entry<Key, Value> e : s) - { - - if (!first) - { - sb.append(","); - } - else - { - first = false; - } - - String colq = e.getKey().getColumnQualifier().toString(); - - sb.append(colq); - } - return sb.toString(); - } - - - @Test - public void testNoResults() - { - //London is in niether - 51°30'0.00"N 0° 7'0.00"W - String latitude = "51.5"; - String longitude = "0.11"; - - Scanner s = setUpJTSFilter(getSerializedScanner(), latitude, longitude, false); - s.setRange(new Range()); - -// System.out.println("{" + checkSerialized(s) + "}"); - assertTrue(checkSerialized(s).isEmpty()); - } - - - @Test - public void testOneResultAmerica() - { - //This is North America - //Points 39°44'21.00"N 104°59'3.00"W (Denver) are in the footprint - String latitude = "33"; - String longitude = "-93.0"; - - Scanner s = setUpJTSFilter(getSerializedScanner(), latitude, longitude, false); - s.setRange(new Range()); - - System.out.println("{" + checkSerialized(s) + "}"); - assertTrue(checkSerialized(s).equals("02")); - } - - - @Test - public void testOneResultAustralia() - { - //This is Australia - //Points like 22S 135E are in the beam - String latitude = "-9"; - String longitude = "100.0"; - - Scanner s = setUpJTSFilter(getSerializedScanner(), latitude, longitude, false); - s.setRange(new Range()); - - System.out.println("{" + checkSerialized(s) + "}"); - assertTrue(checkSerialized(s).equals("01")); - } - - @Test - public void testOneResultHawaii() - { - // -164 40 - somewhere near hawaii - - //This is Australia - //Points like 22S 135E are in the beam - String latitude = "40"; - String longitude = "-164.0"; - - Scanner s = setUpJTSFilter(getSerializedScanner(), latitude, longitude, true); - s.setRange(new Range()); - - System.out.println("{" + checkSerialized(s) + "}"); - assertTrue(checkSerialized(s).equals("03")); - } - - - @Test - public void testDummyTest() - { - assertTrue(true); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/partition/common-query-ext/src/test/java/OGCFilterTest.java ---------------------------------------------------------------------- diff --git a/partition/common-query-ext/src/test/java/OGCFilterTest.java b/partition/common-query-ext/src/test/java/OGCFilterTest.java deleted file mode 100644 index fd54945..0000000 --- a/partition/common-query-ext/src/test/java/OGCFilterTest.java +++ /dev/null @@ -1,163 +0,0 @@ -import java.util.HashMap; -import java.util.Map; - -import org.apache.hadoop.io.Text; -import org.junit.Test; - -import cloudbase.core.data.Key; -import cloudbase.core.data.Value; -import ss.cloudbase.core.iterators.filter.ogc.OGCFilter; - -import static org.junit.Assert.*; - -public class OGCFilterTest { - private Key testKey = new Key(new Text("row"), new Text("colf"), new Text("colq")); - private Value testValue = new Value("uuid~event\uFFFDmy-event-hash-1\u0000date\uFFFD20100819\u0000time~dss\uFFFD212706.000\u0000frequency\uFFFD3.368248181443644E8\u0000latitude\uFFFD48.74571142707959\u0000longitude\uFFFD13.865561564126812\u0000altitude\uFFFD1047.0\u0000datetime\uFFFD2010-08-19T21:27:06.000Z\u0000test~key\uFFFD\u0000key\uFFFDa\uFFFDb".getBytes()); - - public OGCFilterTest() { - - } - - private OGCFilter getFilter(String filter) { - OGCFilter f = new OGCFilter(); - Map<String, String> options = new HashMap<String, String>(); - options.put(OGCFilter.OPTION_FILTER, filter); - f.init(options); - return f; - } - - @Test - public void testBBOX() { - OGCFilter f = getFilter("<BBOX><gml:Envelope>" - + "<gml:LowerCorner>13 48</gml:LowerCorner>" - + "<gml:UpperCorner>14 49</gml:UpperCorner>" - + "</gml:Envelope></BBOX>"); - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testBetweenStr() { - OGCFilter f = getFilter("<PropertyIsBetween><PropertyName>datetime</PropertyName>" - + "<LowerBoundary><Literal>2010-08-19</Literal></LowerBoundary>" - + "<UpperBoundary><Literal>2010-08-20</Literal></UpperBoundary>" - + "</PropertyIsBetween>"); - - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testBetweenNum() { - OGCFilter f = getFilter("<PropertyIsBetween><PropertyName>frequency</PropertyName>" - + "<LowerBoundary><Literal>330000000</Literal></LowerBoundary>" - + "<UpperBoundary><Literal>340000000</Literal></UpperBoundary>" - + "</PropertyIsBetween>"); - - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testEqualStr() { - OGCFilter f = getFilter("<PropertyIsEqualTo><PropertyName>uuid~event</PropertyName><Literal>my-event-hash-1</Literal></PropertyIsEqualTo>"); - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testEqualNum() { - OGCFilter f = getFilter("<PropertyIsEqualTo><PropertyName>altitude</PropertyName><Literal>1047</Literal></PropertyIsEqualTo>"); - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testGreaterThanStr() { - OGCFilter f = getFilter("<PropertyIsGreaterThan><PropertyName>datetime</PropertyName><Literal>2010-08-15</Literal></PropertyIsGreaterThan>"); - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testGreaterThanNum() { - OGCFilter f = getFilter("<PropertyIsGreaterThan><PropertyName>altitude</PropertyName><Literal>1000</Literal></PropertyIsGreaterThan>"); - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testLessThanStr() { - OGCFilter f = getFilter("<PropertyIsLessThan><PropertyName>datetime</PropertyName><Literal>2010-08-20</Literal></PropertyIsLessThan>"); - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testLessThanNum() { - OGCFilter f = getFilter("<PropertyIsLessThan><PropertyName>altitude</PropertyName><Literal>1200</Literal></PropertyIsLessThan>"); - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testLike() { - OGCFilter f = getFilter("<PropertyIsLike><PropertyName>uuid~event</PropertyName><Literal>*event*</Literal></PropertyIsLike>"); - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testNotEqualNum() { - OGCFilter f = getFilter("<PropertyIsNotEqualTo><PropertyName>altitude</PropertyName><Literal>1046</Literal></PropertyIsNotEqualTo>"); - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testNull() { - OGCFilter f = getFilter("<PropertyIsNull><PropertyName>test~key</PropertyName></PropertyIsNull>"); - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testNot() { - OGCFilter f = getFilter("<Not><PropertyIsEqualTo><PropertyName>altitude</PropertyName><Literal>1047</Literal></PropertyIsEqualTo></Not>"); - assertFalse(f.accept(testKey, testValue)); - } - - @Test - public void testAnd() { - OGCFilter f = getFilter("<And>" - + "<PropertyIsEqualTo><PropertyName>altitude</PropertyName><Literal>1047</Literal></PropertyIsEqualTo>" - + "<PropertyIsNull><PropertyName>test~key</PropertyName></PropertyIsNull>" - + "</And>"); - - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testOr() { - OGCFilter f = getFilter("<Or>" - + "<PropertyIsLike><PropertyName>uuid~event</PropertyName><Literal>*event*</Literal></PropertyIsLike>" - + "<PropertyIsNull><PropertyName>uuid~event</PropertyName></PropertyIsNull>" - + "</Or>"); - - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testNand() { - OGCFilter f = getFilter("<Not><And>" - + "<PropertyIsNull><PropertyName>uuid~event</PropertyName></PropertyIsNull>" - + "<PropertyIsNull><PropertyName>test~key</PropertyName></PropertyIsNull>" - + "</And></Not>"); - - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testNor() { - OGCFilter f = getFilter("<Not>" - + "<PropertyIsNull><PropertyName>uuid~event</PropertyName></PropertyIsNull>" - + "<PropertyIsNull><PropertyName>altitude</PropertyName></PropertyIsNull>" - + "</Not>"); - - assertTrue(f.accept(testKey, testValue)); - } - - @Test - public void testParse() { - OGCFilter f = getFilter("<PropertyIsEqualTo><PropertyName>key</PropertyName><Literal>a</Literal></PropertyIsEqualTo>"); - assertTrue(f.accept(testKey, testValue)); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/partition/common-query-ext/src/test/java/SampleData.java ---------------------------------------------------------------------- diff --git a/partition/common-query-ext/src/test/java/SampleData.java b/partition/common-query-ext/src/test/java/SampleData.java deleted file mode 100644 index 071076b..0000000 --- a/partition/common-query-ext/src/test/java/SampleData.java +++ /dev/null @@ -1,228 +0,0 @@ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.hadoop.io.Text; - -import cloudbase.core.client.BatchWriter; -import cloudbase.core.client.CBException; -import cloudbase.core.client.CBSecurityException; -import cloudbase.core.client.Connector; -import cloudbase.core.client.Instance; -import cloudbase.core.client.MultiTableBatchWriter; -import cloudbase.core.client.TableExistsException; -import cloudbase.core.client.TableNotFoundException; -import cloudbase.core.client.mock.MockInstance; -import cloudbase.core.data.Mutation; -import cloudbase.core.security.Authorizations; - - -public class SampleData { - public static int NUM_PARTITIONS = 2; - public static int NUM_SAMPLES = 10; - - public static Connector initConnector() { - Instance instance = new MockInstance(); - - try { - Connector connector = instance.getConnector("root", "password".getBytes()); - - // set up table - connector.tableOperations().create("partition"); - connector.tableOperations().create("provenance"); - - // set up root's auths - connector.securityOperations().changeUserAuthorizations("root", new Authorizations("ALPHA,BETA,GAMMA".split(","))); - - return connector; - } catch (CBException e) { - e.printStackTrace(); - } catch (CBSecurityException e) { - e.printStackTrace(); - } catch (TableExistsException e) { - e.printStackTrace(); - } - - return null; - } - - public static Collection<Map<String, String>> sampleData() { - List<Map<String, String>> list = new ArrayList<Map<String, String>>(); - Map<String, String> item; - - for (int i = 0; i < NUM_SAMPLES; i++) { - item = new HashMap<String, String>(); - for (int j = 0; j < 5; j++) { - item.put("field" + j , new String(new char[] {(char) ('A' + ((j + i) % 26))})); - } - list.add(item); - } - return list; - } - - public static void writeDenCellLevel(Connector connector, Collection<Map<String, String>> data) { - // write sample data - MultiTableBatchWriter mtbw = connector.createMultiTableBatchWriter(200000, 10000, 1); - try { - BatchWriter writer; - if (mtbw != null) { - writer = mtbw.getBatchWriter("partition"); - } else { - writer = connector.createBatchWriter("partition", 200000, 10000, 1); - } - int count = 0; - Mutation m; - for (Map<String, String> object: data) { - count++; - String id = (count < 10 ? "0" + count: "" + count); - Text partition = new Text("" + (count % NUM_PARTITIONS)); - - // write dummy record - m = new Mutation(partition); - m.put("event", id, ""); - writer.addMutation(m); - - for (Entry<String, String> entry: object.entrySet()) { - // write the event mutation - m = new Mutation(partition); - m.put("event", id + "\u0000" + entry.getKey(), entry.getValue()); - writer.addMutation(m); - - // write the general index mutation - m = new Mutation(partition); - m.put("index", entry.getValue() + "\u0000" + id, ""); - writer.addMutation(m); - - // write the specific index mutation - m = new Mutation(partition); - m.put("index", entry.getKey() + "//" + entry.getValue() + "\u0000" + id, ""); - writer.addMutation(m); - } - } - writer.close(); - } catch (CBException e) { - e.printStackTrace(); - } catch (CBSecurityException e) { - e.printStackTrace(); - } catch (TableNotFoundException e) { - e.printStackTrace(); - } - } - - public static void writeDenSerialized(Connector connector, Collection<Map<String, String>> data) { - // write sample data - MultiTableBatchWriter mtbw = connector.createMultiTableBatchWriter(200000, 10000, 1); - try { - BatchWriter writer; - if (mtbw != null) { - writer = mtbw.getBatchWriter("partition"); - } else { - writer = connector.createBatchWriter("partition", 200000, 10000, 1); - } - int count = 0; - Mutation m; - for (Map<String, String> object: data) { - count++; - String id = (count < 10 ? "0" + count: "" + count); - Text partition = new Text("" + (count % NUM_PARTITIONS)); - - StringBuilder value = new StringBuilder(); - boolean first = true; - for (Entry<String, String> entry: object.entrySet()) { - if (!first) { - value.append("\u0000"); - } else { - first = false; - } - value.append(entry.getKey()); - value.append("\uFFFD"); - value.append(entry.getValue()); - - // write the general index mutation - m = new Mutation(partition); - m.put("index", entry.getValue() + "\u0000" + id, ""); - writer.addMutation(m); - - // write the specific index mutation - m = new Mutation(partition); - m.put("index", entry.getKey() + "//" + entry.getValue() + "\u0000" + id, ""); - writer.addMutation(m); - } - - // write the event mutation - m = new Mutation(partition); - m.put("event", id, value.toString()); - writer.addMutation(m); - } - writer.close(); - } catch (CBException e) { - e.printStackTrace(); - } catch (CBSecurityException e) { - e.printStackTrace(); - } catch (TableNotFoundException e) { - e.printStackTrace(); - } - } - - public static void writeDenProvenance(Connector connector) { - // write sample data - MultiTableBatchWriter mtbw = connector.createMultiTableBatchWriter(200000, 10000, 1); - try { - BatchWriter writer; - if (mtbw != null) { - writer = mtbw.getBatchWriter("provenance"); - } else { - writer = connector.createBatchWriter("provenance", 200000, 10000, 1); - } - Mutation m; - for (int sid = 1; sid <= 2; sid++) { - for (int time = 1; time <= 3; time++) { - for (int uuid = 1; uuid <= (6 + 2 * time); uuid++) { - m = new Mutation(new Text("sid" + sid)); - m.put("time" + time, "uuid-" + Integer.toHexString(uuid), ""); - writer.addMutation(m); - } - } - } - writer.close(); - } catch (CBException e) { - e.printStackTrace(); - } catch (CBSecurityException e) { - e.printStackTrace(); - } catch (TableNotFoundException e) { - e.printStackTrace(); - } - } - - public static void writeMinIndexes(Connector connector) { - // write sample data - MultiTableBatchWriter mtbw = connector.createMultiTableBatchWriter(200000, 10000, 1); - try { - BatchWriter writer; - if (mtbw != null) { - writer = mtbw.getBatchWriter("partition"); - } else { - writer = connector.createBatchWriter("partition", 200000, 10000, 1); - } - Mutation m; - for (int i = 1; i <= NUM_SAMPLES; i++) { - m = new Mutation(new Text("" + (i % NUM_PARTITIONS))); - - String id = (i < 10 ? "0" + i: "" + i); - - m.put("index", "z_" + id + "_rdate\u0000" + id, ""); - writer.addMutation(m); - } - writer.close(); - } catch (CBException e) { - e.printStackTrace(); - } catch (CBSecurityException e) { - e.printStackTrace(); - } catch (TableNotFoundException e) { - e.printStackTrace(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/80faf06d/partition/common-query-ext/src/test/java/SampleGVData.java ---------------------------------------------------------------------- diff --git a/partition/common-query-ext/src/test/java/SampleGVData.java b/partition/common-query-ext/src/test/java/SampleGVData.java deleted file mode 100644 index d8168de..0000000 --- a/partition/common-query-ext/src/test/java/SampleGVData.java +++ /dev/null @@ -1,182 +0,0 @@ - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.hadoop.io.Text; - -import cloudbase.core.client.BatchWriter; -import cloudbase.core.client.CBException; -import cloudbase.core.client.CBSecurityException; -import cloudbase.core.client.Connector; -import cloudbase.core.client.Instance; -import cloudbase.core.client.MultiTableBatchWriter; -import cloudbase.core.client.TableExistsException; -import cloudbase.core.client.TableNotFoundException; -import cloudbase.core.client.mock.MockInstance; -import cloudbase.core.data.Mutation; -import cloudbase.core.security.Authorizations; - -// For use in testing the Date Filter and Frequency Filter classes -public class SampleGVData -{ - - public static int NUM_PARTITIONS = 2; - - - public static Connector initConnector() - { - Instance instance = new MockInstance(); - - try - { - Connector connector = instance.getConnector("root", "password".getBytes()); - - // set up table - connector.tableOperations().create("partition"); - - // set up root's auths - connector.securityOperations().changeUserAuthorizations("root", new Authorizations("ALPHA,BETA,GAMMA".split(","))); - - return connector; - } - catch (CBException e) - { - e.printStackTrace(); - } - catch (CBSecurityException e) - { - e.printStackTrace(); - } - catch (TableExistsException e) - { - e.printStackTrace(); - } - - return null; - } - - public static Collection<Map<String, String>> sampleData() - { - List<Map<String, String>> list = new ArrayList<Map<String, String>>(); - Map<String, String> item; - - item = new HashMap<String, String>(); - item.put("a", "a"); - item.put("b", "b"); - - //This one is like RB - item.put("date-start", "2009-01-01"); - item.put("date-end", "2011-02-24"); - item.put("date-update", "2011-02-24T00:00:00Z"); - item.put("frequency", "1250000000"); - item.put("bandwidth", "500000000"); - item.put("version", "1"); - list.add(item); - - item = new HashMap<String, String>(); - item.put("a", "a"); - item.put("b", "b"); - list.add(item); - - //This one is like GV - item = new HashMap<String, String>(); - item.put("a", "a"); - item.put("b", "b"); - item.put("date-start", "2010-01-01"); - item.put("date-update", "2010-01-23"); - item.put("frequency", "1150000000"); - item.put("bandwidth", "300000000"); - list.add(item); - - item = new HashMap<String, String>(); - item.put("a", "a"); - item.put("b", "b"); - item.put("date-start", "2009-01-01"); - item.put("date-end", "2011-02-24"); - item.put("date-update", "2008-01-23"); - list.add(item); - - item = new HashMap<String, String>(); - item.put("a", "a"); - item.put("b", "b"); - list.add(item); - - return list; - } - - - public static void writeDenSerialized(Connector connector, Collection<Map<String, String>> data) - { - // write sample data - MultiTableBatchWriter mtbw = connector.createMultiTableBatchWriter(200000, 10000, 1); - try - { - BatchWriter writer; - if (mtbw != null) - { - writer = mtbw.getBatchWriter("partition"); - } - else - { - writer = connector.createBatchWriter("partition", 200000, 10000, 1); - } - int count = 0; - Mutation m; - for (Map<String, String> object : data) - { - count++; - String id = (count < 10 ? "0" + count : "" + count); - Text partition = new Text("" + (count % NUM_PARTITIONS)); - - StringBuilder value = new StringBuilder(); - boolean first = true; - for (Entry<String, String> entry : object.entrySet()) - { - if (!first) - { - value.append("\u0000"); - } - else - { - first = false; - } - value.append(entry.getKey()); - value.append("\uFFFD"); - value.append(entry.getValue()); - - // write the general index mutation - m = new Mutation(partition); - m.put("index", entry.getValue() + "\u0000" + id, ""); - writer.addMutation(m); - - // write the specific index mutation - m = new Mutation(partition); - m.put("index", entry.getKey() + "//" + entry.getValue() + "\u0000" + id, ""); - writer.addMutation(m); - } - - // write the event mutation - m = new Mutation(partition); - m.put("event", id, value.toString()); - writer.addMutation(m); - } - writer.close(); - } - catch (CBException e) - { - e.printStackTrace(); - } - catch (CBSecurityException e) - { - e.printStackTrace(); - } - catch (TableNotFoundException e) - { - e.printStackTrace(); - } - } -}
