Sha256: f65b8acdc83d943ae293f507caf86229cb6eccef4dcfae1a8c2b71112d396a9d

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

package <%=@package%>.integration.<%=@model_name.downcase%>;

/*
 * Copyright (c) 2015 <%=@user_name%>.
 * 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, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */

import <%=@package%>.model.<%=@model_name%>;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.stereotype.Component;



@Component
public class <%=@model_name%>SampleData {

  @Autowired
  MongoOperations mongoOperations;

  public void seed() {

    for (int i = 0; i < 10; i++) {
      <%=@model_name%> b = new <%=@model_name%>();
      b.setId(String.valueOf(i));
      mongoOperations.save(b);
    }
  }

  public void destroy() {
    mongoOperations.dropCollection("<%=@model_name%>");
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spring-gen-0.1.3 lib/templates/resource/test/integration/mongodb/SampleData.java.erb
spring-gen-0.1.2 lib/templates/resource/test/integration/mongodb/SampleData.java.erb