Skip to content

Commit

Permalink
#298 - CR updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewalch committed Nov 12, 2014
1 parent a172f09 commit 1290086
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static FluoAdmin newAdmin(Configuration configuration) {
*
* Configuration (see {@link FluoConfiguration}) should either contain the property io.fluo.mini.start.accumulo (set to true) to indicate that MiniFluo should
* start its own Accumulo instance or it should contain the following properties if it is connecting to an existing instance: io.fluo.client.accumulo.user,
* io.fluo.client.accumulo.password, io.fluo.client.accumulo.instance, io.fluo.admin.accumulo.table, io.fluo.admin.accumulo.classpath
* io.fluo.client.accumulo.password, io.fluo.client.accumulo.instance, io.fluo.admin.accumulo.table
*/
public static MiniFluo newMiniFluo(Configuration configuration) {
FluoConfiguration config = new FluoConfiguration(configuration);
Expand Down
66 changes: 66 additions & 0 deletions modules/core/src/test/java/io/fluo/core/impl/MiniIT.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright 2014 Fluo authors (see AUTHORS)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fluo.core.impl;

import java.io.File;

import com.google.common.io.Files;
import io.fluo.api.client.FluoClient;
import io.fluo.api.client.FluoFactory;
import io.fluo.api.client.Snapshot;
import io.fluo.api.client.Transaction;
import io.fluo.api.config.FluoConfiguration;
import io.fluo.api.data.Bytes;
import io.fluo.api.data.Column;
import io.fluo.api.mini.MiniFluo;
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.Test;

/**
* Tests MiniFluo
*/
public class MiniIT {

@Test
public void testMini() throws Exception {
File tempDir = Files.createTempDir();
try {
FluoConfiguration config = new FluoConfiguration();
config.setMiniDataDir(tempDir.getAbsolutePath());
config.setMiniStartAccumulo(true);
try (MiniFluo mini = FluoFactory.newMiniFluo(config)) {
try (FluoClient client = FluoFactory.newClient(mini.getClientConfiguration())) {
Assert.assertNotNull(client);
Assert.assertNotNull(client.newLoaderExecutor());

try (Transaction t = client.newTransaction()) {
Assert.assertNotNull(t);
t.set(Bytes.wrap("test"), new Column(Bytes.wrap("cf"), Bytes.wrap("cq")), Bytes.wrap("myval"));
t.commit();
}
try (Snapshot s = client.newSnapshot()) {
Assert.assertNotNull(s);
Bytes v = s.get(Bytes.wrap("test"), new Column(Bytes.wrap("cf"), Bytes.wrap("cq")));
Assert.assertEquals(Bytes.wrap("myval"), v);
}
}
}
} finally {
FileUtils.deleteDirectory(tempDir);
}
}
}

0 comments on commit 1290086

Please sign in to comment.