Moved static methods out of TableOperations.java and fixed junit

imports.
This commit is contained in:
john-mcpeek
2013-12-13 23:04:25 -05:00
parent 656d7c833e
commit d1769e2b96
9 changed files with 33 additions and 64 deletions

View File

@@ -63,4 +63,12 @@ public class AlterTableSpecification extends TableOptionsSpecification<AlterTabl
public List<ColumnChangeSpecification> getChanges() {
return Collections.unmodifiableList(changes);
}
/**
* Entry point into the {@link AlterTableSpecification}'s fluent API to alter a table. Convenient if imported
* statically.
*/
public static AlterTableSpecification alterTable() {
return new AlterTableSpecification();
}
}

View File

@@ -46,4 +46,12 @@ public class CreateTableSpecification extends TableSpecification<CreateTableSpec
public boolean getIfNotExists() {
return ifNotExists;
}
/**
* Entry point into the {@link CreateTableSpecification}'s fluent API to create a table. Convenient if imported
* statically.
*/
public static CreateTableSpecification createTable() {
return new CreateTableSpecification();
}
}

View File

@@ -36,4 +36,12 @@ public class DropTableSpecification extends TableNameSpecification<DropTableSpec
public boolean getIfExists() {
return ifExists;
}
/**
* Entry point into the {@link DropTableSpecification}'s fluent API to drop a table. Convenient if imported
* statically.
*/
public static DropTableSpecification dropTable() {
return new DropTableSpecification();
}
}

View File

@@ -1,49 +0,0 @@
/*
* Copyright 2011-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cassandra.core.keyspace;
/**
* Class that offers static methods as entry points into the fluent API for building create, drop and alter table
* specifications. These methods are most convenient when imported statically.
*
* @author Matthew T. Adams
*/
public class TableOperations {
/**
* Entry point into the {@link CreateTableSpecification}'s fluent API to create a table. Convenient if imported
* statically.
*/
public static CreateTableSpecification createTable() {
return new CreateTableSpecification();
}
/**
* Entry point into the {@link DropTableSpecification}'s fluent API to drop a table. Convenient if imported
* statically.
*/
public static DropTableSpecification dropTable() {
return new DropTableSpecification();
}
/**
* Entry point into the {@link AlterTableSpecification}'s fluent API to alter a table. Convenient if imported
* statically.
*/
public static AlterTableSpecification alterTable() {
return new AlterTableSpecification();
}
}

View File

@@ -1,7 +1,6 @@
package org.springframework.cassandra.test.unit.core.cql;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.*;
import static org.springframework.cassandra.core.cql.CqlStringUtils.isQuotedIdentifier;
import static org.springframework.cassandra.core.cql.CqlStringUtils.isUnquotedIdentifier;

View File

@@ -1,7 +1,6 @@
package org.springframework.cassandra.test.unit.core.cql.generator;
import static junit.framework.Assert.assertTrue;
import static org.springframework.cassandra.core.keyspace.TableOperations.alterTable;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.cassandra.core.cql.generator.AlterTableCqlGenerator;
@@ -46,7 +45,7 @@ public class AlterTableCqlGeneratorTests {
public String dropped = "dropped";
public AlterTableSpecification specification() {
return alterTable().name(name).alter(altered, alteredType).add(added, addedType).drop(dropped);
return AlterTableSpecification.alterTable().name(name).alter(altered, alteredType).add(added, addedType).drop(dropped);
}
public AlterTableCqlGenerator generator() {

View File

@@ -1,7 +1,6 @@
package org.springframework.cassandra.test.unit.core.cql.generator;
import static junit.framework.Assert.assertTrue;
import static org.springframework.cassandra.core.keyspace.TableOperations.createTable;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.cassandra.core.cql.generator.CreateTableCqlGenerator;
@@ -57,7 +56,7 @@ public class CreateTableCqlGeneratorTests {
public String column1 = "column1";
public CreateTableSpecification specification() {
return createTable().name(name).partitionKeyColumn(partitionKey0, partitionKeyType0).column(column1, columnType1);
return CreateTableSpecification.createTable().name(name).partitionKeyColumn(partitionKey0, partitionKeyType0).column(column1, columnType1);
}
@Test
@@ -82,7 +81,7 @@ public class CreateTableCqlGeneratorTests {
@Override
public CreateTableSpecification specification() {
return createTable().name(name).partitionKeyColumn(partKey0, partKeyType0)
return CreateTableSpecification.createTable().name(name).partitionKeyColumn(partKey0, partKeyType0)
.partitionKeyColumn(partKey1, partKeyType1).column(column0, columnType0);
}

View File

@@ -1,7 +1,6 @@
package org.springframework.cassandra.test.unit.core.cql.generator;
import static junit.framework.Assert.assertTrue;
import static org.springframework.cassandra.core.keyspace.TableOperations.dropTable;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.cassandra.core.cql.generator.DropTableCqlGenerator;
@@ -37,7 +36,7 @@ public class DropTableCqlGeneratorTests {
public String name = "mytable";
public DropTableSpecification specification() {
return dropTable().name(name);
return DropTableSpecification.dropTable().name(name);
}
public DropTableCqlGenerator generator() {

View File

@@ -1,8 +1,6 @@
package org.springframework.cassandra.test.unit.core.keyspace;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.*;
import java.lang.annotation.RetentionPolicy;