Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0047B200BA5 for ; Wed, 14 Sep 2016 03:37:52 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F30C4160AD2; Wed, 14 Sep 2016 01:37:51 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 74DA3160AD3 for ; Wed, 14 Sep 2016 03:37:48 +0200 (CEST) Received: (qmail 88717 invoked by uid 500); 14 Sep 2016 01:37:47 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 88651 invoked by uid 99); 14 Sep 2016 01:37:47 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Sep 2016 01:37:47 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6DB7EE0667; Wed, 14 Sep 2016 01:37:47 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akuznetsov@apache.org To: commits@ignite.apache.org Date: Wed, 14 Sep 2016 01:37:48 -0000 Message-Id: <08e4b4cc65b5439681b145a0ca196365@git.apache.org> In-Reply-To: <4c83a93a5406414e93ce55a021b357d0@git.apache.org> References: <4c83a93a5406414e93ce55a021b357d0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/20] ignite git commit: IGNITE-3172 Refactoring Ignite-Cassandra serializers. - Fixes #956. archived-at: Wed, 14 Sep 2016 01:37:52 -0000 http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/cassandra/WriteWorker.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/cassandra/WriteWorker.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/cassandra/WriteWorker.java new file mode 100644 index 0000000..2b10bcd --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/cassandra/WriteWorker.java @@ -0,0 +1,51 @@ +/* + * 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.ignite.tests.load.cassandra; + +import org.apache.ignite.cache.store.CacheStore; +import org.apache.ignite.internal.processors.cache.CacheEntryImpl; +import org.apache.ignite.tests.load.Worker; + +/** + * Cassandra direct load tests worker for write operation CacheStore.write + */ +public class WriteWorker extends Worker { + /** */ + public static final String LOGGER_NAME = "CassandraWriteLoadTest"; + + /** */ + public WriteWorker(CacheStore cacheStore, long startPosition, long endPosition) { + super(cacheStore, startPosition, endPosition); + } + + /** {@inheritDoc} */ + @Override protected String loggerName() { + return LOGGER_NAME; + } + + /** {@inheritDoc} */ + @Override protected boolean batchMode() { + return false; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override protected void process(CacheStore cacheStore, CacheEntryImpl entry) { + cacheStore.write(entry); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/cassandra/package-info.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/cassandra/package-info.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/cassandra/package-info.java new file mode 100644 index 0000000..bcf66b6 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/cassandra/package-info.java @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/** + * Contains load tests workers implementation for Cassandra cluster + */ +package org.apache.ignite.tests.load.cassandra; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/BulkReadWorker.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/BulkReadWorker.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/BulkReadWorker.java new file mode 100644 index 0000000..c20d0ce --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/BulkReadWorker.java @@ -0,0 +1,52 @@ +/* + * 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.ignite.tests.load.ignite; + +import java.util.Map; +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.tests.load.Worker; + +/** + * Ignite load tests worker for bulk read operation CacheStore.loadAll + */ +public class BulkReadWorker extends Worker { + /** */ + public static final String LOGGER_NAME = "IgniteBulkReadLoadTest"; + + /** */ + public BulkReadWorker(Ignite ignite, long startPosition, long endPosition) { + super(ignite, startPosition, endPosition); + } + + /** {@inheritDoc} */ + @Override protected String loggerName() { + return LOGGER_NAME; + } + + /** {@inheritDoc} */ + @Override protected boolean batchMode() { + return true; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override protected void process(IgniteCache cache, Map entries) { + cache.getAll(entries.keySet()); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/BulkWriteWorker.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/BulkWriteWorker.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/BulkWriteWorker.java new file mode 100644 index 0000000..1ce7be3 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/BulkWriteWorker.java @@ -0,0 +1,52 @@ +/* + * 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.ignite.tests.load.ignite; + +import java.util.Map; +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.tests.load.Worker; + +/** + * Ignite load tests worker for bulk read operation CacheStore.writeAll + */ +public class BulkWriteWorker extends Worker { + /** */ + public static final String LOGGER_NAME = "IgniteBulkWriteLoadTest"; + + /** */ + public BulkWriteWorker(Ignite ignite, long startPosition, long endPosition) { + super(ignite, startPosition, endPosition); + } + + /** {@inheritDoc} */ + @Override protected String loggerName() { + return LOGGER_NAME; + } + + /** {@inheritDoc} */ + @Override protected boolean batchMode() { + return true; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override protected void process(IgniteCache cache, Map entries) { + cache.putAll(entries); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/ReadWorker.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/ReadWorker.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/ReadWorker.java new file mode 100644 index 0000000..35f7d39 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/ReadWorker.java @@ -0,0 +1,51 @@ +/* + * 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.ignite.tests.load.ignite; + +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.tests.load.Worker; + +/** + * Ignite load tests worker for read operation CacheStore.load + */ +public class ReadWorker extends Worker { + /** */ + public static final String LOGGER_NAME = "IgniteReadLoadTest"; + + /** */ + public ReadWorker(Ignite ignite, long startPosition, long endPosition) { + super(ignite, startPosition, endPosition); + } + + /** {@inheritDoc} */ + @Override protected String loggerName() { + return LOGGER_NAME; + } + + /** {@inheritDoc} */ + @Override protected boolean batchMode() { + return false; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override protected void process(IgniteCache cache, Object key, Object val) { + cache.get(key); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/WriteWorker.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/WriteWorker.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/WriteWorker.java new file mode 100644 index 0000000..bed7099 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/WriteWorker.java @@ -0,0 +1,51 @@ +/* + * 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.ignite.tests.load.ignite; + +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.tests.load.Worker; + +/** + * Ignite load tests worker for write operation CacheStore.write + */ +public class WriteWorker extends Worker { + /** */ + public static final String LOGGER_NAME = "IgniteWriteLoadTest"; + + /** */ + public WriteWorker(Ignite ignite, long startPosition, long endPosition) { + super(ignite, startPosition, endPosition); + } + + /** {@inheritDoc} */ + @Override protected String loggerName() { + return LOGGER_NAME; + } + + /** {@inheritDoc} */ + @Override protected boolean batchMode() { + return false; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override protected void process(IgniteCache cache, Object key, Object val) { + cache.put(key, val); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/package-info.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/package-info.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/package-info.java new file mode 100644 index 0000000..af1d098 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/ignite/package-info.java @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/** + * Contains load tests workers implementation for Ignite-Cassandra cluster + */ +package org.apache.ignite.tests.load.ignite; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/package-info.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/package-info.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/package-info.java new file mode 100644 index 0000000..55b7344 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/load/package-info.java @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/** + * Contains load tests classes + */ +package org.apache.ignite.tests.load; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/package-info.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/package-info.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/package-info.java new file mode 100644 index 0000000..2d627f1 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/package-info.java @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/** + * Contains unit tests + */ +package org.apache.ignite.tests; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/Person.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/Person.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/Person.java new file mode 100644 index 0000000..8a1e623 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/Person.java @@ -0,0 +1,246 @@ +/* + * 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.ignite.tests.pojos; + +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.Date; +import java.util.List; + +/** + * Simple POJO which could be stored as a value in Ignite cache + */ +public class Person implements Externalizable { + /** */ + private String firstName; + + /** */ + private String lastName; + + /** */ + private int age; + + /** */ + private boolean married; + + /** */ + private long height; + + /** */ + private float weight; + + /** */ + private Date birthDate; + + /** */ + private List phones; + + /** */ + @SuppressWarnings("UnusedDeclaration") + public Person() { + } + + /** */ + public Person(String firstName, String lastName, int age, boolean married, + long height, float weight, Date birthDate, List phones) { + this.firstName = firstName; + this.lastName = lastName; + this.age = age; + this.married = married; + this.height = height; + this.weight = weight; + this.birthDate = birthDate; + this.phones = phones; + } + + + /** {@inheritDoc} */ + @Override public void writeExternal(ObjectOutput out) throws IOException { + out.writeObject(firstName); + out.writeObject(lastName); + out.writeInt(age); + out.writeBoolean(married); + out.writeLong(height); + out.writeFloat(weight); + out.writeObject(birthDate); + out.writeObject(phones); + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + firstName = (String)in.readObject(); + lastName = (String)in.readObject(); + age = in.readInt(); + married = in.readBoolean(); + height = in.readLong(); + weight = in.readFloat(); + birthDate = (Date)in.readObject(); + phones = (List)in.readObject(); + } + + /** {@inheritDoc} */ + @SuppressWarnings("SimplifiableIfStatement") + @Override public boolean equals(Object obj) { + if (obj == null || !(obj instanceof Person)) + return false; + + Person person = (Person)obj; + + if ((firstName != null && !firstName.equals(person.firstName)) || + (person.firstName != null && !person.firstName.equals(firstName))) + return false; + + if ((lastName != null && !lastName.equals(person.lastName)) || + (person.lastName != null && !person.lastName.equals(lastName))) + return false; + + if ((birthDate != null && !birthDate.equals(person.birthDate)) || + (person.birthDate != null && !person.birthDate.equals(birthDate))) + return false; + + if ((phones != null && !phones.equals(person.phones)) || + (person.phones != null && !person.phones.equals(phones))) + return false; + + return age == person.age && married == person.married && + height == person.height && weight == person.weight; + } + + /** */ + @SuppressWarnings("SimplifiableIfStatement") + public boolean equalsPrimitiveFields(Object obj) { + if (obj == null || !(obj instanceof Person)) + return false; + + Person person = (Person)obj; + + if ((firstName != null && !firstName.equals(person.firstName)) || + (person.firstName != null && !person.firstName.equals(firstName))) + return false; + + if ((lastName != null && !lastName.equals(person.lastName)) || + (person.lastName != null && !person.lastName.equals(lastName))) + return false; + + if ((birthDate != null && !birthDate.equals(person.birthDate)) || + (person.birthDate != null && !person.birthDate.equals(birthDate))) + return false; + + return age == person.age && married == person.married && + height == person.height && weight == person.weight; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setFirstName(String name) { + firstName = name; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public String getFirstName() { + return firstName; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setLastName(String name) { + lastName = name; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public String getLastName() { + return lastName; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setAge(int age) { + this.age = age; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public int getAge() { + return age; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setMarried(boolean married) { + this.married = married; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public boolean getMarried() { + return married; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setHeight(long height) { + this.height = height; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public long getHeight() { + return height; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setWeight(float weight) { + this.weight = weight; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public float getWeight() { + return weight; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setBirthDate(Date date) { + birthDate = date; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public Date getBirthDate() { + return birthDate; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setPhones(List phones) { + this.phones = phones; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public List getPhones() { + return phones; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/PersonId.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/PersonId.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/PersonId.java new file mode 100644 index 0000000..0dd5ab8 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/PersonId.java @@ -0,0 +1,110 @@ +/* + * 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.ignite.tests.pojos; + +import java.io.Serializable; + +/** + * Simple POJO which could be stored as a key in Ignite cache + */ +public class PersonId implements Serializable { + /** */ + private String companyCode; + + /** */ + private String departmentCode; + + /** */ + private long personNum; + + /** */ + @SuppressWarnings("UnusedDeclaration") + public PersonId() { + } + + /** */ + public PersonId(String companyCode, String departmentCode, long personNum) { + this.companyCode = companyCode; + this.departmentCode = departmentCode; + this.personNum = personNum; + } + + /** {@inheritDoc} */ + @SuppressWarnings("SimplifiableIfStatement") + @Override public boolean equals(Object obj) { + if (obj == null || !(obj instanceof PersonId)) + return false; + + PersonId id = (PersonId)obj; + + if ((companyCode != null && !companyCode.equals(id.companyCode)) || + (id.companyCode != null && !id.companyCode.equals(companyCode))) + return false; + + if ((companyCode != null && !companyCode.equals(id.companyCode)) || + (id.companyCode != null && !id.companyCode.equals(companyCode))) + return false; + + return personNum == id.personNum; + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + String code = (companyCode == null ? "" : companyCode) + + (departmentCode == null ? "" : departmentCode) + + personNum; + + return code.hashCode(); + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setCompanyCode(String code) { + companyCode = code; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public String getCompanyCode() { + return companyCode; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setDepartmentCode(String code) { + departmentCode = code; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public String getDepartmentCode() { + return departmentCode; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void setPersonNumber(long personNum) { + this.personNum = personNum; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public long getPersonNumber() { + return personNum; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/package-info.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/package-info.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/package-info.java new file mode 100644 index 0000000..fb166b5 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/pojos/package-info.java @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/** + * Contains sample POJO objects used in unit tests + */ +package org.apache.ignite.tests.pojos; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CacheStoreHelper.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CacheStoreHelper.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CacheStoreHelper.java new file mode 100644 index 0000000..b5ff5ad --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CacheStoreHelper.java @@ -0,0 +1,64 @@ +/* + * 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.ignite.tests.utils; + +import java.lang.reflect.Field; +import org.apache.ignite.cache.store.CacheStore; +import org.apache.ignite.cache.store.cassandra.CassandraCacheStore; +import org.apache.ignite.cache.store.cassandra.datasource.DataSource; +import org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings; +import org.apache.ignite.logger.log4j.Log4JLogger; +import org.apache.log4j.Logger; +import org.springframework.core.io.Resource; + +/** + * Helper class utilized by unit tests to get appropriate instance of {@link CacheStore} + */ +public class CacheStoreHelper { + /** */ + private static final Logger LOGGER = Logger.getLogger(CacheStoreHelper.class.getName()); + + /** */ + public static CacheStore createCacheStore(String cacheName, Resource persistenceSettings, DataSource conn) { + return createCacheStore(cacheName, persistenceSettings, conn, LOGGER); + } + + /** */ + public static CacheStore createCacheStore(String cacheName, Resource persistenceSettings, DataSource conn, + Logger log) { + CassandraCacheStore cacheStore = + new CassandraCacheStore<>(conn, new KeyValuePersistenceSettings(persistenceSettings), + Runtime.getRuntime().availableProcessors()); + + try { + Field sesField = CassandraCacheStore.class.getDeclaredField("storeSes"); + Field logField = CassandraCacheStore.class.getDeclaredField("log"); + + sesField.setAccessible(true); + logField.setAccessible(true); + + sesField.set(cacheStore, new TestCacheSession(cacheName)); + logField.set(cacheStore, new Log4JLogger(log)); + } + catch (Throwable e) { + throw new RuntimeException("Failed to initialize test Ignite cache store", e); + } + + return cacheStore; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraAdminCredentials.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraAdminCredentials.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraAdminCredentials.java new file mode 100644 index 0000000..e7047f3 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraAdminCredentials.java @@ -0,0 +1,38 @@ +/* + * 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.ignite.tests.utils; + +import org.apache.ignite.cache.store.cassandra.datasource.Credentials; + +/** + * Implementation of {@link Credentials} providing admin user/password to establish Cassandra session. + */ +public class CassandraAdminCredentials implements Credentials { + /** */ + private static final long serialVersionUID = 0L; + + /** {@inheritDoc} */ + @Override public String getUser() { + return CassandraHelper.getAdminUser(); + } + + /** {@inheritDoc} */ + @Override public String getPassword() { + return CassandraHelper.getAdminPassword(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraHelper.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraHelper.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraHelper.java new file mode 100644 index 0000000..970be84 --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraHelper.java @@ -0,0 +1,358 @@ +/* + * 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.ignite.tests.utils; + +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.PreparedStatement; +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.Statement; +import java.lang.reflect.Field; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.URL; +import java.util.LinkedList; +import java.util.List; +import java.util.ResourceBundle; + +import org.apache.ignite.cache.store.cassandra.datasource.DataSource; +import org.apache.ignite.cache.store.cassandra.session.pool.SessionPool; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.lifecycle.LifecycleEventType; +import org.apache.ignite.logger.log4j.Log4JLogger; +import org.apache.log4j.Logger; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * Helper class providing bunch of utility methods to work with Cassandra + */ +public class CassandraHelper { + /** */ + private static final ResourceBundle CREDENTIALS = ResourceBundle.getBundle("org/apache/ignite/tests/cassandra/credentials"); + + /** */ + private static final ResourceBundle CONNECTION = ResourceBundle.getBundle("org/apache/ignite/tests/cassandra/connection"); + + /** */ + private static final ResourceBundle KEYSPACES = ResourceBundle.getBundle("org/apache/ignite/tests/cassandra/keyspaces"); + + /** */ + private static final String EMBEDDED_CASSANDRA_YAML = "org/apache/ignite/tests/cassandra/embedded-cassandra.yaml"; + + /** */ + private static final ApplicationContext connectionContext = new ClassPathXmlApplicationContext("org/apache/ignite/tests/cassandra/connection-settings.xml"); + + /** */ + private static DataSource adminDataSrc; + + /** */ + private static DataSource regularDataSrc; + + /** */ + private static Cluster adminCluster; + + /** */ + private static Cluster regularCluster; + + /** */ + private static Session adminSes; + + /** */ + private static Session regularSes; + + /** */ + private static CassandraLifeCycleBean embeddedCassandraBean; + + /** */ + public static String getAdminUser() { + return CREDENTIALS.getString("admin.user"); + } + + /** */ + public static String getAdminPassword() { + return CREDENTIALS.getString("admin.password"); + } + + /** */ + public static String getRegularUser() { + return CREDENTIALS.getString("regular.user"); + } + + /** */ + public static String getRegularPassword() { + return CREDENTIALS.getString("regular.password"); + } + + /** */ + public static String[] getTestKeyspaces() { + return KEYSPACES.getString("keyspaces").split(","); + } + + /** */ + public static String[] getContactPointsArray() { + String[] points = CONNECTION.getString("contact.points").split(","); + + if (points.length == 0) + throw new RuntimeException("No Cassandra contact points specified"); + + for (int i = 0; i < points.length; i++) + points[i] = points[i].trim(); + + return points; + } + + /** */ + public static List getContactPoints() { + String[] points = getContactPointsArray(); + + List contactPoints = new LinkedList<>(); + + for (String point : points) { + if (point.contains(":")) + continue; + + try { + contactPoints.add(InetAddress.getByName(point)); + } + catch (Throwable e) { + throw new IllegalArgumentException("Incorrect contact point '" + point + + "' specified for Cassandra cache storage", e); + } + } + + return contactPoints; + } + + /** */ + public static List getContactPointsWithPorts() { + String[] points = getContactPointsArray(); + + List contactPoints = new LinkedList<>(); + + for (String point : points) { + if (!point.contains(":")) + continue; + + String[] chunks = point.split(":"); + + try { + contactPoints.add(InetSocketAddress.createUnresolved(chunks[0].trim(), Integer.parseInt(chunks[1].trim()))); + } + catch (Throwable e) { + throw new IllegalArgumentException("Incorrect contact point '" + point + + "' specified for Cassandra cache storage", e); + } + } + + return contactPoints; + } + + /** + * Checks if embedded Cassandra should be used for unit tests + * @return true if embedded Cassandra should be used + */ + public static boolean useEmbeddedCassandra() { + String[] contactPoints = getContactPointsArray(); + + return contactPoints != null && contactPoints.length == 1 && contactPoints[0].trim().startsWith("127.0.0.1"); + } + + /** */ + public static void dropTestKeyspaces() { + String[] keyspaces = getTestKeyspaces(); + + for (String keyspace : keyspaces) { + try { + executeWithAdminCredentials("DROP KEYSPACE IF EXISTS " + keyspace + ";"); + } + catch (Throwable e) { + throw new RuntimeException("Failed to drop keyspace: " + keyspace, e); + } + } + } + + /** */ + public static ResultSet executeWithAdminCredentials(String statement, Object... args) { + if (args == null || args.length == 0) + return adminSession().execute(statement); + + PreparedStatement ps = adminSession().prepare(statement); + return adminSession().execute(ps.bind(args)); + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public static ResultSet executeWithRegularCredentials(String statement, Object... args) { + if (args == null || args.length == 0) + return regularSession().execute(statement); + + PreparedStatement ps = regularSession().prepare(statement); + return regularSession().execute(ps.bind(args)); + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public static ResultSet executeWithAdminCredentials(Statement statement) { + return adminSession().execute(statement); + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public static ResultSet executeWithRegularCredentials(Statement statement) { + return regularSession().execute(statement); + } + + /** */ + public static synchronized DataSource getAdminDataSrc() { + if (adminDataSrc != null) + return adminDataSrc; + + return adminDataSrc = (DataSource)connectionContext.getBean("cassandraAdminDataSource"); + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public static synchronized DataSource getRegularDataSrc() { + if (regularDataSrc != null) + return regularDataSrc; + + return regularDataSrc = (DataSource)connectionContext.getBean("cassandraRegularDataSource"); + } + + /** */ + public static void testAdminConnection() { + try { + adminSession(); + } + catch (Throwable e) { + throw new RuntimeException("Failed to check admin connection to Cassandra", e); + } + } + + /** */ + public static void testRegularConnection() { + try { + regularSession(); + } + catch (Throwable e) { + throw new RuntimeException("Failed to check regular connection to Cassandra", e); + } + } + + /** */ + public static synchronized void releaseCassandraResources() { + try { + if (adminSes != null && !adminSes.isClosed()) + U.closeQuiet(adminSes); + } + finally { + adminSes = null; + } + + try { + if (adminCluster != null && !adminCluster.isClosed()) + U.closeQuiet(adminCluster); + } + finally { + adminCluster = null; + } + + try { + if (regularSes != null && !regularSes.isClosed()) + U.closeQuiet(regularSes); + } + finally { + regularSes = null; + } + + try { + if (regularCluster != null && !regularCluster.isClosed()) + U.closeQuiet(regularCluster); + } + finally { + regularCluster = null; + } + + SessionPool.release(); + } + + /** */ + private static synchronized Session adminSession() { + if (adminSes != null) + return adminSes; + + try { + Cluster.Builder builder = Cluster.builder(); + builder = builder.withCredentials(getAdminUser(), getAdminPassword()); + builder.addContactPoints(getContactPoints()); + builder.addContactPointsWithPorts(getContactPointsWithPorts()); + + adminCluster = builder.build(); + return adminSes = adminCluster.connect(); + } + catch (Throwable e) { + throw new RuntimeException("Failed to create admin session to Cassandra database", e); + } + } + + /** */ + private static synchronized Session regularSession() { + if (regularSes != null) + return regularSes; + + try { + Cluster.Builder builder = Cluster.builder(); + builder = builder.withCredentials(getRegularUser(), getRegularPassword()); + builder.addContactPoints(getContactPoints()); + builder.addContactPointsWithPorts(getContactPointsWithPorts()); + + regularCluster = builder.build(); + return regularSes = regularCluster.connect(); + } + catch (Throwable e) { + throw new RuntimeException("Failed to create regular session to Cassandra database", e); + } + } + + /** */ + public static void startEmbeddedCassandra(Logger log) { + ClassLoader clsLdr = CassandraHelper.class.getClassLoader(); + URL url = clsLdr.getResource(EMBEDDED_CASSANDRA_YAML); + + embeddedCassandraBean = new CassandraLifeCycleBean(); + embeddedCassandraBean.setCassandraConfigFile(url.getFile()); + + try { + Field logField = CassandraLifeCycleBean.class.getDeclaredField("log"); + logField.setAccessible(true); + logField.set(embeddedCassandraBean, new Log4JLogger(log)); + } + catch (Throwable e) { + throw new RuntimeException("Failed to initialize logger for CassandraLifeCycleBean", e); + } + + embeddedCassandraBean.onLifecycleEvent(LifecycleEventType.BEFORE_NODE_START); + } + + /** */ + public static void stopEmbeddedCassandra() { + if (embeddedCassandraBean != null) + embeddedCassandraBean.onLifecycleEvent(LifecycleEventType.BEFORE_NODE_STOP); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraLifeCycleBean.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraLifeCycleBean.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraLifeCycleBean.java new file mode 100644 index 0000000..d70d71e --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraLifeCycleBean.java @@ -0,0 +1,149 @@ +/* + * 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.ignite.tests.utils; + +import org.apache.cassandra.service.CassandraDaemon; +import org.apache.ignite.IgniteLogger; +import org.apache.ignite.lifecycle.LifecycleBean; +import org.apache.ignite.lifecycle.LifecycleEventType; +import org.apache.ignite.resources.LoggerResource; + +/** + * Implementation of {@link LifecycleBean} to start embedded Cassandra instance on Ignite cluster startup + */ +public class CassandraLifeCycleBean implements LifecycleBean { + /** System property specifying Cassandra jmx port */ + private static final String CASSANDRA_JMX_PORT_PROP = "cassandra.jmx.local.port"; + + /** System property specifying Cassandra YAML config file */ + private static final String CASSANDRA_CONFIG_PROP = "cassandra.config"; + + /** Prefix for file path syntax */ + private static final String FILE_PREFIX = "file:///"; + + /** Auto-injected logger instance. */ + @LoggerResource + private IgniteLogger log; + + /** Instance of embedded Cassandra database */ + private CassandraDaemon embeddedCassandraDaemon; + + /** JMX port for embedded Cassandra instance */ + private String jmxPort; + + /** YAML config file for embedded Cassandra */ + private String cassandraCfgFile; + + /** + * Returns JMX port for embedded Cassandra + * @return JMX port + */ + public String getJmxPort() { + return jmxPort; + } + + /** + * Setter for embedded Cassandra JMX port + * @param jmxPort embedded Cassandra JMX port + */ + public void setJmxPort(String jmxPort) { + this.jmxPort = jmxPort; + } + + /** + * Returns embedded Cassandra YAML config file + * @return YAML config file + */ + public String getCassandraConfigFile() { + return cassandraCfgFile; + } + + /** + * Setter for embedded Cassandra YAML config file + * @param cassandraCfgFile YAML config file + */ + public void setCassandraConfigFile(String cassandraCfgFile) { + this.cassandraCfgFile = cassandraCfgFile; + } + + /** {@inheritDoc} */ + @Override public void onLifecycleEvent(LifecycleEventType evt) { + if (evt == LifecycleEventType.BEFORE_NODE_START) + startEmbeddedCassandra(); + else if (evt == LifecycleEventType.BEFORE_NODE_STOP) + stopEmbeddedCassandra(); + } + + /** + * Starts embedded Cassandra instance + */ + private void startEmbeddedCassandra() { + if (log != null) { + log.info("-------------------------------"); + log.info("| Starting embedded Cassandra |"); + log.info("-------------------------------"); + } + + try { + if (jmxPort != null) + System.setProperty(CASSANDRA_JMX_PORT_PROP, jmxPort); + + if (cassandraCfgFile != null) + System.setProperty(CASSANDRA_CONFIG_PROP, FILE_PREFIX + cassandraCfgFile); + + embeddedCassandraDaemon = new CassandraDaemon(true); + embeddedCassandraDaemon.init(null); + embeddedCassandraDaemon.start(); + } + catch (Exception e) { + throw new RuntimeException("Failed to start embedded Cassandra", e); + } + + if (log != null) { + log.info("------------------------------"); + log.info("| Embedded Cassandra started |"); + log.info("------------------------------"); + } + } + + /** + * Stops embedded Cassandra instance + */ + private void stopEmbeddedCassandra() { + if (log != null) { + log.info("-------------------------------"); + log.info("| Stopping embedded Cassandra |"); + log.info("-------------------------------"); + } + + if (embeddedCassandraDaemon != null) { + try { + embeddedCassandraDaemon.deactivate(); + } + catch (Throwable e) { + throw new RuntimeException("Failed to stop embedded Cassandra", e); + } + } + + if (log != null) { + log.info("------------------------------"); + log.info("| Embedded Cassandra stopped |"); + log.info("------------------------------"); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraRegularCredentials.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraRegularCredentials.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraRegularCredentials.java new file mode 100644 index 0000000..7546c9b --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/CassandraRegularCredentials.java @@ -0,0 +1,38 @@ +/* + * 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.ignite.tests.utils; + +import org.apache.ignite.cache.store.cassandra.datasource.Credentials; + +/** + * Implementation of {@link Credentials} providing regular user/password to establish Cassandra session. + */ +public class CassandraRegularCredentials implements Credentials { + /** */ + private static final long serialVersionUID = 0L; + + /** {@inheritDoc} */ + @Override public String getUser() { + return CassandraHelper.getRegularUser(); + } + + /** {@inheritDoc} */ + @Override public String getPassword() { + return CassandraHelper.getRegularPassword(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestCacheSession.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestCacheSession.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestCacheSession.java new file mode 100644 index 0000000..1cedb7a --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestCacheSession.java @@ -0,0 +1,91 @@ +/* + * 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.ignite.tests.utils; + +import java.util.Map; +import org.apache.ignite.cache.store.CacheStoreSession; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.transactions.Transaction; +import org.jetbrains.annotations.Nullable; + +/** + * Test implementation of {@link CacheStoreSession} for the unit tests purposes + */ +public class TestCacheSession implements CacheStoreSession { + /** */ + private String cacheName; + + /** */ + private Transaction tx; + + /** */ + private Map props; + + /** */ + private Object attach; + + /** */ + public TestCacheSession(String cacheName) { + this.cacheName = cacheName; + } + + /** */ + @SuppressWarnings("UnusedDeclaration") + public void newSession(@Nullable Transaction tx) { + this.tx = tx; + props = null; + } + + /** {@inheritDoc} */ + @Nullable @Override public Transaction transaction() { + return tx; + } + + /** {@inheritDoc} */ + @Override public boolean isWithinTransaction() { + return transaction() != null; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override public Object attach(@Nullable Object attach) { + Object prev = this.attach; + this.attach = attach; + return prev; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Nullable @Override public T attachment() { + return (T) attach; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override public Map properties() { + if (props == null) + props = U.newHashMap(1); + + return (Map)props; + } + + /** {@inheritDoc} */ + @Nullable @Override public String cacheName() { + return cacheName; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestsHelper.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestsHelper.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestsHelper.java new file mode 100644 index 0000000..0bbda7f --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/TestsHelper.java @@ -0,0 +1,375 @@ +/* + * 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.ignite.tests.utils; + +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.ResourceBundle; +import org.apache.ignite.internal.processors.cache.CacheEntryImpl; +import org.apache.ignite.tests.load.Generator; +import org.apache.ignite.tests.pojos.Person; +import org.apache.ignite.tests.pojos.PersonId; +import org.springframework.core.io.ClassPathResource; + +/** + * Helper class for all tests + */ +public class TestsHelper { + /** */ + private static final String LETTERS_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + /** */ + private static final String NUMBERS_ALPHABET = "0123456789"; + + /** */ + private static final Random RANDOM = new Random(System.currentTimeMillis()); + + /** */ + private static final ResourceBundle TESTS_SETTINGS = ResourceBundle.getBundle("tests"); + + /** */ + private static final int BULK_OPERATION_SIZE = parseTestSettings("bulk.operation.size"); + + /** */ + private static final String LOAD_TESTS_CACHE_NAME = TESTS_SETTINGS.getString("load.tests.cache.name"); + + /** */ + private static final int LOAD_TESTS_THREADS_COUNT = parseTestSettings("load.tests.threads.count"); + + /** */ + private static final int LOAD_TESTS_WARMUP_PERIOD = parseTestSettings("load.tests.warmup.period"); + + /** */ + private static final int LOAD_TESTS_EXECUTION_TIME = parseTestSettings("load.tests.execution.time"); + + /** */ + private static final int LOAD_TESTS_REQUESTS_LATENCY = parseTestSettings("load.tests.requests.latency"); + + /** */ + private static final String LOAD_TESTS_PERSISTENCE_SETTINGS = TESTS_SETTINGS.getString("load.tests.persistence.settings"); + + /** */ + private static final String LOAD_TESTS_IGNITE_CONFIG = TESTS_SETTINGS.getString("load.tests.ignite.config"); + + /** */ + private static final Generator LOAD_TESTS_KEY_GENERATOR; + + /** */ + private static final Generator LOAD_TESTS_VALUE_GENERATOR; + + /** */ + private static int parseTestSettings(String name) { + return Integer.parseInt(TESTS_SETTINGS.getString(name)); + } + + static { + try { + LOAD_TESTS_KEY_GENERATOR = (Generator)Class.forName(TESTS_SETTINGS.getString("load.tests.key.generator")).newInstance(); + LOAD_TESTS_VALUE_GENERATOR = (Generator)Class.forName(TESTS_SETTINGS.getString("load.tests.value.generator")).newInstance(); + } + catch (Throwable e) { + throw new RuntimeException("Failed to initialize TestsHelper", e); + } + } + + /** */ + public static int getLoadTestsThreadsCount() { + return LOAD_TESTS_THREADS_COUNT; + } + + /** */ + public static int getLoadTestsWarmupPeriod() { + return LOAD_TESTS_WARMUP_PERIOD; + } + + /** */ + public static int getLoadTestsExecutionTime() { + return LOAD_TESTS_EXECUTION_TIME; + } + + /** */ + public static int getLoadTestsRequestsLatency() { + return LOAD_TESTS_REQUESTS_LATENCY; + } + + /** */ + public static ClassPathResource getLoadTestsPersistenceSettings() { + return new ClassPathResource(LOAD_TESTS_PERSISTENCE_SETTINGS); + } + + /** */ + public static String getLoadTestsIgniteConfig() { + return LOAD_TESTS_IGNITE_CONFIG; + } + + /** */ + public static int getBulkOperationSize() { + return BULK_OPERATION_SIZE; + } + + /** */ + public static String getLoadTestsCacheName() { + return LOAD_TESTS_CACHE_NAME; + } + + /** */ + public static Object generateLoadTestsKey(long i) { + return LOAD_TESTS_KEY_GENERATOR.generate(i); + } + + /** */ + public static Object generateLoadTestsValue(long i) { + return LOAD_TESTS_VALUE_GENERATOR.generate(i); + } + + /** */ + @SuppressWarnings("unchecked") + public static CacheEntryImpl generateLoadTestsEntry(long i) { + return new CacheEntryImpl(TestsHelper.generateLoadTestsKey(i), TestsHelper.generateLoadTestsValue(i)); + } + + /** */ + public static Collection getKeys(Collection> entries) { + List list = new LinkedList<>(); + + for (CacheEntryImpl entry : entries) + list.add(entry.getKey()); + + return list; + } + + /** */ + public static Map generateLongsMap() { + return generateLongsMap(BULK_OPERATION_SIZE); + } + + /** */ + public static Map generateLongsMap(int cnt) { + Map map = new HashMap<>(); + + for (long i = 0; i < cnt; i++) + map.put(i, i + 123); + + return map; + } + + /** */ + public static Collection> generateLongsEntries() { + return generateLongsEntries(BULK_OPERATION_SIZE); + } + + /** */ + public static Collection> generateLongsEntries(int cnt) { + Collection> entries = new LinkedList<>(); + + for (long i = 0; i < cnt; i++) + entries.add(new CacheEntryImpl<>(i, i + 123)); + + return entries; + } + + /** */ + public static Map generateStringsMap() { + return generateStringsMap(BULK_OPERATION_SIZE); + } + + /** */ + public static Map generateStringsMap(int cnt) { + Map map = new HashMap<>(); + + for (int i = 0; i < cnt; i++) + map.put(Integer.toString(i), randomString(5)); + + return map; + } + + /** */ + public static Collection> generateStringsEntries() { + return generateStringsEntries(BULK_OPERATION_SIZE); + } + + /** */ + public static Collection> generateStringsEntries(int cnt) { + Collection> entries = new LinkedList<>(); + + for (int i = 0; i < cnt; i++) + entries.add(new CacheEntryImpl<>(Integer.toString(i), randomString(5))); + + return entries; + } + + /** */ + public static Map generateLongsPersonsMap() { + Map map = new HashMap<>(); + + for (long i = 0; i < BULK_OPERATION_SIZE; i++) + map.put(i, generateRandomPerson()); + + return map; + } + + /** */ + public static Collection> generateLongsPersonsEntries() { + Collection> entries = new LinkedList<>(); + + for (long i = 0; i < BULK_OPERATION_SIZE; i++) + entries.add(new CacheEntryImpl<>(i, generateRandomPerson())); + + return entries; + } + + /** */ + public static Map generatePersonIdsPersonsMap() { + return generatePersonIdsPersonsMap(BULK_OPERATION_SIZE); + } + + /** */ + public static Map generatePersonIdsPersonsMap(int cnt) { + Map map = new HashMap<>(); + + for (int i = 0; i < cnt; i++) + map.put(generateRandomPersonId(), generateRandomPerson()); + + return map; + } + + /** */ + public static Collection> generatePersonIdsPersonsEntries() { + return generatePersonIdsPersonsEntries(BULK_OPERATION_SIZE); + } + + /** */ + public static Collection> generatePersonIdsPersonsEntries(int cnt) { + Collection> entries = new LinkedList<>(); + + for (int i = 0; i < cnt; i++) + entries.add(new CacheEntryImpl<>(generateRandomPersonId(), generateRandomPerson())); + + return entries; + } + + /** */ + public static Person generateRandomPerson() { + int phonesCnt = RANDOM.nextInt(4); + + List phones = new LinkedList<>(); + + for (int i = 0; i < phonesCnt; i++) + phones.add(randomNumber(4)); + + return new Person(randomString(4), randomString(4), RANDOM.nextInt(100), + RANDOM.nextBoolean(), RANDOM.nextLong(), RANDOM.nextFloat(), new Date(), phones); + } + + /** */ + public static PersonId generateRandomPersonId() { + return new PersonId(randomString(4), randomString(4), RANDOM.nextInt(100)); + } + + /** */ + public static boolean checkMapsEqual(Map map1, Map map2) { + if (map1 == null || map2 == null || map1.size() != map2.size()) + return false; + + for (Object key : map1.keySet()) { + Object obj1 = map1.get(key); + Object obj2 = map2.get(key); + + if (obj1 == null || obj2 == null || !obj1.equals(obj2)) + return false; + } + + return true; + } + + /** */ + public static boolean checkCollectionsEqual(Map map, Collection> col) { + if (map == null || col == null || map.size() != col.size()) + return false; + + for (CacheEntryImpl entry : col) { + if (!entry.getValue().equals(map.get(entry.getKey()))) + return false; + } + + return true; + } + + /** */ + public static boolean checkPersonMapsEqual(Map map1, Map map2, + boolean primitiveFieldsOnly) { + if (map1 == null || map2 == null || map1.size() != map2.size()) + return false; + + for (K key : map1.keySet()) { + Person person1 = map1.get(key); + Person person2 = map2.get(key); + + boolean equals = person1 != null && person2 != null && + (primitiveFieldsOnly ? person1.equalsPrimitiveFields(person2) : person1.equals(person2)); + + if (!equals) + return false; + } + + return true; + } + + /** */ + public static boolean checkPersonCollectionsEqual(Map map, Collection> col, + boolean primitiveFieldsOnly) { + if (map == null || col == null || map.size() != col.size()) + return false; + + for (CacheEntryImpl entry : col) { + boolean equals = primitiveFieldsOnly ? + entry.getValue().equalsPrimitiveFields(map.get(entry.getKey())) : + entry.getValue().equals(map.get(entry.getKey())); + + if (!equals) + return false; + } + + return true; + } + + /** */ + public static String randomString(int len) { + StringBuilder builder = new StringBuilder(len); + + for (int i = 0; i < len; i++) + builder.append(LETTERS_ALPHABET.charAt(RANDOM.nextInt(LETTERS_ALPHABET.length()))); + + return builder.toString(); + } + + /** */ + public static String randomNumber(int len) { + StringBuilder builder = new StringBuilder(len); + + for (int i = 0; i < len; i++) + builder.append(NUMBERS_ALPHABET.charAt(RANDOM.nextInt(NUMBERS_ALPHABET.length()))); + + return builder.toString(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/package-info.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/package-info.java b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/package-info.java new file mode 100644 index 0000000..4734e4a --- /dev/null +++ b/modules/cassandra/store/src/test/java/org/apache/ignite/tests/utils/package-info.java @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/** + * Contains utility classes for unit tests + */ +package org.apache.ignite.tests.utils; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/resources/log4j.properties b/modules/cassandra/store/src/test/resources/log4j.properties new file mode 100644 index 0000000..9c67be4 --- /dev/null +++ b/modules/cassandra/store/src/test/resources/log4j.properties @@ -0,0 +1,119 @@ +# 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. + +# Root logger option +log4j.rootLogger=INFO, stdout + +# Direct log messages to stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n + +# ------ LOAD TESTS LOGGING ------ + +# Cassandra load tests loggers +log4j.logger.CassandraLoadTests=INFO, stdout, cassandraLoadTests +log4j.logger.CassandraWriteLoadTest=INFO, csWrite +log4j.logger.CassandraBulkWriteLoadTest=INFO, csBulkWrite +log4j.logger.CassandraReadLoadTest=INFO, csRead +log4j.logger.CassandraBulkReadLoadTest=INFO, csBulkRead + +log4j.appender.cassandraLoadTests=org.apache.log4j.RollingFileAppender +log4j.appender.cassandraLoadTests.File=logs/cassandra-load-tests.log +log4j.appender.cassandraLoadTests.MaxFileSize=10MB +log4j.appender.cassandraLoadTests.MaxBackupIndex=10 +log4j.appender.cassandraLoadTests.Append=true +log4j.appender.cassandraLoadTests.layout=org.apache.log4j.PatternLayout +log4j.appender.cassandraLoadTests.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n + +log4j.appender.csWrite=org.apache.log4j.RollingFileAppender +log4j.appender.csWrite.File=logs/cassandra-write.log +log4j.appender.csWrite.MaxFileSize=10MB +log4j.appender.csWrite.MaxBackupIndex=10 +log4j.appender.csWrite.Append=true +log4j.appender.csWrite.layout=org.apache.log4j.PatternLayout +log4j.appender.csWrite.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n + +log4j.appender.csBulkWrite=org.apache.log4j.RollingFileAppender +log4j.appender.csBulkWrite.File=logs/cassandra-bulk-write.log +log4j.appender.csBulkWrite.MaxFileSize=10MB +log4j.appender.csBulkWrite.MaxBackupIndex=10 +log4j.appender.csBulkWrite.Append=true +log4j.appender.csBulkWrite.layout=org.apache.log4j.PatternLayout +log4j.appender.csBulkWrite.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n + +log4j.appender.csRead=org.apache.log4j.RollingFileAppender +log4j.appender.csRead.File=logs/cassandra-read.log +log4j.appender.csRead.MaxFileSize=10MB +log4j.appender.csRead.MaxBackupIndex=10 +log4j.appender.csRead.Append=true +log4j.appender.csRead.layout=org.apache.log4j.PatternLayout +log4j.appender.csRead.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n + +log4j.appender.csBulkRead=org.apache.log4j.RollingFileAppender +log4j.appender.csBulkRead.File=logs/cassandra-bulk-read.log +log4j.appender.csBulkRead.MaxFileSize=10MB +log4j.appender.csBulkRead.MaxBackupIndex=10 +log4j.appender.csBulkRead.Append=true +log4j.appender.csBulkRead.layout=org.apache.log4j.PatternLayout +log4j.appender.csBulkRead.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n + +# Ignite load tests loggers +log4j.logger.IgniteLoadTests=INFO, stdout, igniteLoadTests +log4j.logger.IgniteWriteLoadTest=INFO, igWrite +log4j.logger.IgniteBulkWriteLoadTest=INFO, igBulkWrite +log4j.logger.IgniteReadLoadTest=INFO, igRead +log4j.logger.IgniteBulkReadLoadTest=INFO, igBulkRead + +log4j.appender.igniteLoadTests=org.apache.log4j.RollingFileAppender +log4j.appender.igniteLoadTests.File=logs/ignite-load-tests.log +log4j.appender.igniteLoadTests.MaxFileSize=10MB +log4j.appender.igniteLoadTests.MaxBackupIndex=10 +log4j.appender.igniteLoadTests.Append=true +log4j.appender.igniteLoadTests.layout=org.apache.log4j.PatternLayout +log4j.appender.igniteLoadTests.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n + +log4j.appender.igWrite=org.apache.log4j.RollingFileAppender +log4j.appender.igWrite.File=logs/ignite-write.log +log4j.appender.igWrite.MaxFileSize=10MB +log4j.appender.igWrite.MaxBackupIndex=10 +log4j.appender.igWrite.Append=true +log4j.appender.igWrite.layout=org.apache.log4j.PatternLayout +log4j.appender.igWrite.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n + +log4j.appender.igBulkWrite=org.apache.log4j.RollingFileAppender +log4j.appender.igBulkWrite.File=logs/ignite-bulk-write.log +log4j.appender.igBulkWrite.MaxFileSize=10MB +log4j.appender.igBulkWrite.MaxBackupIndex=10 +log4j.appender.igBulkWrite.Append=true +log4j.appender.igBulkWrite.layout=org.apache.log4j.PatternLayout +log4j.appender.igBulkWrite.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n + +log4j.appender.igRead=org.apache.log4j.RollingFileAppender +log4j.appender.igRead.File=logs/ignite-read.log +log4j.appender.igRead.MaxFileSize=10MB +log4j.appender.igRead.MaxBackupIndex=10 +log4j.appender.igRead.Append=true +log4j.appender.igRead.layout=org.apache.log4j.PatternLayout +log4j.appender.igRead.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n + +log4j.appender.igBulkRead=org.apache.log4j.RollingFileAppender +log4j.appender.igBulkRead.File=logs/ignite-bulk-read.log +log4j.appender.igBulkRead.MaxFileSize=10MB +log4j.appender.igBulkRead.MaxBackupIndex=10 +log4j.appender.igBulkRead.Append=true +log4j.appender.igBulkRead.layout=org.apache.log4j.PatternLayout +log4j.appender.igBulkRead.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p [%t] - %m%n http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/connection-settings.xml ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/connection-settings.xml b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/connection-settings.xml new file mode 100644 index 0000000..aec602e --- /dev/null +++ b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/connection-settings.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/connection.properties ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/connection.properties b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/connection.properties new file mode 100644 index 0000000..ef15018 --- /dev/null +++ b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/connection.properties @@ -0,0 +1,17 @@ +# 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. + +# Comma delimited Cassandra contact points in format: host[:port] +contact.points=127.0.0.1 http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/credentials.properties ---------------------------------------------------------------------- diff --git a/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/credentials.properties b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/credentials.properties new file mode 100644 index 0000000..f011bcc --- /dev/null +++ b/modules/cassandra/store/src/test/resources/org/apache/ignite/tests/cassandra/credentials.properties @@ -0,0 +1,22 @@ +# 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. + +# Cassandra admin user/password +admin.user= +admin.password= + +# Cassandra regular user/password +regular.user= +regular.password=