Add files using upload-large-folder tool
Browse files- projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/ignored_dir/ignored_module.ex +23 -0
- projects/ui/serena-new/test/resources/repos/elixir/test_repo/scripts/build_script.ex +26 -0
- projects/ui/serena-new/test/resources/repos/elixir/test_repo/test/models_test.exs +169 -0
- projects/ui/serena-new/test/resources/repos/elixir/test_repo/test/test_repo_test.exs +14 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/hello.erl +14 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/ignored_dir/ignored_module.erl +8 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/include/records.hrl +38 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/include/types.hrl +20 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/math_utils.erl +16 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/rebar.config +33 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/src/app.erl +117 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/src/models.erl +83 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/src/services.erl +146 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/src/utils.erl +135 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/test/models_tests.erl +77 -0
- projects/ui/serena-new/test/resources/repos/erlang/test_repo/test/utils_tests.erl +85 -0
- projects/ui/serena-new/test/resources/repos/go/test_repo/main.go +20 -0
- projects/ui/serena-new/test/resources/repos/java/test_repo/pom.xml +29 -0
- projects/ui/serena-new/test/resources/repos/java/test_repo/src/main/java/test_repo/Main.java +13 -0
- projects/ui/serena-new/test/resources/repos/java/test_repo/src/main/java/test_repo/Model.java +13 -0
projects/ui/serena-new/test/resources/repos/elixir/test_repo/lib/ignored_dir/ignored_module.ex
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defmodule TestRepo.IgnoredDir.IgnoredModule do
|
| 2 |
+
@moduledoc """
|
| 3 |
+
This module is in a directory that should be ignored by the language server.
|
| 4 |
+
It's used for testing directory filtering functionality.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
alias TestRepo.Models.User
|
| 8 |
+
|
| 9 |
+
@doc """
|
| 10 |
+
This function references the User model to test that ignored directories
|
| 11 |
+
don't show up in symbol references.
|
| 12 |
+
"""
|
| 13 |
+
def create_ignored_user do
|
| 14 |
+
User.new("ignored", "Ignored User", "ignored@example.com")
|
| 15 |
+
end
|
| 16 |
+
|
| 17 |
+
@doc """
|
| 18 |
+
Another function that uses models.
|
| 19 |
+
"""
|
| 20 |
+
def process_ignored_user(user) do
|
| 21 |
+
User.add_role(user, "ignored_role")
|
| 22 |
+
end
|
| 23 |
+
end
|
projects/ui/serena-new/test/resources/repos/elixir/test_repo/scripts/build_script.ex
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defmodule TestRepo.Scripts.BuildScript do
|
| 2 |
+
@moduledoc """
|
| 3 |
+
Build script that references models.
|
| 4 |
+
This is in the scripts directory which should be ignored in some tests.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
alias TestRepo.Models.{User, Item}
|
| 8 |
+
|
| 9 |
+
@doc """
|
| 10 |
+
Script function that creates test data.
|
| 11 |
+
"""
|
| 12 |
+
def create_test_data do
|
| 13 |
+
user = User.new("script_user", "Script User", "script@example.com")
|
| 14 |
+
item = Item.new("script_item", "Script Item", 1.0, "script")
|
| 15 |
+
|
| 16 |
+
{user, item}
|
| 17 |
+
end
|
| 18 |
+
|
| 19 |
+
@doc """
|
| 20 |
+
Another script function referencing User.
|
| 21 |
+
"""
|
| 22 |
+
def cleanup_users do
|
| 23 |
+
# This would reference User in a real scenario
|
| 24 |
+
IO.puts("Cleaning up users...")
|
| 25 |
+
end
|
| 26 |
+
end
|
projects/ui/serena-new/test/resources/repos/elixir/test_repo/test/models_test.exs
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defmodule TestRepo.ModelsTest do
|
| 2 |
+
use ExUnit.Case
|
| 3 |
+
doctest TestRepo.Models
|
| 4 |
+
|
| 5 |
+
alias TestRepo.Models.{User, Item, Order, Serializable}
|
| 6 |
+
|
| 7 |
+
describe "User" do
|
| 8 |
+
test "creates a new user with default roles" do
|
| 9 |
+
user = User.new("1", "Alice", "alice@example.com")
|
| 10 |
+
|
| 11 |
+
assert user.id == "1"
|
| 12 |
+
assert user.name == "Alice"
|
| 13 |
+
assert user.email == "alice@example.com"
|
| 14 |
+
assert user.roles == []
|
| 15 |
+
end
|
| 16 |
+
|
| 17 |
+
test "creates a user with specified roles" do
|
| 18 |
+
user = User.new("2", "Bob", "bob@example.com", ["admin", "user"])
|
| 19 |
+
|
| 20 |
+
assert user.roles == ["admin", "user"]
|
| 21 |
+
end
|
| 22 |
+
|
| 23 |
+
test "checks if user has role" do
|
| 24 |
+
user = User.new("3", "Charlie", "charlie@example.com", ["admin"])
|
| 25 |
+
|
| 26 |
+
assert User.has_role?(user, "admin")
|
| 27 |
+
refute User.has_role?(user, "guest")
|
| 28 |
+
end
|
| 29 |
+
|
| 30 |
+
test "adds role to user" do
|
| 31 |
+
user = User.new("4", "David", "david@example.com")
|
| 32 |
+
user_with_role = User.add_role(user, "moderator")
|
| 33 |
+
|
| 34 |
+
assert User.has_role?(user_with_role, "moderator")
|
| 35 |
+
assert length(user_with_role.roles) == 1
|
| 36 |
+
end
|
| 37 |
+
end
|
| 38 |
+
|
| 39 |
+
describe "Item" do
|
| 40 |
+
test "creates a new item" do
|
| 41 |
+
item = Item.new("widget1", "Super Widget", 19.99, "electronics")
|
| 42 |
+
|
| 43 |
+
assert item.id == "widget1"
|
| 44 |
+
assert item.name == "Super Widget"
|
| 45 |
+
assert item.price == 19.99
|
| 46 |
+
assert item.category == "electronics"
|
| 47 |
+
end
|
| 48 |
+
|
| 49 |
+
test "formats price for display" do
|
| 50 |
+
item = Item.new("item1", "Test Item", 29.99, "test")
|
| 51 |
+
|
| 52 |
+
assert Item.display_price(item) == "$29.99"
|
| 53 |
+
end
|
| 54 |
+
|
| 55 |
+
test "checks if item is in category" do
|
| 56 |
+
item = Item.new("book1", "Elixir Book", 39.99, "books")
|
| 57 |
+
|
| 58 |
+
assert Item.in_category?(item, "books")
|
| 59 |
+
refute Item.in_category?(item, "electronics")
|
| 60 |
+
end
|
| 61 |
+
end
|
| 62 |
+
|
| 63 |
+
describe "Order" do
|
| 64 |
+
setup do
|
| 65 |
+
user = User.new("customer1", "Customer", "customer@example.com")
|
| 66 |
+
item1 = Item.new("item1", "Item 1", 10.00, "category1")
|
| 67 |
+
item2 = Item.new("item2", "Item 2", 20.00, "category2")
|
| 68 |
+
|
| 69 |
+
%{user: user, item1: item1, item2: item2}
|
| 70 |
+
end
|
| 71 |
+
|
| 72 |
+
test "creates a new order", %{user: user} do
|
| 73 |
+
order = Order.new("order1", user)
|
| 74 |
+
|
| 75 |
+
assert order.id == "order1"
|
| 76 |
+
assert order.user == user
|
| 77 |
+
assert order.items == []
|
| 78 |
+
assert order.total == 0.0
|
| 79 |
+
assert order.status == :pending
|
| 80 |
+
end
|
| 81 |
+
|
| 82 |
+
test "creates order with items", %{user: user, item1: item1, item2: item2} do
|
| 83 |
+
order = Order.new("order2", user, [item1, item2])
|
| 84 |
+
|
| 85 |
+
assert length(order.items) == 2
|
| 86 |
+
assert order.total == 30.0
|
| 87 |
+
end
|
| 88 |
+
|
| 89 |
+
test "adds item to order", %{user: user, item1: item1, item2: item2} do
|
| 90 |
+
order = Order.new("order3", user, [item1])
|
| 91 |
+
order_with_item = Order.add_item(order, item2)
|
| 92 |
+
|
| 93 |
+
assert length(order_with_item.items) == 2
|
| 94 |
+
assert order_with_item.total == 30.0
|
| 95 |
+
end
|
| 96 |
+
|
| 97 |
+
test "updates order status", %{user: user} do
|
| 98 |
+
order = Order.new("order4", user)
|
| 99 |
+
processed_order = Order.update_status(order, :processing)
|
| 100 |
+
|
| 101 |
+
assert processed_order.status == :processing
|
| 102 |
+
end
|
| 103 |
+
end
|
| 104 |
+
|
| 105 |
+
describe "Serializable protocol" do
|
| 106 |
+
test "serializes User" do
|
| 107 |
+
user = User.new("1", "Alice", "alice@example.com", ["admin"])
|
| 108 |
+
serialized = Serializable.to_map(user)
|
| 109 |
+
|
| 110 |
+
expected = %{
|
| 111 |
+
id: "1",
|
| 112 |
+
name: "Alice",
|
| 113 |
+
email: "alice@example.com",
|
| 114 |
+
roles: ["admin"]
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
assert serialized == expected
|
| 118 |
+
end
|
| 119 |
+
|
| 120 |
+
test "serializes Item" do
|
| 121 |
+
item = Item.new("widget1", "Widget", 19.99, "electronics")
|
| 122 |
+
serialized = Serializable.to_map(item)
|
| 123 |
+
|
| 124 |
+
expected = %{
|
| 125 |
+
id: "widget1",
|
| 126 |
+
name: "Widget",
|
| 127 |
+
price: 19.99,
|
| 128 |
+
category: "electronics"
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
assert serialized == expected
|
| 132 |
+
end
|
| 133 |
+
|
| 134 |
+
test "serializes Order" do
|
| 135 |
+
user = User.new("1", "Alice", "alice@example.com")
|
| 136 |
+
item = Item.new("widget1", "Widget", 19.99, "electronics")
|
| 137 |
+
order = Order.new("order1", user, [item])
|
| 138 |
+
|
| 139 |
+
serialized = Serializable.to_map(order)
|
| 140 |
+
|
| 141 |
+
assert serialized.id == "order1"
|
| 142 |
+
assert serialized.total == 19.99
|
| 143 |
+
assert serialized.status == :pending
|
| 144 |
+
assert is_map(serialized.user)
|
| 145 |
+
assert is_list(serialized.items)
|
| 146 |
+
assert length(serialized.items) == 1
|
| 147 |
+
end
|
| 148 |
+
end
|
| 149 |
+
|
| 150 |
+
describe "factory functions" do
|
| 151 |
+
test "creates sample user" do
|
| 152 |
+
user = TestRepo.Models.create_sample_user()
|
| 153 |
+
|
| 154 |
+
assert user.id == "sample"
|
| 155 |
+
assert user.name == "Sample User"
|
| 156 |
+
assert user.email == "sample@example.com"
|
| 157 |
+
assert "user" in user.roles
|
| 158 |
+
end
|
| 159 |
+
|
| 160 |
+
test "creates sample item" do
|
| 161 |
+
item = TestRepo.Models.create_sample_item()
|
| 162 |
+
|
| 163 |
+
assert item.id == "sample"
|
| 164 |
+
assert item.name == "Sample Item"
|
| 165 |
+
assert item.price == 9.99
|
| 166 |
+
assert item.category == "sample"
|
| 167 |
+
end
|
| 168 |
+
end
|
| 169 |
+
end
|
projects/ui/serena-new/test/resources/repos/elixir/test_repo/test/test_repo_test.exs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defmodule TestRepoTest do
|
| 2 |
+
use ExUnit.Case
|
| 3 |
+
doctest TestRepo
|
| 4 |
+
|
| 5 |
+
test "greets the world" do
|
| 6 |
+
assert TestRepo.hello() == :world
|
| 7 |
+
end
|
| 8 |
+
|
| 9 |
+
test "adds numbers correctly" do
|
| 10 |
+
assert TestRepo.add(2, 3) == 5
|
| 11 |
+
assert TestRepo.add(-1, 1) == 0
|
| 12 |
+
assert TestRepo.add(0, 0) == 0
|
| 13 |
+
end
|
| 14 |
+
end
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/hello.erl
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-module(hello).
|
| 2 |
+
-export([hello_world/0, greet/1, calculate_sum/2]).
|
| 3 |
+
|
| 4 |
+
%% Simple hello world function
|
| 5 |
+
hello_world() ->
|
| 6 |
+
io:format("Hello, World!~n").
|
| 7 |
+
|
| 8 |
+
%% Greet a person by name
|
| 9 |
+
greet(Name) ->
|
| 10 |
+
io:format("Hello, ~s!~n", [Name]).
|
| 11 |
+
|
| 12 |
+
%% Calculate sum of two numbers
|
| 13 |
+
calculate_sum(A, B) ->
|
| 14 |
+
A + B.
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/ignored_dir/ignored_module.erl
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% This module should be ignored by tests
|
| 2 |
+
-module(ignored_module).
|
| 3 |
+
|
| 4 |
+
%% This is in the ignored directory and should not be processed
|
| 5 |
+
-export([ignored_function/0]).
|
| 6 |
+
|
| 7 |
+
ignored_function() ->
|
| 8 |
+
"This should not appear in symbol searches".
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/include/records.hrl
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% Common record definitions for the test repository
|
| 2 |
+
-ifndef(RECORDS_HRL).
|
| 3 |
+
-define(RECORDS_HRL, true).
|
| 4 |
+
|
| 5 |
+
%% User record definition
|
| 6 |
+
-record(user, {
|
| 7 |
+
id :: integer(),
|
| 8 |
+
name :: string(),
|
| 9 |
+
email :: string(),
|
| 10 |
+
age :: integer(),
|
| 11 |
+
active = true :: boolean()
|
| 12 |
+
}).
|
| 13 |
+
|
| 14 |
+
%% Order record definition
|
| 15 |
+
-record(order, {
|
| 16 |
+
id :: integer(),
|
| 17 |
+
user_id :: integer(),
|
| 18 |
+
items = [] :: list(),
|
| 19 |
+
total :: float(),
|
| 20 |
+
status = pending :: pending | processing | completed | cancelled
|
| 21 |
+
}).
|
| 22 |
+
|
| 23 |
+
%% Item record definition
|
| 24 |
+
-record(item, {
|
| 25 |
+
id :: integer(),
|
| 26 |
+
name :: string(),
|
| 27 |
+
price :: float(),
|
| 28 |
+
category :: string()
|
| 29 |
+
}).
|
| 30 |
+
|
| 31 |
+
%% Configuration record
|
| 32 |
+
-record(config, {
|
| 33 |
+
database_url :: string(),
|
| 34 |
+
port :: integer(),
|
| 35 |
+
debug = false :: boolean()
|
| 36 |
+
}).
|
| 37 |
+
|
| 38 |
+
-endif.
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/include/types.hrl
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% Type definitions for the test repository
|
| 2 |
+
-ifndef(TYPES_HRL).
|
| 3 |
+
-define(TYPES_HRL, true).
|
| 4 |
+
|
| 5 |
+
%% Custom types
|
| 6 |
+
-type user_id() :: pos_integer().
|
| 7 |
+
-type email() :: string().
|
| 8 |
+
-type status() :: active | inactive | suspended.
|
| 9 |
+
-type price() :: float().
|
| 10 |
+
-type quantity() :: non_neg_integer().
|
| 11 |
+
|
| 12 |
+
%% Complex types
|
| 13 |
+
-type order_line() :: {item_id :: pos_integer(), quantity :: quantity(), price :: price()}.
|
| 14 |
+
-type search_result() :: {ok, list()} | {error, term()}.
|
| 15 |
+
|
| 16 |
+
%% Callback types for behaviors
|
| 17 |
+
-type init_result() :: {ok, term()} | {stop, term()}.
|
| 18 |
+
-type handle_call_result() :: {reply, term(), term()} | {stop, term(), term()}.
|
| 19 |
+
|
| 20 |
+
-endif.
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/math_utils.erl
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-module(math_utils).
|
| 2 |
+
-export([add/2, multiply/2, factorial/1]).
|
| 3 |
+
|
| 4 |
+
%% Add two numbers
|
| 5 |
+
add(X, Y) ->
|
| 6 |
+
X + Y.
|
| 7 |
+
|
| 8 |
+
%% Multiply two numbers
|
| 9 |
+
multiply(X, Y) ->
|
| 10 |
+
X * Y.
|
| 11 |
+
|
| 12 |
+
%% Calculate factorial
|
| 13 |
+
factorial(0) ->
|
| 14 |
+
1;
|
| 15 |
+
factorial(N) when N > 0 ->
|
| 16 |
+
N * factorial(N - 1).
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/rebar.config
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% Rebar3 configuration for test repository
|
| 2 |
+
{erl_opts, [
|
| 3 |
+
debug_info,
|
| 4 |
+
warnings_as_errors,
|
| 5 |
+
warn_export_all,
|
| 6 |
+
warn_unused_import,
|
| 7 |
+
{i, "include"}
|
| 8 |
+
]}.
|
| 9 |
+
|
| 10 |
+
{deps, [
|
| 11 |
+
{eunit, ".*", {git, "https://github.com/richcarl/eunit.git", {tag, "2.3.6"}}}
|
| 12 |
+
]}.
|
| 13 |
+
|
| 14 |
+
{profiles, [
|
| 15 |
+
{test, [
|
| 16 |
+
{erl_opts, [debug_info]},
|
| 17 |
+
{deps, [
|
| 18 |
+
{proper, "1.3.0"}
|
| 19 |
+
]}
|
| 20 |
+
]}
|
| 21 |
+
]}.
|
| 22 |
+
|
| 23 |
+
{cover_enabled, true}.
|
| 24 |
+
{cover_print_enabled, true}.
|
| 25 |
+
|
| 26 |
+
{dialyzer, [
|
| 27 |
+
{warnings, [
|
| 28 |
+
unmatched_returns,
|
| 29 |
+
error_handling,
|
| 30 |
+
race_conditions,
|
| 31 |
+
underspecs
|
| 32 |
+
]}
|
| 33 |
+
]}.
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/src/app.erl
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% Main application module
|
| 2 |
+
-module(app).
|
| 3 |
+
-behaviour(application).
|
| 4 |
+
-include("../include/records.hrl").
|
| 5 |
+
|
| 6 |
+
%% Application callbacks
|
| 7 |
+
-export([
|
| 8 |
+
start/2,
|
| 9 |
+
stop/1
|
| 10 |
+
]).
|
| 11 |
+
|
| 12 |
+
%% API exports
|
| 13 |
+
-export([
|
| 14 |
+
start_services/0,
|
| 15 |
+
stop_services/0,
|
| 16 |
+
get_config/0,
|
| 17 |
+
health_check/0
|
| 18 |
+
]).
|
| 19 |
+
|
| 20 |
+
%%%===================================================================
|
| 21 |
+
%%% Application callbacks
|
| 22 |
+
%%%===================================================================
|
| 23 |
+
|
| 24 |
+
-spec start(application:start_type(), term()) -> {ok, pid()} | {error, term()}.
|
| 25 |
+
start(_StartType, _StartArgs) ->
|
| 26 |
+
io:format("Starting test application~n"),
|
| 27 |
+
case start_services() of
|
| 28 |
+
ok ->
|
| 29 |
+
supervisor:start_link({local, app_sup}, ?MODULE, []);
|
| 30 |
+
{error, Reason} ->
|
| 31 |
+
{error, Reason}
|
| 32 |
+
end.
|
| 33 |
+
|
| 34 |
+
-spec stop(term()) -> ok.
|
| 35 |
+
stop(_State) ->
|
| 36 |
+
io:format("Stopping test application~n"),
|
| 37 |
+
stop_services(),
|
| 38 |
+
ok.
|
| 39 |
+
|
| 40 |
+
%%%===================================================================
|
| 41 |
+
%%% API functions
|
| 42 |
+
%%%===================================================================
|
| 43 |
+
|
| 44 |
+
-spec start_services() -> ok | {error, term()}.
|
| 45 |
+
start_services() ->
|
| 46 |
+
try
|
| 47 |
+
{ok, _Pid} = services:start_link(),
|
| 48 |
+
io:format("Services started successfully~n"),
|
| 49 |
+
ok
|
| 50 |
+
catch
|
| 51 |
+
error:Reason ->
|
| 52 |
+
io:format("Failed to start services: ~p~n", [Reason]),
|
| 53 |
+
{error, Reason}
|
| 54 |
+
end.
|
| 55 |
+
|
| 56 |
+
-spec stop_services() -> ok.
|
| 57 |
+
stop_services() ->
|
| 58 |
+
try
|
| 59 |
+
services:stop(),
|
| 60 |
+
io:format("Services stopped successfully~n"),
|
| 61 |
+
ok
|
| 62 |
+
catch
|
| 63 |
+
error:Reason ->
|
| 64 |
+
io:format("Error stopping services: ~p~n", [Reason]),
|
| 65 |
+
ok
|
| 66 |
+
end.
|
| 67 |
+
|
| 68 |
+
-spec get_config() -> #config{}.
|
| 69 |
+
get_config() ->
|
| 70 |
+
#config{
|
| 71 |
+
database_url = "postgresql://localhost:5432/testdb",
|
| 72 |
+
port = 8080,
|
| 73 |
+
debug = true
|
| 74 |
+
}.
|
| 75 |
+
|
| 76 |
+
-spec health_check() -> {ok, #{atom() => term()}} | {error, term()}.
|
| 77 |
+
health_check() ->
|
| 78 |
+
try
|
| 79 |
+
Stats = services:get_statistics(),
|
| 80 |
+
Config = get_config(),
|
| 81 |
+
HealthInfo = #{
|
| 82 |
+
status => healthy,
|
| 83 |
+
timestamp => utils:timestamp(),
|
| 84 |
+
config => Config,
|
| 85 |
+
statistics => Stats,
|
| 86 |
+
uptime => erlang:statistics(wall_clock)
|
| 87 |
+
},
|
| 88 |
+
{ok, HealthInfo}
|
| 89 |
+
catch
|
| 90 |
+
error:Reason ->
|
| 91 |
+
{error, {health_check_failed, Reason}}
|
| 92 |
+
end.
|
| 93 |
+
|
| 94 |
+
%%%===================================================================
|
| 95 |
+
%%% Supervisor callbacks (simple implementation)
|
| 96 |
+
%%%===================================================================
|
| 97 |
+
|
| 98 |
+
init([]) ->
|
| 99 |
+
%% Simple supervisor strategy
|
| 100 |
+
SupFlags = #{
|
| 101 |
+
strategy => one_for_one,
|
| 102 |
+
intensity => 5,
|
| 103 |
+
period => 10
|
| 104 |
+
},
|
| 105 |
+
|
| 106 |
+
ChildSpecs = [
|
| 107 |
+
#{
|
| 108 |
+
id => services,
|
| 109 |
+
start => {services, start_link, []},
|
| 110 |
+
restart => permanent,
|
| 111 |
+
shutdown => 5000,
|
| 112 |
+
type => worker,
|
| 113 |
+
modules => [services]
|
| 114 |
+
}
|
| 115 |
+
],
|
| 116 |
+
|
| 117 |
+
{ok, {SupFlags, ChildSpecs}}.
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/src/models.erl
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% Models module with record operations and business logic
|
| 2 |
+
-module(models).
|
| 3 |
+
-include("../include/records.hrl").
|
| 4 |
+
-include("../include/types.hrl").
|
| 5 |
+
|
| 6 |
+
%% Export functions
|
| 7 |
+
-export([
|
| 8 |
+
create_user/4,
|
| 9 |
+
update_user/2,
|
| 10 |
+
get_user_by_id/1,
|
| 11 |
+
create_order/3,
|
| 12 |
+
add_item_to_order/3,
|
| 13 |
+
calculate_order_total/1,
|
| 14 |
+
validate_email/1,
|
| 15 |
+
format_user_info/1
|
| 16 |
+
]).
|
| 17 |
+
|
| 18 |
+
%% User operations
|
| 19 |
+
-spec create_user(integer(), string(), email(), integer()) -> #user{}.
|
| 20 |
+
create_user(Id, Name, Email, Age) ->
|
| 21 |
+
#user{
|
| 22 |
+
id = Id,
|
| 23 |
+
name = Name,
|
| 24 |
+
email = Email,
|
| 25 |
+
age = Age,
|
| 26 |
+
active = true
|
| 27 |
+
}.
|
| 28 |
+
|
| 29 |
+
-spec update_user(#user{}, [{atom(), term()}]) -> #user{}.
|
| 30 |
+
update_user(User, Updates) ->
|
| 31 |
+
lists:foldl(fun update_user_field/2, User, Updates).
|
| 32 |
+
|
| 33 |
+
-spec get_user_by_id(user_id()) -> {ok, #user{}} | {error, not_found}.
|
| 34 |
+
get_user_by_id(Id) ->
|
| 35 |
+
%% Simulate database lookup
|
| 36 |
+
case Id of
|
| 37 |
+
1 -> {ok, create_user(1, "John Doe", "john@example.com", 30)};
|
| 38 |
+
2 -> {ok, create_user(2, "Jane Smith", "jane@example.com", 25)};
|
| 39 |
+
_ -> {error, not_found}
|
| 40 |
+
end.
|
| 41 |
+
|
| 42 |
+
%% Order operations
|
| 43 |
+
-spec create_order(integer(), user_id(), list()) -> #order{}.
|
| 44 |
+
create_order(Id, UserId, Items) ->
|
| 45 |
+
#order{
|
| 46 |
+
id = Id,
|
| 47 |
+
user_id = UserId,
|
| 48 |
+
items = Items,
|
| 49 |
+
total = 0.0,
|
| 50 |
+
status = pending
|
| 51 |
+
}.
|
| 52 |
+
|
| 53 |
+
-spec add_item_to_order(#order{}, #item{}, quantity()) -> #order{}.
|
| 54 |
+
add_item_to_order(Order, Item, Quantity) ->
|
| 55 |
+
NewItem = Item#item{id = Quantity}, % Store quantity in id field for simplicity
|
| 56 |
+
Order#order{items = [NewItem | Order#order.items]}.
|
| 57 |
+
|
| 58 |
+
-spec calculate_order_total(#order{}) -> float().
|
| 59 |
+
calculate_order_total(#order{items = Items}) ->
|
| 60 |
+
lists:foldl(fun(#item{price = Price, id = Qty}, Acc) ->
|
| 61 |
+
Acc + (Price * Qty)
|
| 62 |
+
end, 0.0, Items).
|
| 63 |
+
|
| 64 |
+
%% Helper functions
|
| 65 |
+
-spec update_user_field({atom(), term()}, #user{}) -> #user{}.
|
| 66 |
+
update_user_field({name, Name}, User) -> User#user{name = Name};
|
| 67 |
+
update_user_field({email, Email}, User) -> User#user{email = Email};
|
| 68 |
+
update_user_field({age, Age}, User) -> User#user{age = Age};
|
| 69 |
+
update_user_field({active, Active}, User) -> User#user{active = Active};
|
| 70 |
+
update_user_field(_, User) -> User.
|
| 71 |
+
|
| 72 |
+
-spec validate_email(string()) -> boolean().
|
| 73 |
+
validate_email(Email) ->
|
| 74 |
+
string:str(Email, "@") > 0 andalso string:str(Email, ".") > 0.
|
| 75 |
+
|
| 76 |
+
-spec format_user_info(#user{}) -> string().
|
| 77 |
+
format_user_info(#user{name = Name, email = Email, age = Age, active = Active}) ->
|
| 78 |
+
Status = case Active of
|
| 79 |
+
true -> "active";
|
| 80 |
+
false -> "inactive"
|
| 81 |
+
end,
|
| 82 |
+
lists:flatten(io_lib:format("~s (~s) - Age: ~w - Status: ~s",
|
| 83 |
+
[Name, Email, Age, Status])).
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/src/services.erl
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% Services module implementing gen_server behavior
|
| 2 |
+
-module(services).
|
| 3 |
+
-behaviour(gen_server).
|
| 4 |
+
-include("../include/records.hrl").
|
| 5 |
+
-include("../include/types.hrl").
|
| 6 |
+
|
| 7 |
+
%% API exports
|
| 8 |
+
-export([
|
| 9 |
+
start_link/0,
|
| 10 |
+
stop/0,
|
| 11 |
+
register_user/4,
|
| 12 |
+
get_user/1,
|
| 13 |
+
create_order/2,
|
| 14 |
+
update_order_status/2,
|
| 15 |
+
get_statistics/0
|
| 16 |
+
]).
|
| 17 |
+
|
| 18 |
+
%% gen_server callbacks
|
| 19 |
+
-export([
|
| 20 |
+
init/1,
|
| 21 |
+
handle_call/3,
|
| 22 |
+
handle_cast/2,
|
| 23 |
+
handle_info/2,
|
| 24 |
+
terminate/2,
|
| 25 |
+
code_change/3
|
| 26 |
+
]).
|
| 27 |
+
|
| 28 |
+
%% State record
|
| 29 |
+
-record(state, {
|
| 30 |
+
users = #{} :: map(),
|
| 31 |
+
orders = #{} :: map(),
|
| 32 |
+
next_user_id = 1 :: integer(),
|
| 33 |
+
next_order_id = 1 :: integer()
|
| 34 |
+
}).
|
| 35 |
+
|
| 36 |
+
%%%===================================================================
|
| 37 |
+
%%% API
|
| 38 |
+
%%%===================================================================
|
| 39 |
+
|
| 40 |
+
-spec start_link() -> {ok, pid()} | ignore | {error, term()}.
|
| 41 |
+
start_link() ->
|
| 42 |
+
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
|
| 43 |
+
|
| 44 |
+
-spec stop() -> ok.
|
| 45 |
+
stop() ->
|
| 46 |
+
gen_server:stop(?MODULE).
|
| 47 |
+
|
| 48 |
+
-spec register_user(string(), email(), integer(), boolean()) -> {ok, user_id()} | {error, term()}.
|
| 49 |
+
register_user(Name, Email, Age, Active) ->
|
| 50 |
+
gen_server:call(?MODULE, {register_user, Name, Email, Age, Active}).
|
| 51 |
+
|
| 52 |
+
-spec get_user(user_id()) -> {ok, #user{}} | {error, not_found}.
|
| 53 |
+
get_user(UserId) ->
|
| 54 |
+
gen_server:call(?MODULE, {get_user, UserId}).
|
| 55 |
+
|
| 56 |
+
-spec create_order(user_id(), list()) -> {ok, integer()} | {error, term()}.
|
| 57 |
+
create_order(UserId, Items) ->
|
| 58 |
+
gen_server:call(?MODULE, {create_order, UserId, Items}).
|
| 59 |
+
|
| 60 |
+
-spec update_order_status(integer(), atom()) -> ok | {error, term()}.
|
| 61 |
+
update_order_status(OrderId, Status) ->
|
| 62 |
+
gen_server:call(?MODULE, {update_order_status, OrderId, Status}).
|
| 63 |
+
|
| 64 |
+
-spec get_statistics() -> #{atom() => integer()}.
|
| 65 |
+
get_statistics() ->
|
| 66 |
+
gen_server:call(?MODULE, get_statistics).
|
| 67 |
+
|
| 68 |
+
%%%===================================================================
|
| 69 |
+
%%% gen_server callbacks
|
| 70 |
+
%%%===================================================================
|
| 71 |
+
|
| 72 |
+
-spec init([]) -> {ok, #state{}}.
|
| 73 |
+
init([]) ->
|
| 74 |
+
{ok, #state{}}.
|
| 75 |
+
|
| 76 |
+
-spec handle_call(term(), {pid(), term()}, #state{}) -> handle_call_result().
|
| 77 |
+
handle_call({register_user, Name, Email, Age, Active}, _From, State) ->
|
| 78 |
+
UserId = State#state.next_user_id,
|
| 79 |
+
User = models:create_user(UserId, Name, Email, Age),
|
| 80 |
+
UpdatedUser = models:update_user(User, [{active, Active}]),
|
| 81 |
+
NewUsers = maps:put(UserId, UpdatedUser, State#state.users),
|
| 82 |
+
NewState = State#state{
|
| 83 |
+
users = NewUsers,
|
| 84 |
+
next_user_id = UserId + 1
|
| 85 |
+
},
|
| 86 |
+
{reply, {ok, UserId}, NewState};
|
| 87 |
+
|
| 88 |
+
handle_call({get_user, UserId}, _From, State) ->
|
| 89 |
+
case maps:get(UserId, State#state.users, not_found) of
|
| 90 |
+
not_found -> {reply, {error, not_found}, State};
|
| 91 |
+
User -> {reply, {ok, User}, State}
|
| 92 |
+
end;
|
| 93 |
+
|
| 94 |
+
handle_call({create_order, UserId, Items}, _From, State) ->
|
| 95 |
+
case maps:get(UserId, State#state.users, not_found) of
|
| 96 |
+
not_found ->
|
| 97 |
+
{reply, {error, user_not_found}, State};
|
| 98 |
+
_User ->
|
| 99 |
+
OrderId = State#state.next_order_id,
|
| 100 |
+
Order = models:create_order(OrderId, UserId, Items),
|
| 101 |
+
NewOrders = maps:put(OrderId, Order, State#state.orders),
|
| 102 |
+
NewState = State#state{
|
| 103 |
+
orders = NewOrders,
|
| 104 |
+
next_order_id = OrderId + 1
|
| 105 |
+
},
|
| 106 |
+
{reply, {ok, OrderId}, NewState}
|
| 107 |
+
end;
|
| 108 |
+
|
| 109 |
+
handle_call({update_order_status, OrderId, Status}, _From, State) ->
|
| 110 |
+
case maps:get(OrderId, State#state.orders, not_found) of
|
| 111 |
+
not_found ->
|
| 112 |
+
{reply, {error, order_not_found}, State};
|
| 113 |
+
Order ->
|
| 114 |
+
UpdatedOrder = Order#order{status = Status},
|
| 115 |
+
NewOrders = maps:put(OrderId, UpdatedOrder, State#state.orders),
|
| 116 |
+
NewState = State#state{orders = NewOrders},
|
| 117 |
+
{reply, ok, NewState}
|
| 118 |
+
end;
|
| 119 |
+
|
| 120 |
+
handle_call(get_statistics, _From, State) ->
|
| 121 |
+
Stats = #{
|
| 122 |
+
total_users => maps:size(State#state.users),
|
| 123 |
+
total_orders => maps:size(State#state.orders),
|
| 124 |
+
next_user_id => State#state.next_user_id,
|
| 125 |
+
next_order_id => State#state.next_order_id
|
| 126 |
+
},
|
| 127 |
+
{reply, Stats, State};
|
| 128 |
+
|
| 129 |
+
handle_call(_Request, _From, State) ->
|
| 130 |
+
{reply, {error, unknown_request}, State}.
|
| 131 |
+
|
| 132 |
+
-spec handle_cast(term(), #state{}) -> {noreply, #state{}}.
|
| 133 |
+
handle_cast(_Msg, State) ->
|
| 134 |
+
{noreply, State}.
|
| 135 |
+
|
| 136 |
+
-spec handle_info(term(), #state{}) -> {noreply, #state{}}.
|
| 137 |
+
handle_info(_Info, State) ->
|
| 138 |
+
{noreply, State}.
|
| 139 |
+
|
| 140 |
+
-spec terminate(term(), #state{}) -> ok.
|
| 141 |
+
terminate(_Reason, _State) ->
|
| 142 |
+
ok.
|
| 143 |
+
|
| 144 |
+
-spec code_change(term() | {down, term()}, #state{}, term()) -> {ok, #state{}}.
|
| 145 |
+
code_change(_OldVsn, State, _Extra) ->
|
| 146 |
+
{ok, State}.
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/src/utils.erl
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% Utility functions module
|
| 2 |
+
-module(utils).
|
| 3 |
+
-include("../include/types.hrl").
|
| 4 |
+
|
| 5 |
+
%% String utilities
|
| 6 |
+
-export([
|
| 7 |
+
capitalize/1,
|
| 8 |
+
trim/1,
|
| 9 |
+
split_string/2,
|
| 10 |
+
format_currency/1,
|
| 11 |
+
validate_input/2
|
| 12 |
+
]).
|
| 13 |
+
|
| 14 |
+
%% List utilities
|
| 15 |
+
-export([
|
| 16 |
+
find_by_id/2,
|
| 17 |
+
group_by/2,
|
| 18 |
+
partition_by/2,
|
| 19 |
+
safe_nth/2
|
| 20 |
+
]).
|
| 21 |
+
|
| 22 |
+
%% Math utilities
|
| 23 |
+
-export([
|
| 24 |
+
calculate_discount/2,
|
| 25 |
+
round_to_decimal/2,
|
| 26 |
+
percentage/2
|
| 27 |
+
]).
|
| 28 |
+
|
| 29 |
+
%% Date/Time utilities
|
| 30 |
+
-export([
|
| 31 |
+
timestamp/0,
|
| 32 |
+
format_datetime/1,
|
| 33 |
+
days_between/2
|
| 34 |
+
]).
|
| 35 |
+
|
| 36 |
+
%%%===================================================================
|
| 37 |
+
%%% String utilities
|
| 38 |
+
%%%===================================================================
|
| 39 |
+
|
| 40 |
+
-spec capitalize(string()) -> string().
|
| 41 |
+
capitalize([]) -> [];
|
| 42 |
+
capitalize([H|T]) -> [string:to_upper(H) | T].
|
| 43 |
+
|
| 44 |
+
-spec trim(string()) -> string().
|
| 45 |
+
trim(String) ->
|
| 46 |
+
string:strip(string:strip(String, right), left).
|
| 47 |
+
|
| 48 |
+
-spec split_string(string(), string()) -> [string()].
|
| 49 |
+
split_string(String, Delimiter) ->
|
| 50 |
+
string:tokens(String, Delimiter).
|
| 51 |
+
|
| 52 |
+
-spec format_currency(float()) -> string().
|
| 53 |
+
format_currency(Amount) ->
|
| 54 |
+
lists:flatten(io_lib:format("$~.2f", [Amount])).
|
| 55 |
+
|
| 56 |
+
-spec validate_input(atom(), term()) -> boolean().
|
| 57 |
+
validate_input(email, Email) when is_list(Email) ->
|
| 58 |
+
models:validate_email(Email);
|
| 59 |
+
validate_input(age, Age) when is_integer(Age) ->
|
| 60 |
+
Age >= 0 andalso Age =< 150;
|
| 61 |
+
validate_input(name, Name) when is_list(Name) ->
|
| 62 |
+
length(Name) > 0 andalso length(Name) =< 100;
|
| 63 |
+
validate_input(_, _) ->
|
| 64 |
+
false.
|
| 65 |
+
|
| 66 |
+
%%%===================================================================
|
| 67 |
+
%%% List utilities
|
| 68 |
+
%%%===================================================================
|
| 69 |
+
|
| 70 |
+
-spec find_by_id(integer(), [tuple()]) -> {ok, tuple()} | {error, not_found}.
|
| 71 |
+
find_by_id(_Id, []) -> {error, not_found};
|
| 72 |
+
find_by_id(Id, [H|T]) when element(2, H) =:= Id -> {ok, H};
|
| 73 |
+
find_by_id(Id, [_|T]) -> find_by_id(Id, T).
|
| 74 |
+
|
| 75 |
+
-spec group_by(fun((term()) -> term()), [term()]) -> [{term(), [term()]}].
|
| 76 |
+
group_by(Fun, List) ->
|
| 77 |
+
Dict = lists:foldl(fun(Item, Acc) ->
|
| 78 |
+
Key = Fun(Item),
|
| 79 |
+
case lists:keyfind(Key, 1, Acc) of
|
| 80 |
+
{Key, Values} ->
|
| 81 |
+
lists:keyreplace(Key, 1, Acc, {Key, [Item|Values]});
|
| 82 |
+
false ->
|
| 83 |
+
[{Key, [Item]}|Acc]
|
| 84 |
+
end
|
| 85 |
+
end, [], List),
|
| 86 |
+
[{K, lists:reverse(V)} || {K, V} <- Dict].
|
| 87 |
+
|
| 88 |
+
-spec partition_by(fun((term()) -> boolean()), [term()]) -> {[term()], [term()]}.
|
| 89 |
+
partition_by(Predicate, List) ->
|
| 90 |
+
lists:partition(Predicate, List).
|
| 91 |
+
|
| 92 |
+
-spec safe_nth(integer(), [term()]) -> {ok, term()} | {error, out_of_bounds}.
|
| 93 |
+
safe_nth(N, List) when N > 0 andalso N =< length(List) ->
|
| 94 |
+
{ok, lists:nth(N, List)};
|
| 95 |
+
safe_nth(_, _) ->
|
| 96 |
+
{error, out_of_bounds}.
|
| 97 |
+
|
| 98 |
+
%%%===================================================================
|
| 99 |
+
%%% Math utilities
|
| 100 |
+
%%%===================================================================
|
| 101 |
+
|
| 102 |
+
-spec calculate_discount(float(), float()) -> float().
|
| 103 |
+
calculate_discount(Price, DiscountPercent) when DiscountPercent >= 0 andalso DiscountPercent =< 100 ->
|
| 104 |
+
Price * (100 - DiscountPercent) / 100.
|
| 105 |
+
|
| 106 |
+
-spec round_to_decimal(float(), integer()) -> float().
|
| 107 |
+
round_to_decimal(Number, Decimals) ->
|
| 108 |
+
Factor = math:pow(10, Decimals),
|
| 109 |
+
round(Number * Factor) / Factor.
|
| 110 |
+
|
| 111 |
+
-spec percentage(number(), number()) -> float().
|
| 112 |
+
percentage(Part, Total) when Total =/= 0 ->
|
| 113 |
+
(Part / Total) * 100;
|
| 114 |
+
percentage(_, 0) ->
|
| 115 |
+
0.0.
|
| 116 |
+
|
| 117 |
+
%%%===================================================================
|
| 118 |
+
%%% Date/Time utilities
|
| 119 |
+
%%%===================================================================
|
| 120 |
+
|
| 121 |
+
-spec timestamp() -> integer().
|
| 122 |
+
timestamp() ->
|
| 123 |
+
{MegaSecs, Secs, _MicroSecs} = os:timestamp(),
|
| 124 |
+
MegaSecs * 1000000 + Secs.
|
| 125 |
+
|
| 126 |
+
-spec format_datetime(integer()) -> string().
|
| 127 |
+
format_datetime(Timestamp) ->
|
| 128 |
+
{{Year, Month, Day}, {Hour, Minute, Second}} =
|
| 129 |
+
calendar:gregorian_seconds_to_datetime(Timestamp + 62167219200),
|
| 130 |
+
lists:flatten(io_lib:format("~4..0w-~2..0w-~2..0w ~2..0w:~2..0w:~2..0w",
|
| 131 |
+
[Year, Month, Day, Hour, Minute, Second])).
|
| 132 |
+
|
| 133 |
+
-spec days_between(integer(), integer()) -> integer().
|
| 134 |
+
days_between(Timestamp1, Timestamp2) ->
|
| 135 |
+
abs(Timestamp2 - Timestamp1) div (24 * 3600).
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/test/models_tests.erl
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% Unit tests for models module
|
| 2 |
+
-module(models_tests).
|
| 3 |
+
-include_lib("eunit/include/eunit.hrl").
|
| 4 |
+
-include("../include/records.hrl").
|
| 5 |
+
|
| 6 |
+
%%%===================================================================
|
| 7 |
+
%%% Test fixtures
|
| 8 |
+
%%%===================================================================
|
| 9 |
+
|
| 10 |
+
sample_user() ->
|
| 11 |
+
models:create_user(1, "John Doe", "john@example.com", 30).
|
| 12 |
+
|
| 13 |
+
sample_order() ->
|
| 14 |
+
Items = [
|
| 15 |
+
#item{id = 1, name = "Widget", price = 10.99, category = "tools"},
|
| 16 |
+
#item{id = 2, name = "Gadget", price = 25.50, category = "electronics"}
|
| 17 |
+
],
|
| 18 |
+
models:create_order(1, 1, Items).
|
| 19 |
+
|
| 20 |
+
%%%===================================================================
|
| 21 |
+
%%% User tests
|
| 22 |
+
%%%===================================================================
|
| 23 |
+
|
| 24 |
+
create_user_test() ->
|
| 25 |
+
User = models:create_user(1, "John Doe", "john@example.com", 30),
|
| 26 |
+
?assertEqual(1, User#user.id),
|
| 27 |
+
?assertEqual("John Doe", User#user.name),
|
| 28 |
+
?assertEqual("john@example.com", User#user.email),
|
| 29 |
+
?assertEqual(30, User#user.age),
|
| 30 |
+
?assertEqual(true, User#user.active).
|
| 31 |
+
|
| 32 |
+
update_user_test() ->
|
| 33 |
+
User = sample_user(),
|
| 34 |
+
UpdatedUser = models:update_user(User, [{name, "Jane Doe"}, {age, 25}]),
|
| 35 |
+
?assertEqual("Jane Doe", UpdatedUser#user.name),
|
| 36 |
+
?assertEqual(25, UpdatedUser#user.age),
|
| 37 |
+
?assertEqual("john@example.com", UpdatedUser#user.email). % unchanged
|
| 38 |
+
|
| 39 |
+
get_user_by_id_test() ->
|
| 40 |
+
?assertEqual({ok, #user{id = 1, name = "John Doe"}},
|
| 41 |
+
models:get_user_by_id(1)),
|
| 42 |
+
?assertEqual({error, not_found}, models:get_user_by_id(999)).
|
| 43 |
+
|
| 44 |
+
%%%===================================================================
|
| 45 |
+
%%% Order tests
|
| 46 |
+
%%%===================================================================
|
| 47 |
+
|
| 48 |
+
create_order_test() ->
|
| 49 |
+
Order = models:create_order(1, 1, []),
|
| 50 |
+
?assertEqual(1, Order#order.id),
|
| 51 |
+
?assertEqual(1, Order#order.user_id),
|
| 52 |
+
?assertEqual([], Order#order.items),
|
| 53 |
+
?assertEqual(pending, Order#order.status).
|
| 54 |
+
|
| 55 |
+
calculate_order_total_test() ->
|
| 56 |
+
Order = sample_order(),
|
| 57 |
+
Total = models:calculate_order_total(Order),
|
| 58 |
+
?assertEqual(36.49, Total). % 10.99 * 1 + 25.50 * 2
|
| 59 |
+
|
| 60 |
+
%%%===================================================================
|
| 61 |
+
%%% Validation tests
|
| 62 |
+
%%%===================================================================
|
| 63 |
+
|
| 64 |
+
validate_email_test() ->
|
| 65 |
+
?assertEqual(true, models:validate_email("user@example.com")),
|
| 66 |
+
?assertEqual(true, models:validate_email("test.email@domain.co.uk")),
|
| 67 |
+
?assertEqual(false, models:validate_email("invalid-email")),
|
| 68 |
+
?assertEqual(false, models:validate_email("@domain.com")),
|
| 69 |
+
?assertEqual(false, models:validate_email("user@")).
|
| 70 |
+
|
| 71 |
+
format_user_info_test() ->
|
| 72 |
+
User = sample_user(),
|
| 73 |
+
Info = models:format_user_info(User),
|
| 74 |
+
?assert(string:str(Info, "John Doe") > 0),
|
| 75 |
+
?assert(string:str(Info, "john@example.com") > 0),
|
| 76 |
+
?assert(string:str(Info, "30") > 0),
|
| 77 |
+
?assert(string:str(Info, "active") > 0).
|
projects/ui/serena-new/test/resources/repos/erlang/test_repo/test/utils_tests.erl
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%% Unit tests for utils module
|
| 2 |
+
-module(utils_tests).
|
| 3 |
+
-include_lib("eunit/include/eunit.hrl").
|
| 4 |
+
|
| 5 |
+
%%%===================================================================
|
| 6 |
+
%%% String utility tests
|
| 7 |
+
%%%===================================================================
|
| 8 |
+
|
| 9 |
+
capitalize_test() ->
|
| 10 |
+
?assertEqual("Hello", utils:capitalize("hello")),
|
| 11 |
+
?assertEqual("Test", utils:capitalize("test")),
|
| 12 |
+
?assertEqual("", utils:capitalize("")).
|
| 13 |
+
|
| 14 |
+
trim_test() ->
|
| 15 |
+
?assertEqual("hello", utils:trim(" hello ")),
|
| 16 |
+
?assertEqual("test", utils:trim("test")),
|
| 17 |
+
?assertEqual("", utils:trim(" ")).
|
| 18 |
+
|
| 19 |
+
format_currency_test() ->
|
| 20 |
+
?assertEqual("$10.50", utils:format_currency(10.5)),
|
| 21 |
+
?assertEqual("$0.99", utils:format_currency(0.99)),
|
| 22 |
+
?assertEqual("$100.00", utils:format_currency(100.0)).
|
| 23 |
+
|
| 24 |
+
validate_input_test() ->
|
| 25 |
+
?assertEqual(true, utils:validate_input(email, "test@example.com")),
|
| 26 |
+
?assertEqual(false, utils:validate_input(email, "invalid")),
|
| 27 |
+
?assertEqual(true, utils:validate_input(age, 25)),
|
| 28 |
+
?assertEqual(false, utils:validate_input(age, -5)),
|
| 29 |
+
?assertEqual(true, utils:validate_input(name, "John")),
|
| 30 |
+
?assertEqual(false, utils:validate_input(name, "")).
|
| 31 |
+
|
| 32 |
+
%%%===================================================================
|
| 33 |
+
%%% List utility tests
|
| 34 |
+
%%%===================================================================
|
| 35 |
+
|
| 36 |
+
find_by_id_test() ->
|
| 37 |
+
Items = [{item, 1, "first"}, {item, 2, "second"}, {item, 3, "third"}],
|
| 38 |
+
?assertEqual({ok, {item, 2, "second"}}, utils:find_by_id(2, Items)),
|
| 39 |
+
?assertEqual({error, not_found}, utils:find_by_id(999, Items)).
|
| 40 |
+
|
| 41 |
+
safe_nth_test() ->
|
| 42 |
+
List = [a, b, c, d, e],
|
| 43 |
+
?assertEqual({ok, c}, utils:safe_nth(3, List)),
|
| 44 |
+
?assertEqual({error, out_of_bounds}, utils:safe_nth(10, List)),
|
| 45 |
+
?assertEqual({error, out_of_bounds}, utils:safe_nth(0, List)).
|
| 46 |
+
|
| 47 |
+
%%%===================================================================
|
| 48 |
+
%%% Math utility tests
|
| 49 |
+
%%%===================================================================
|
| 50 |
+
|
| 51 |
+
calculate_discount_test() ->
|
| 52 |
+
?assertEqual(90.0, utils:calculate_discount(100.0, 10.0)),
|
| 53 |
+
?assertEqual(75.0, utils:calculate_discount(100.0, 25.0)),
|
| 54 |
+
?assertEqual(100.0, utils:calculate_discount(100.0, 0.0)).
|
| 55 |
+
|
| 56 |
+
round_to_decimal_test() ->
|
| 57 |
+
?assertEqual(10.99, utils:round_to_decimal(10.9876, 2)),
|
| 58 |
+
?assertEqual(15.0, utils:round_to_decimal(15.0001, 2)),
|
| 59 |
+
?assertEqual(0.33, utils:round_to_decimal(1/3, 2)).
|
| 60 |
+
|
| 61 |
+
percentage_test() ->
|
| 62 |
+
?assertEqual(50.0, utils:percentage(50, 100)),
|
| 63 |
+
?assertEqual(25.0, utils:percentage(1, 4)),
|
| 64 |
+
?assertEqual(0.0, utils:percentage(10, 0)).
|
| 65 |
+
|
| 66 |
+
%%%===================================================================
|
| 67 |
+
%%% Date/Time utility tests
|
| 68 |
+
%%%===================================================================
|
| 69 |
+
|
| 70 |
+
timestamp_test() ->
|
| 71 |
+
Timestamp = utils:timestamp(),
|
| 72 |
+
?assert(is_integer(Timestamp)),
|
| 73 |
+
?assert(Timestamp > 0).
|
| 74 |
+
|
| 75 |
+
format_datetime_test() ->
|
| 76 |
+
% Test with a known timestamp
|
| 77 |
+
Formatted = utils:format_datetime(1234567890),
|
| 78 |
+
?assert(is_list(Formatted)),
|
| 79 |
+
?assert(length(Formatted) > 0).
|
| 80 |
+
|
| 81 |
+
days_between_test() ->
|
| 82 |
+
Day1 = 1000000,
|
| 83 |
+
Day2 = 1000000 + (3 * 24 * 3600), % 3 days later
|
| 84 |
+
?assertEqual(3, utils:days_between(Day1, Day2)),
|
| 85 |
+
?assertEqual(3, utils:days_between(Day2, Day1)).
|
projects/ui/serena-new/test/resources/repos/go/test_repo/main.go
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package main
|
| 2 |
+
|
| 3 |
+
import "fmt"
|
| 4 |
+
|
| 5 |
+
func main() {
|
| 6 |
+
fmt.Println("Hello, Go!")
|
| 7 |
+
Helper()
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
func Helper() {
|
| 11 |
+
fmt.Println("Helper function called")
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
type DemoStruct struct {
|
| 15 |
+
Field int
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
func UsingHelper() {
|
| 19 |
+
Helper()
|
| 20 |
+
}
|
projects/ui/serena-new/test/resources/repos/java/test_repo/pom.xml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
| 2 |
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| 3 |
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
| 4 |
+
<modelVersion>4.0.0</modelVersion>
|
| 5 |
+
<groupId>org.example</groupId>
|
| 6 |
+
<artifactId>test_repo</artifactId>
|
| 7 |
+
<version>1.0-SNAPSHOT</version>
|
| 8 |
+
<packaging>jar</packaging>
|
| 9 |
+
<name>Java Test Repo</name>
|
| 10 |
+
<properties>
|
| 11 |
+
<maven.compiler.source>21</maven.compiler.source>
|
| 12 |
+
<maven.compiler.target>21</maven.compiler.target>
|
| 13 |
+
<maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
|
| 14 |
+
</properties>
|
| 15 |
+
|
| 16 |
+
<build>
|
| 17 |
+
<plugins>
|
| 18 |
+
<plugin>
|
| 19 |
+
<groupId>org.apache.maven.plugins</groupId>
|
| 20 |
+
<artifactId>maven-compiler-plugin</artifactId>
|
| 21 |
+
<version>${maven.compiler.plugin.version}</version>
|
| 22 |
+
<configuration>
|
| 23 |
+
<source>21</source>
|
| 24 |
+
<target>21</target>
|
| 25 |
+
</configuration>
|
| 26 |
+
</plugin>
|
| 27 |
+
</plugins>
|
| 28 |
+
</build>
|
| 29 |
+
</project>
|
projects/ui/serena-new/test/resources/repos/java/test_repo/src/main/java/test_repo/Main.java
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package test_repo;
|
| 2 |
+
|
| 3 |
+
public class Main {
|
| 4 |
+
public static void main(String[] args) {
|
| 5 |
+
Utils.printHello();
|
| 6 |
+
Model model = new Model("Cascade");
|
| 7 |
+
System.out.println(model.getName());
|
| 8 |
+
acceptModel(model);
|
| 9 |
+
}
|
| 10 |
+
public static void acceptModel(Model m) {
|
| 11 |
+
// Do nothing, just for LSP reference
|
| 12 |
+
}
|
| 13 |
+
}
|
projects/ui/serena-new/test/resources/repos/java/test_repo/src/main/java/test_repo/Model.java
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package test_repo;
|
| 2 |
+
|
| 3 |
+
public class Model {
|
| 4 |
+
private String name;
|
| 5 |
+
|
| 6 |
+
public Model(String name) {
|
| 7 |
+
this.name = name;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
public String getName() {
|
| 11 |
+
return name;
|
| 12 |
+
}
|
| 13 |
+
}
|